:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --panel: #ffffff;
  --panel-2: #f8faf8;
  --card: #fbfcfb;
  --card-hover: #f4f8f2;
  --text: #1b1f1d;
  --muted: #65706c;
  --line: #d8dfdb;
  --accent: #91c11e;
  --accent-dark: #567a0a;
  --accent-soft: #edf6dc;
  --danger: #b4233a;
  --warn: #a56b00;
  --ok: #289d4f;
  --shadow: 0 12px 28px rgb(31 41 36 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input, textarea, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  color: inherit;
  background: #e9eee9;
  border-radius: 4px;
  min-height: 34px;
  padding: 7px 11px;
  font-weight: 850;
}

button:hover { background: #dde6dc; }
button:disabled { cursor: not-allowed; opacity: .55; }

input, textarea, select {
  width: 100%;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.auth-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.auth-brand {
  display: grid;
  gap: 10px;
}

.auth-brand img {
  width: min(210px, 72%);
  height: auto;
  margin-bottom: 10px;
}

.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.hidden { display: none !important; }

.primary {
  background: var(--accent);
  color: #11150f;
}
.primary:hover { background: #a4dc25; }
.danger { background: #9f1239; }
.danger:hover { background: #be123c; }
.ghost { background: transparent; border: 1px solid var(--line); }
.icon-btn { width: 36px; padding: 0; display: grid; place-items: center; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.app.tv-mode {
  grid-template-rows: auto 1fr;
  background: #090b0a;
  color: #f5f5f2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 62px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 15;
  box-shadow: 0 8px 24px rgb(31 41 36 / 8%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand img {
  width: 150px;
  height: auto;
  flex: 0 0 auto;
}

.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--line);
}

.brand-product {
  color: #232927;
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand span, .muted {
  color: var(--muted);
  font-size: 12px;
}

.main-nav,
.tabs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: #252b28;
  min-height: 34px;
}

.tab.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: #d4e8aa;
}

.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  color: #252b28;
  font-size: 12px;
  font-weight: 850;
}

.board-strip {
  display: grid;
  grid-template-columns: minmax(250px, 1.25fr) repeat(4, minmax(86px, .26fr)) auto;
  gap: 10px;
  padding: 14px 14px 0;
  align-items: stretch;
}

.board-title,
.stat,
.dense-create {
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.board-title {
  min-width: 0;
  padding: 10px 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.board-title h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
}

.board-title span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
}

.stat {
  display: grid;
  align-content: center;
  padding: 8px 10px;
}

.stat span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.stat strong {
  color: #101411;
  font-size: 26px;
  line-height: 1;
  margin-top: 2px;
}

.dense-create {
  min-width: 104px;
  height: auto;
  border-radius: 0;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(5, minmax(100px, 150px));
  gap: 8px;
  padding: 10px 14px;
}

.tv-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid #323433;
  background: #090b0a;
}

.tv-header h1 {
  margin: 0;
  font-size: 22px;
}

.tv-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tv-header img {
  width: 176px;
  height: auto;
}

.tv-header span {
  color: #a7aaa5;
  font-size: 13px;
}

.tv-stats {
  text-align: right;
}

.tv-stats strong {
  display: block;
  color: #a7ee45;
  font-size: 34px;
  line-height: 1;
}

.today-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 10px;
}

.today-header h2 {
  margin: 0;
  font-size: 26px;
}

.today-header span {
  color: var(--muted);
  font-size: 14px;
}

.today-list {
  display: grid;
  gap: 8px;
  width: min(980px, calc(100% - 40px));
  margin: 0 auto 28px;
}

.today-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  align-items: stretch;
}

.today-bucket {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  color: #303733;
  font-weight: 800;
}

.empty-state {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.board {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 14px 14px;
  align-items: flex-start;
}

.bucket {
  flex: 0 0 272px;
  max-height: calc(100vh - 172px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tv-mode .board {
  height: calc(100vh - 76px);
  padding: 10px 12px 12px;
  background: #090b0a;
}

.tv-mode .bucket {
  flex-basis: 292px;
  max-height: 100%;
  background: #111312;
  border-color: #323433;
  box-shadow: none;
}

.tv-mode .task-card {
  cursor: default;
}

.bucket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  padding: 0 9px;
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--line);
}

.bucket-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.swatch {
  width: 8px;
  height: 24px;
  border-radius: 0;
  flex: 0 0 auto;
}

.bucket-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #303733;
  font-size: 12px;
  text-transform: uppercase;
}

.add-task {
  margin: 7px;
  text-align: left;
  background: #f3f7f0;
  border: 1px dashed #cfe4a4;
  color: var(--accent-dark);
  min-height: 30px;
}

.cards {
  display: grid;
  gap: 6px;
  padding: 0 7px 8px;
  overflow-y: auto;
  min-height: 160px;
}

.task-card {
  background: var(--card);
  border: 1px solid #e0e6e2;
  border-left: 4px solid var(--accent);
  border-radius: 0;
  padding: 7px 8px;
  box-shadow: none;
}

.task-card:hover { background: var(--card-hover); }
.task-card.completed { opacity: .62; }
.task-card.dragging { outline: 2px solid var(--accent); }
.task-card.is-warn { border-left-color: #d2a43b; }
.task-card.is-hot { border-left-color: #c96868; }

.task-title {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  line-height: 1.22;
  word-break: break-word;
}

.task-title strong {
  font-size: 12px;
}

.complete-dot {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  margin-top: 0;
}

.completed .complete-dot {
  background: var(--ok);
  border-color: var(--ok);
}

.labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.chip {
  color: #07111f;
  border-radius: 0;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 950;
  text-transform: uppercase;
}

.meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  margin-top: 6px;
}

.overdue { color: var(--danger); font-weight: 800; }
.soon { color: #fbbf24; font-weight: 800; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgb(0 0 0 / 48%);
  z-index: 50;
}

.drawer {
  width: min(680px, 100%);
  height: 100%;
  overflow-y: auto;
  background: #ffffff;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}

.task-modal {
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  align-self: center;
  margin: 18px auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.drawer h2 { margin: 0; font-size: 20px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #303733;
}

.check-item, .comment, .admin-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.comment p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.admin {
  padding: 14px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.admin-menu {
  align-self: start;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.admin-menu button {
  text-align: left;
  background: transparent;
}

.admin-menu button.active { background: #26344d; }
.admin-menu button.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.admin-main {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-item {
  display: grid;
  gap: 10px;
}

.status-panel {
  display: grid;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 420px;
  z-index: 80;
}

@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .filters, .board-strip { grid-template-columns: 1fr 1fr; }
  .admin { grid-template-columns: 1fr; }
  .today-item { grid-template-columns: 1fr; }
  .user-actions, .main-nav { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .filters, .board-strip, .grid-2 { grid-template-columns: 1fr; }
  .bucket { flex-basis: 86vw; }
  .tabs { overflow-x: auto; }
  .brand { flex-wrap: wrap; }
  .brand-divider { display: none; }
}
