:root {
  color-scheme: light;
  --bg: #faf7f2; --card: #fff; --ink: #1f1b24; --muted: #6f6a76; --line: #ece6dc;
  --accent: #f5b82e; --accent-ink: #2b2100; --good: #16a34a; --bad: #dc2626; --warn: #d97706;
  --radius: 14px; --shadow: 0 1px 2px rgba(31,27,36,.05), 0 4px 14px rgba(31,27,36,.04);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.02rem; }
a { color: inherit; }
.muted { color: var(--muted); } .tiny { font-size: .8rem; } .right { text-align: right; } .hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 36px 28px; width: min(100%, 380px); text-align: center; }
.signin-mark { font-size: 44px; }
.signin-card h1 { font-size: 1.8rem; }
.notice { background: #fff4d6; border: 1px solid #f1d98c; border-radius: 10px; padding: 10px 12px; margin: 14px 0; font-size: .9rem; text-align: left; }
.btn-google { display: inline-flex; gap: 10px; align-items: center; justify-content: center; width: 100%; margin: 18px 0 12px; }

/* header */
.top { position: sticky; top: 0; z-index: 5; background: rgba(250,247,242,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.brand { font-weight: 700; text-decoration: none; white-space: nowrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 7px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); white-space: nowrap; font-weight: 500; }
.tabs a:hover { background: #f1ebe0; }
.tabs a.on { background: var(--ink); color: #fff; }
.who { display: flex; align-items: center; gap: 10px; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 22px 16px 80px; }

/* controls */
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: #d9cfbd; }
button:disabled { opacity: .55; cursor: default; }
.btn-primary, button.primary { background: var(--accent); border-color: #e9a915; color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover, button.primary:hover { background: #f0ad14; }
button.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; }
button.danger { color: var(--bad); }
button.small { padding: 4px 10px; font-size: .85rem; }
input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #d9d2c5; border-radius: 10px; background: #fff; color: var(--ink); }
input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--ink); font-size: 15px; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-radius: 0; background: #fff; }
.seg button.on { background: var(--ink); color: #fff; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .g2, .g3 { grid-template-columns: 1fr; } .who span { display: none; } }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stat .label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.stat .sub { font-size: .85rem; color: var(--muted); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #f1ebe0; color: var(--muted); }
.pill.warn { background: #fff0d6; color: var(--warn); } .pill.good { background: #dcf5e4; color: var(--good); } .pill.bad { background: #fde2e2; color: var(--bad); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.stack > * + * { margin-top: 14px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.scroll { overflow-x: auto; }

/* schedule */
.day { padding: 14px 16px; }
.day.today { border-color: #e9a915; box-shadow: 0 0 0 2px #fbe3a4, var(--shadow); }
.day-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.day-head strong { font-size: 1.02rem; }
.bar { position: relative; background: #f6f1e7; border-radius: 8px; margin: 6px 0 10px; }
.bar .lane { position: relative; height: 12px; margin: 3px 0; }
.bar .seg-ev { position: absolute; top: 0; bottom: 0; border-radius: 4px; opacity: .88; min-width: 2px; }
.bar .free { position: absolute; top: 0; bottom: 0; background: rgba(22,163,74,.13); }
.bar-axis { display: flex; justify-content: space-between; font-size: .68rem; color: var(--muted); margin-top: -6px; margin-bottom: 8px; }
.cols { display: grid; gap: 12px; grid-template-columns: repeat(var(--n, 2), 1fr); }
@media (max-width: 640px) { .cols { grid-template-columns: 1fr; } }
.col h4 { margin: 0 0 4px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.ev { padding: 5px 8px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 8%, white); border-radius: 0 8px 8px 0; margin-bottom: 5px; font-size: .9rem; }
.ev.clash { box-shadow: inset 0 0 0 1px var(--bad); }
.ev .t { color: var(--muted); font-size: .78rem; }
.ev.nobusy { opacity: .6; }
.freeline { margin-top: 6px; font-size: .88rem; color: var(--good); font-weight: 500; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .88rem; }

/* charts + bars */
.chart { width: 100%; height: auto; display: block; }
.hbar { display: grid; grid-template-columns: 120px 1fr 100px; gap: 10px; align-items: center; margin: 7px 0; font-size: .9rem; }
.hbar .track { background: #f1ebe0; border-radius: 6px; height: 10px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 6px; background: var(--accent); }
.hbar .fill.debt { background: #ef6a5a; }

dialog { border: 0; border-radius: 18px; padding: 22px; width: min(94vw, 480px); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); background: #fff; }
dialog::backdrop { background: rgba(31,27,36,.45); }
dialog h3 { margin-bottom: 12px; }
.dlg-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .9rem; z-index: 20; max-width: 90vw; }
.toast.err { background: var(--bad); }
.calcheck { display: flex; gap: 8px; align-items: center; padding: 4px 0; color: var(--ink); font-size: .92rem; margin: 0; }
