:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-2: #f0f5f2;
  --ink: #162024;
  --muted: #63717a;
  --line: #dfe7e2;
  --brand: #0f766e;
  --brand-2: #246b9f;
  --brand-soft: #dff3ef;
  --warn: #b7791f;
  --warn-soft: #fff1cc;
  --danger: #b6422d;
  --danger-soft: #ffe2db;
  --ok: #2f7d4f;
  --ok-soft: #dff2e7;
  --purple: #6c4aa5;
  --purple-soft: #eee7fb;
  --shadow: 0 18px 42px rgba(31, 43, 49, 0.1);
  --shadow-soft: 0 8px 24px rgba(31, 43, 49, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121817;
  --surface: #1b2422;
  --surface-2: #22302d;
  --ink: #edf5f2;
  --muted: #aab9b5;
  --line: #31413d;
  --brand-soft: #153d39;
  --warn-soft: #44330f;
  --danger-soft: #4b211b;
  --ok-soft: #173a27;
  --purple-soft: #2e2443;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fafbf7 0%, var(--bg) 44%, var(--bg) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

[data-theme="dark"] body {
  background: linear-gradient(180deg, #141b1a 0%, var(--bg) 46%, var(--bg) 100%);
}

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

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}

.login-visual {
  padding: 56px;
  background:
    radial-gradient(circle at 20% 18%, rgba(184, 225, 216, 0.18), transparent 34%),
    linear-gradient(135deg, #10251f, #173e44 54%, #1d4f55);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-visual h1 {
  font-size: clamp(3rem, 5.4vw, 6rem);
  line-height: 0.95;
  margin: 22px 0 18px;
  max-width: 760px;
}

.login-visual p {
  color: rgba(255, 255, 255, 0.78);
  max-width: 620px;
  font-size: 1.08rem;
  line-height: 1.6;
}

.login-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 900;
}

.login-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 760px;
}

.login-metric {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.login-metric strong {
  display: block;
  font-size: 1.6rem;
}

.login-panel {
  padding: 36px;
  display: grid;
  align-content: center;
  gap: 18px;
  background: var(--surface);
}

.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.login-fields {
  display: grid;
  gap: 10px;
}

.login-fields input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.connection-preview {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
}

.connection-preview strong {
  font-size: 0.92rem;
}

.connection-preview span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 750;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #152522;
  color: #f7fbfa;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eaf8f4;
  color: var(--brand);
  font-weight: 900;
}

.brand h1,
.brand p,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-size: 1.05rem;
}

.brand p {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
  font-weight: 750;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav button.active {
  box-shadow: inset 3px 0 0 #89d7cc;
}

.sync-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.07);
  display: grid;
  gap: 10px;
}

.sync-card small {
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.45;
}

.sync-card .button {
  width: 100%;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: clamp(1.75rem, 2.4vw, 2.55rem);
  line-height: 1.08;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search {
  min-height: 44px;
  width: min(340px, 30vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  box-shadow: var(--shadow-soft);
}

.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.button,
.icon-button,
.fab {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 800;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button.primary,
.fab {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button:hover,
.icon-button:hover,
.fab:hover,
.quick-actions button:hover {
  transform: translateY(-1px);
}

.icon-button {
  width: 42px;
  padding: 0;
}

.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 15;
  box-shadow: var(--shadow);
}

.view-grid {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  padding: 18px;
  min-width: 0;
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card-head h3 {
  font-size: 1.02rem;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.metric strong {
  display: block;
  font-size: 2.05rem;
  line-height: 1;
}

.metric {
  min-height: 126px;
  display: grid;
  align-content: space-between;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.metric p:first-child {
  font-weight: 850;
  color: var(--ink);
}

.assistant-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, var(--surface), var(--brand-soft));
  border-color: rgba(15, 118, 110, 0.18);
  padding: 22px;
}

.assistant-strip h3,
.focus-copy strong,
.focus-hero h3 {
  font-size: 1.45rem;
  line-height: 1.25;
}

.today-board {
  align-items: start;
}

.today-hero {
  min-height: 168px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.action-card {
  min-height: 168px;
  text-align: left;
  align-content: space-between;
  justify-items: start;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.action-card.active {
  border-color: var(--brand);
  background: linear-gradient(180deg, var(--brand-soft), var(--surface));
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12), var(--shadow-soft);
}

.action-card strong {
  font-size: 2.1rem;
  line-height: 1;
}

.action-card span {
  color: var(--muted);
  line-height: 1.35;
}

.action-card-kicker {
  color: var(--ink) !important;
  font-weight: 900;
}

.action-card em {
  color: var(--brand);
  font-style: normal;
  font-weight: 900;
}

.today-detail-panel {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 12px;
}

.mode-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.focus-card {
  min-height: 260px;
  display: grid;
  align-content: space-between;
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  border-color: rgba(36, 107, 159, 0.18);
}

.focus-copy {
  display: grid;
  gap: 10px;
}

.focus-copy p {
  color: var(--muted);
  line-height: 1.55;
}

.checklist {
  display: grid;
  gap: 10px;
}

.checklist label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
}

.checklist input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.stack {
  display: grid;
  gap: 10px;
}

.row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
  display: grid;
  gap: 8px;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.row:hover {
  border-color: rgba(15, 118, 110, 0.28);
}

.row.clickable {
  width: 100%;
  text-align: left;
}

.clickable-row {
  padding: 0;
  overflow: hidden;
}

.row-main {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 12px;
  display: grid;
  gap: 8px;
  cursor: pointer;
}

.row-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.row-title strong {
  overflow-wrap: anywhere;
}

.meta-line {
  color: var(--muted);
  font-size: 0.86rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 850;
  background: var(--brand-soft);
  color: var(--brand);
  white-space: nowrap;
}

.badge.high,
.badge.urgent {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.medium {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.low,
.badge.open {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.info {
  background: var(--purple-soft);
  color: var(--purple);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar select,
.toolbar input,
.dialog input,
.dialog select,
.dialog textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  min-height: 42px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  overflow-x: auto;
}

.day {
  border-right: 1px solid var(--line);
  min-height: 520px;
  padding: 12px;
}

.day:last-child {
  border-right: 0;
}

.day h3 {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
}

.task-workspace {
  display: grid;
  gap: 16px;
}

.task-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, var(--surface), var(--brand-soft));
  border-color: rgba(15, 118, 110, 0.18);
}

.quick-task-form {
  display: flex;
  gap: 10px;
}

.quick-task-form input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  min-height: 44px;
}

.task-mode-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.task-bucket {
  box-shadow: none;
  display: grid;
  gap: 4px;
  min-height: 94px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.task-bucket strong {
  font-size: 1.8rem;
}

.task-bucket span {
  color: var(--muted);
  font-weight: 800;
}

.task-board {
  grid-template-columns: repeat(7, minmax(250px, 1fr));
}

.kanban-column {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 480px;
}

.split {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
}

.detail {
  min-height: 620px;
}

.detail h3 {
  font-size: 1.45rem;
  margin-bottom: 8px;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-actions {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px 10px 10px;
  background: rgba(255, 255, 255, 0.35);
}

.quick-actions button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  transition: transform 140ms ease, border-color 140ms ease;
}

.risk-row {
  background: var(--danger-soft);
}

.suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.premium-timeline {
  position: relative;
}

.timeline-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
  transition: border-color 140ms ease, transform 140ms ease;
}

.timeline-item:hover {
  border-color: rgba(36, 107, 159, 0.28);
  transform: translateY(-1px);
}

.timeline-time {
  min-height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  font-size: 0.82rem;
}

.view-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.focus-mode {
  display: grid;
  gap: 16px;
}

.focus-hero {
  min-height: 330px;
  display: grid;
  align-content: center;
  gap: 18px;
  text-align: center;
  background: linear-gradient(145deg, var(--surface), var(--brand-soft));
}

.focus-hero p {
  max-width: 680px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.6;
}

.focus-hero .actions {
  justify-content: center;
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.account-grid,
.project-grid,
.delivery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.status-card {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.status-pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.dialog {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(10, 16, 16, 0.48);
}

.dialog form {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  background: #142320;
  color: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 auto;
}

.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 1120px) {
  .app-shell,
  .login-screen,
  .split,
  .task-command,
  .settings-grid,
  .focus-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .action-grid,
  .today-detail-panel,
  .mode-card {
    grid-column: span 6;
  }

  .today-detail-panel {
    position: static;
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: span 6;
  }
}

@media (max-width: 720px) {
  .main,
  .login-panel,
  .login-visual,
  .sidebar {
    padding: 16px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .toolbar,
  .assistant-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .nav,
  .dashboard-grid,
  .action-grid,
  .task-summary-grid,
  .form-grid,
  .login-metrics {
    grid-template-columns: 1fr;
  }

  .mode-card {
    display: grid;
  }

  .quick-task-form,
  .task-mode-bar {
    flex-direction: column;
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: span 1;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, 180px);
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .view-options {
    grid-template-columns: 1fr;
  }

  .focus-hero {
    min-height: 260px;
    text-align: left;
  }

  .focus-hero .actions {
    justify-content: flex-start;
  }
}
