:root {
  --bg: #f5efe4;
  --ink: #202525;
  --muted: #68716d;
  --soft: #fffaf1;
  --soft-2: #efe3d2;
  --line: #decfbb;
  --line-strong: #cdbb9f;
  --teal: #13776c;
  --teal-2: #0b5750;
  --blue: #416f9f;
  --coral: #d85f42;
  --amber: #bd8429;
  --green-soft: #dcebe2;
  --red-soft: #f6ded7;
  --yellow-soft: #f7ead2;
  --shadow: 0 18px 44px rgba(51, 39, 24, 0.10);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: #20251f;
  --sidebar-ink: #fff7e8;
  --focus: 0 0 0 3px rgba(19, 119, 108, 0.22);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Avenir Next", "PingFang SC", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none !important;
}

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

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

.app-shell.is-locked {
  display: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(32, 37, 31, 0.92), rgba(19, 119, 108, 0.78)),
    var(--bg);
}

.auth-shell.is-unlocked {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(255, 250, 241, 0.36);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.96);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1;
}

.auth-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
}

.brand-block h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  font-weight: 870;
}

.brand-copy {
  margin: 16px 0 0;
  color: rgba(255, 247, 232, 0.74);
  font-size: 14px;
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #e2ae4e;
}

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

.nav-list button {
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 247, 232, 0.78);
  text-align: left;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-list button:hover,
.nav-list button:focus-visible,
.nav-list button.is-active {
  outline: 0;
  background: rgba(255, 247, 232, 0.12);
  color: #fff;
}

.nav-list button:hover {
  transform: translateX(2px);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 4px;
  color: rgba(255, 247, 232, 0.64);
  font-size: 13px;
}

.sidebar-footer strong {
  color: #fff;
}

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

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

.topbar h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  font-weight: 880;
}

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

.account-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 250, 241, 0.82);
  color: var(--teal-2);
  font-size: 13px;
  font-weight: 820;
}

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

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 18px;
  align-items: start;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.92);
}

.panel-pad {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.panel-header p {
  max-width: 560px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

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

.stat {
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid #eadcc8;
  border-radius: var(--radius-sm);
  background: #fff7ea;
}

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

.stat strong {
  color: var(--teal-2);
  font-size: 34px;
  line-height: 1;
}

.stat p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.hero-progress {
  display: grid;
  gap: 13px;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfcf;
}

.progress-bar span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

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

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

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

.field.full {
  grid-column: 1 / -1;
}

.field label,
.filter-label {
  color: #343b38;
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select,
.inline-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffdf8;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.inline-input:focus {
  border-color: var(--teal);
  box-shadow: var(--focus);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.chip-button {
  min-height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 13px;
  font-weight: 820;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover,
.primary-button:focus-visible {
  outline: 0;
  background: var(--teal-2);
  transform: translateY(-1px);
}

.ghost-button,
.chip-button {
  background: #fffaf1;
  color: var(--ink);
  border-color: var(--line);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.chip-button:hover,
.chip-button:focus-visible,
.chip-button.is-active {
  outline: 0;
  border-color: var(--teal);
  color: var(--teal-2);
}

.icon-button {
  width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-color: var(--line);
  background: #fffaf1;
  color: var(--teal-2);
  font-size: 24px;
}

.danger-button {
  background: #fff8f5;
  border-color: #f0c9bf;
  color: #9a3d28;
}

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

.item-row,
.knowledge-card,
.todo-card,
.job-card,
.plan-card,
.feedback-card {
  border: 1px solid #eadcc8;
  border-radius: var(--radius-sm);
  background: #fff7ea;
  padding: 15px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.item-row h4,
.knowledge-card h4,
.todo-card h4,
.job-card h4,
.plan-card h4,
.feedback-card h4 {
  margin: 0;
  font-size: 16px;
}

.item-row p,
.knowledge-card p,
.todo-card p,
.job-card p,
.plan-card p,
.feedback-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e5eee8;
  color: var(--teal-2);
  font-size: 12px;
  font-weight: 820;
}

.badge.blue {
  background: #e2ebf5;
  color: #315f8c;
}

.badge.amber {
  background: var(--yellow-soft);
  color: #85570e;
}

.badge.red {
  background: var(--red-soft);
  color: #963c28;
}

.badge.gray {
  background: #eee7dc;
  color: #5f615d;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.notice-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 13px;
  border: 1px solid #eadcc8;
  border-radius: var(--radius-sm);
  background: #f8efe0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.notice-strip strong {
  color: var(--ink);
}

.split-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.meta-table {
  display: grid;
  gap: 9px;
}

.meta-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #eadcc8;
}

.meta-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.meta-row strong {
  font-size: 13px;
  line-height: 1.5;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 250, 241, 0.65);
}

.todo-status {
  display: grid;
  grid-template-columns: 140px minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.quick-feedback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px auto;
  gap: 8px;
  margin-top: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.small-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.code-block {
  overflow: auto;
  max-height: 260px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #242722;
  color: #fff7e8;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.version-list {
  max-height: 420px;
  overflow: auto;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 24px;
  }

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

  .layout-grid,
  .layout-grid.equal {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .main-area {
    padding: 18px;
  }

  .topbar,
  .panel-header,
  .card-top,
  .item-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
  }

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

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

  .meta-row,
  .todo-status,
  .quick-feedback,
  .notice-strip {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar h2 {
    font-size: 32px;
  }
}
