:root {
  --ground: #F0EEE9;
  --surface: #FFFFFF;
  --line: #DDD9D0;
  --line-soft: #EEEAE3;
  --field: #CFCAC0;
  --ink: #1C1B19;
  --ink-2: #3D3B37;
  --muted: #5E5B54;
  --teal: #0B7268;
  --teal-dark: #08544D;
  --teal-tint: #DDF1EE;
  --deep: #0E3B37;
  --red: #8F1D14;
  --red-tint: #FDECEA;
  --dineline: #9A4604; --dineline-bg: #FBEBDD;
  --admc: #1F55C7; --admc-bg: #E3ECFC;
  --opt: #0B7268; --opt-bg: #DDF1EE;
  --personal: #6B3FB5; --personal-bg: #EEE6FA;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); } a:hover { color: var(--teal-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar */
.bar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar-in { max-width: 1280px; margin: 0 auto; padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; color: var(--ink); }
.mark { width: 32px; height: 32px; border-radius: 8px; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { padding: 10px 14px; border-radius: 8px; color: var(--ink-2); text-decoration: none; }
.nav a:hover { background: var(--line-soft); color: var(--ink); }
.nav a.on { background: var(--teal-tint); color: var(--teal-dark); font-weight: 600; }
.quick { flex: 1 1 280px; display: flex; gap: 8px; min-width: 0; }
.quick input { flex: 1; min-width: 0; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.who-name { display: flex; flex-direction: column; line-height: 1.2; }
.who-name b { font-size: 14px; } .who-name span { font-size: 12px; color: var(--muted); }

/* layout */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 56px; display: flex; flex-direction: column; gap: 22px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.title { font-size: 32px; line-height: 1.15; letter-spacing: -0.02em; margin: 2px 0 4px; }
.sub { color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.main-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.side-col { flex: 1 1 330px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card-h h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.note { font-size: 13px; color: var(--muted); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* controls */
.btn { height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--field); background: var(--surface); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: #F7F5F1; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.dark:hover { background: #33312D; }
.btn.small { height: 36px; padding: 0 12px; font-size: 14px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-soft); }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: 0.55; cursor: default; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.field { height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 10px; background: #FAF9F6; min-width: 0; }
textarea.field { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.field:focus, .btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible, .nav a:focus-visible, input[type=checkbox]:focus-visible { outline: 3px solid #7CC4BB; outline-offset: 1px; }
label.lbl { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checks label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-size: 14px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--teal); margin: 0; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--field); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 500; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.l-dineline { --c: var(--dineline); --b: var(--dineline-bg); }
.l-admc { --c: var(--admc); --b: var(--admc-bg); }
.l-opt { --c: var(--opt); --b: var(--opt-bg); }
.l-personal { --c: var(--personal); --b: var(--personal-bg); }
.tag[class*="l-"] { color: var(--c); background: var(--b); }
.dot[class*="l-"] { background: var(--c); }

/* timeline */
.tl { display: flex; flex-direction: column; gap: 10px; }
.tl-row { display: flex; gap: 14px; align-items: stretch; }
.tl-time { width: 92px; flex: none; padding-top: 11px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-time b { display: block; color: var(--ink); }
.tl-card { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 10px; }
.tl-card.meet { background: var(--b); }
.tl-card.focus { background: var(--surface); border: 1.5px dashed var(--c); }
.tl-card.past { opacity: 0.6; }
.tl-card.now { box-shadow: 0 0 0 3px var(--teal-tint); }
.tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.tl-title { font-weight: 600; }
.tl-tasks { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: #4A4843; }
.now-pill { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; }
.warn { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--red-tint); color: var(--red); font-size: 13px; font-weight: 500; }
.allday { display: flex; flex-wrap: wrap; gap: 6px; }

/* do next */
.next { background: var(--deep); color: #fff; border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.next .eyebrow { color: #BFE3DE; }
.next-title { font-size: 20px; font-weight: 600; line-height: 1.3; }
.next-why { font-size: 14px; color: #D5ECE8; }
.next .btn { border: 0; color: var(--deep); }
.next .btn.ghost { color: #fff; border: 1px solid #5E8F89; }
.next .btn.ghost:hover { background: rgba(255,255,255,0.08); }

/* task rows */
.tasks { display: flex; flex-direction: column; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.task:first-child { border-top: 0; }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task-title { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.task.done .task-title { text-decoration: line-through; color: #6B6862; }
.task-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.task-meta .late { color: var(--red); font-weight: 600; }
.task-meta .soon { color: var(--ink); font-weight: 600; }
.task input[type=checkbox] { margin-top: 2px; }
.ro { width: 18px; height: 18px; margin-top: 2px; flex: none; color: var(--muted); }
.empty { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* week */
.week-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.week { min-width: 820px; }
.wk-row { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); }
.wk-head { border-bottom: 1px solid var(--line); }
.wk-day { padding: 10px 6px; text-align: center; border-left: 1px solid var(--line-soft); }
.wk-day .d { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.wk-day .n { font-size: 20px; font-weight: 600; }
.wk-day.today { background: var(--ink); color: #fff; }
.wk-all { border-bottom: 1px solid var(--line); min-height: 34px; }
.wk-all > div { padding: 4px; border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wk-all .lbl-s { font-size: 11px; color: var(--muted); padding: 8px 6px; text-align: right; border: 0; }
.wk-pill { padding: 3px 6px; border-radius: 6px; font-size: 11px; font-weight: 600; color: var(--c); background: var(--b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-hours { position: relative; }
.wk-hours span { position: absolute; right: 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; transform: translateY(-7px); }
.wk-col { position: relative; border-left: 1px solid var(--line-soft); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 55px, #F1EEE8 55px, #F1EEE8 56px); }
.wk-col.today { background-color: #FAFDFC; }
.wk-ev { position: absolute; overflow: hidden; padding: 3px 6px; border-radius: 6px; color: var(--c); background: var(--b); font-size: 12px; line-height: 1.25; }
.wk-ev b { display: block; font-weight: 600; }
.wk-ev.clash { outline: 2px solid #C0392B; outline-offset: -1px; }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: #C0392B; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; flex-direction: column; gap: 4px; }
.bar-top { display: flex; justify-content: space-between; font-size: 14px; }
.bar-top b { font-variant-numeric: tabular-nums; }
.track { height: 8px; border-radius: 4px; background: var(--line-soft); }
.fill { height: 8px; border-radius: 4px; background: var(--c); }
.clash-card { background: var(--red-tint); color: #5C130D; border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }

/* tables */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; padding: 14px 12px; }
td { padding: 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 18px; }
.person { display: flex; align-items: center; gap: 12px; }
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-soft); color: #4A4843; }
.status.ok { background: var(--teal-tint); color: #0B5A52; }
.status.err { background: var(--red-tint); color: var(--red); }

/* dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
dialog::backdrop { background: rgba(28,27,25,0.45); }
.dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { font-size: 20px; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; font-size: 13px; }

/* sign-in */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth form { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px; display: flex; flex-direction: column; gap: 14px; }
.auth h1 { font-size: 24px; letter-spacing: -0.01em; }
.err { color: var(--red); font-size: 14px; font-weight: 500; min-height: 1px; }

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

@media (max-width: 640px) {
  .bar-in, .page { padding-left: 16px; padding-right: 16px; }
  .title { font-size: 26px; }
  .tl-time { width: 64px; }
  .who-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
