:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee6;
  --ink: #2b2730;
  --muted: #7a7380;
  --line: #e7e0d5;
  --accent: #8a6d8f;
  --accent-ink: #ffffff;
  --gold: #b8975a;
  --ok: #3f7d5a;
  --warn: #b7791f;
  --danger: #b4443c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(43, 39, 48, .06), 0 4px 16px rgba(43, 39, 48, .05);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

/* Layout */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: #2b2730; color: #e9e3ec; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: var(--serif); font-size: 26px; color: #fff; padding: 0 10px 18px; display: flex; gap: 8px; align-items: center; }
.brand small { display: block; font-family: var(--sans); font-size: 11px; color: #b9b0bf; letter-spacing: .08em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #d8d0dd; text-decoration: none; margin-bottom: 2px; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav .sep { height: 1px; background: rgba(255, 255, 255, .1); margin: 12px 8px; }
.nav-foot { margin-top: 18px; padding: 0 12px; font-size: 12px; color: #a69dac; }
.nav-foot button { background: none; border: 1px solid rgba(255,255,255,.2); color: #d8d0dd; border-radius: 8px; padding: 6px 10px; cursor: pointer; margin-top: 6px; }
.main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; color: var(--muted); }
.btn.menu-toggle { display: none; }

/* Components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.stack > * + * { margin-top: 16px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-family: var(--serif); font-size: 32px; font-weight: 600; margin-top: 2px; }
.kpi .sub { color: var(--muted); font-size: 12px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 9px; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: progress; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.badge.ok { background: #e4f1e9; color: var(--ok); }
.badge.warn { background: #fbf0dc; color: var(--warn); }
.badge.danger { background: #f8e2df; color: var(--danger); }
.badge.accent { background: #efe7f0; color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search], .toolbar select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); min-width: 220px; }

/* Forms */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #d9c9dc; border-color: var(--accent); }
.field.check { display: flex; gap: 8px; align-items: center; }
.field.check input { width: auto; }
.field.check label { margin: 0; font-weight: 500; color: var(--ink); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; background: #fff; cursor: pointer; font-weight: 500; color: var(--ink); font-size: 13px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(43, 39, 48, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 680px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .actions { justify-content: flex-end; margin-top: 18px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.error { background: var(--danger); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kcol h3 { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.kcard:hover { border-color: var(--accent); }
.kcard .name { font-weight: 600; }
.score { font-weight: 700; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.score.hot { background: #f8e2df; color: var(--danger); }
.score.warm { background: #fbf0dc; color: var(--warn); }
.score.cold { background: #e6eef6; color: #3d6a96; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dow { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal .day { min-height: 96px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.cal .day.other { background: #fbf9f6; color: #bbb; }
.cal .day.today .num { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 6px; }
.cal .num { font-size: 12px; font-weight: 600; }
.cal .ev { display: block; font-size: 11px; background: #efe7f0; color: var(--accent); border-radius: 5px; padding: 1px 5px; margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.cal .ev.wedding { background: #f6eedd; color: #8a6a2c; }
.cal .ev.deadline { background: #f8e2df; color: var(--danger); }

/* Timeline */
.tl-month { margin-bottom: 18px; }
.tl-month h3 { font-family: var(--sans); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); }
.tl-item { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tl-item.done .t { text-decoration: line-through; color: var(--muted); }
.tl-item .t { flex: 1; }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); }

/* Strategy */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 96px; }
.swatch .chip { height: 56px; border-radius: 10px; border: 1px solid var(--line); }
.swatch .n { font-size: 12px; margin-top: 4px; font-weight: 600; }
.swatch .h { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; }
.tabs button.active { color: var(--accent); border-color: var(--accent); }
.prose { line-height: 1.65; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.2em; }
.prose ul { padding-left: 20px; }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.clean li:last-child { border: none; }
pre.code { background: var(--surface-2); padding: 12px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; font-size: 12px; }
.bar { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bar .lbl { width: 110px; font-size: 13px; }
.bar .track { flex: 1; background: var(--surface-2); height: 10px; border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 20%, #efe7f0, transparent 50%), radial-gradient(circle at 80% 80%, #f6eedd, transparent 50%), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 30px; }
.auth h1 { text-align: center; font-size: 36px; }
.auth .form { grid-template-columns: 1fr; }

@media (max-width: 1000px) {
  .grid.k4 { grid-template-columns: 1fr 1fr; }
  .grid.c3, .grid.c2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .btn.menu-toggle { display: inline-flex; margin-bottom: 12px; }
  .main { padding: 16px; }
  .form { grid-template-columns: 1fr; }
  .grid.k4 { grid-template-columns: 1fr 1fr; }
}
@media print {
  .sidebar, .no-print, .menu-toggle { display: none !important; }
  .layout { display: block; }
  .card { box-shadow: none; }
}
