:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --ink: #1e2320;
  --muted: #69706d;
  --line: #ded8cd;
  --green: #1d7b64;
  --green-soft: #dff1eb;
  --blue: #2c68a5;
  --blue-soft: #e2eef9;
  --red: #ba3b34;
  --red-soft: #f7dfdc;
  --amber: #a96713;
  --amber-soft: #f7ead2;
  --violet: #7050a2;
  --violet-soft: #ece5f6;
  --shadow: 0 14px 36px rgba(47, 41, 31, 0.08);
  --radius: 8px;
  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:
    linear-gradient(180deg, rgba(255, 253, 249, 0.86), rgba(246, 243, 237, 0.96)),
    radial-gradient(circle at top left, rgba(29, 123, 100, 0.12), transparent 30%),
    var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1,
.section-heading h2 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.topbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-pill,
.version-pill,
.soft-badge,
.count-label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.82);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.version-pill {
  min-height: 28px;
  padding: 0 10px;
  border-color: rgba(29, 123, 100, 0.22);
  background: rgba(29, 123, 100, 0.1);
  color: var(--green);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, 0.74);
}

.tab {
  min-width: max-content;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  font-weight: 750;
}

.tab.is-active {
  background: var(--ink);
  color: #fff;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 18px;
}

.section-heading h2 {
  font-size: clamp(26px, 4vw, 38px);
}

.search-input {
  width: min(280px, 100%);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 0 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card,
.panel,
.item-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, 0.9);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 130px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
  position: relative;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent, var(--green));
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric-value {
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
  font-weight: 850;
}

.morning-panel {
  margin-bottom: 14px;
}

.readiness-panel {
  margin-bottom: 14px;
}

.morning-grid,
.budget-grid,
.readiness-grid {
  display: grid;
  gap: 10px;
}

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

.readiness-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 12px;
}

.readiness-card {
  min-width: 0;
  min-height: 96px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
  padding: 11px;
}

.readiness-card.good {
  border-left-color: var(--green);
}

.readiness-card.warn {
  border-left-color: var(--amber);
}

.readiness-card.danger {
  border-left-color: var(--red);
}

.readiness-card span,
.readiness-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.28;
}

.readiness-card strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.readiness-actions {
  justify-content: flex-start;
}

.morning-tile,
.budget-cell {
  min-width: 0;
  border-left: 4px solid var(--accent, var(--green));
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
}

.morning-value {
  margin-top: 8px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.05;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.inline-form {
  margin-bottom: 12px;
}

.inline-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.inline-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 10px 11px;
}

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

.budget-cell {
  display: grid;
  gap: 4px;
  border-left-color: var(--green);
}

.budget-cell span,
.budget-cell small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.budget-cell strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.card-finance-panel {
  margin-bottom: 14px;
}

.card-summary-grid,
.card-detail-grid {
  display: grid;
  gap: 10px;
}

.card-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.card-detail-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
}

.card-summary-cell,
.summary-block {
  min-width: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.card-summary-cell {
  display: grid;
  gap: 5px;
  border-left: 4px solid var(--accent, var(--green));
  padding: 12px;
}

.card-summary-cell span,
.card-summary-cell small,
.summary-block-title,
.owner-row span,
.mini-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.card-summary-cell strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.summary-block {
  border: 1px solid var(--line);
  padding: 12px;
}

.summary-block-title {
  margin-bottom: 8px;
}

.owner-breakdown,
.mini-list {
  display: grid;
  gap: 8px;
}

.owner-row,
.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.owner-row:first-child,
.mini-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.owner-row > div,
.mini-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.owner-row > div:last-child,
.mini-row > div:last-child {
  text-align: right;
}

.owner-row strong,
.mini-row strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.metric-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.content-grid,
.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.module-grid {
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 12px;
}

.panel-heading h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.item-list,
.timeline {
  display: grid;
  gap: 10px;
}

.item-list.compact {
  gap: 8px;
}

.item-card {
  display: grid;
  gap: 9px;
  padding: 13px;
  box-shadow: none;
  background: var(--surface-strong);
}

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

.item-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 820;
  overflow-wrap: anywhere;
}

.item-meta,
.empty-state,
.item-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.item-note {
  margin: 0;
}

.badge-row,
.item-actions,
.category-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

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

.status-badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

.status-badge.good {
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.violet {
  background: var(--violet-soft);
  color: var(--violet);
}

.text-button,
.primary-button,
.secondary-button,
.danger-button,
.file-button {
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0 13px;
  font-weight: 800;
}

.text-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary-button {
  border: 0;
  background: var(--green);
  color: #fff;
}

.secondary-button,
.file-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-button {
  border: 1px solid rgba(186, 59, 52, 0.3);
  background: var(--red-soft);
  color: var(--red);
}

.file-button {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-row {
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 0 11px;
  color: var(--ink) !important;
}

.toggle-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--green);
}

.status-stack {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.status-stack.compact-status {
  margin-top: 0;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  padding: 0 11px;
  color: var(--muted);
  font-size: 13px;
}

.status-line strong {
  color: var(--ink);
  text-align: right;
}

.category-manager-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.category-scope-block {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.category-scope-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.category-scope-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.category-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0 8px 0 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.category-chip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.category-chip button {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 900;
  line-height: 1;
  padding: 0;
}

.voice-orb {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 34px;
  line-height: 1;
  margin-bottom: 12px;
}

.voice-orb.is-listening {
  background: var(--amber-soft);
  color: var(--amber);
  box-shadow: 0 0 0 8px rgba(169, 103, 19, 0.12);
}

.assistant-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 14px;
}

.assistant-answer {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.assistant-memory-panel {
  margin: 14px 0;
}

.assistant-suggestion-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.assistant-suggestion {
  border: 1px solid rgba(29, 123, 100, 0.24);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.35;
}

.assistant-note-card {
  background: rgba(255, 255, 255, 0.78);
}

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

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

.shortcut-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 13px;
}

.shortcut-url {
  display: block;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 243, 237, 0.72);
  color: var(--muted);
  padding: 8px 9px;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.shortcut-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 10px 11px;
}

.stack-form textarea {
  resize: vertical;
}

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

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

.timeline-day {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.timeline-date {
  min-height: 48px;
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
  padding: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 850;
}

.timeline-items {
  display: grid;
  gap: 8px;
}

.timeline-chip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 11px;
  font-size: 13px;
  min-width: 0;
}

.timeline-chip span:first-child {
  overflow-wrap: anywhere;
  font-weight: 760;
}

.timeline-chip span:last-child {
  color: var(--muted);
  white-space: nowrap;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(12px, 1fr));
  gap: 7px;
  align-items: end;
  height: 160px;
  padding: 10px 2px 4px;
}

.bar {
  min-height: 8px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--green), #64a892);
  position: relative;
}

.bar::after {
  content: attr(data-label);
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.category-row {
  margin-top: 20px;
}

.empty-state {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30, 35, 32, 0.38);
  z-index: 20;
}

.modal-panel {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(30, 35, 32, 0.24);
  padding: 16px;
}

.modal-panel #editFields {
  display: grid;
  gap: 12px;
}

.modal-actions {
  justify-content: end;
  margin-top: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  min-width: min(360px, calc(100% - 32px));
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  text-align: center;
  font-weight: 750;
  transition: 180ms ease;
  z-index: 10;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .metric-grid,
  .morning-grid,
  .readiness-grid,
  .content-grid,
  .card-summary-grid,
  .shortcut-grid,
  .module-grid {
    grid-template-columns: 1fr 1fr;
  }

  .module-grid,
  .card-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .metric-grid,
  .morning-grid,
  .readiness-grid,
  .content-grid,
  .card-summary-grid,
  .shortcut-grid {
    grid-template-columns: 1fr;
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .manual-statement-grid {
    grid-template-columns: 1fr;
  }

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

  .timeline-date {
    min-height: 36px;
    place-items: center start;
  }

  .bar-chart {
    height: 130px;
    gap: 5px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100vh - 20px);
  }

  .modal-actions {
    justify-content: stretch;
  }

  .modal-actions button {
    flex: 1 1 130px;
  }

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

  .shortcut-actions {
    grid-template-columns: 1fr;
  }

  .owner-row,
  .mini-row {
    align-items: stretch;
    flex-direction: column;
  }

  .owner-row > div:last-child,
  .mini-row > div:last-child {
    text-align: left;
  }
}
