:root {
  --bg: #f6f5f2; --card: #fff; --ink: #17181b; --muted: #6b6e76; --line: #e3e1dc;
  --accent: #b8862b; --accent-ink: #fff; --ok: #2f7d4f; --warn: #b5651d; --bad: #b3261e; --info: #2c5d9e;
  --radius: 10px; --gap: 12px;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111214; --card: #1b1c20; --ink: #ecebe7; --muted: #9a9ca3; --line: #2c2e33; --accent: #e8c46b; --accent-ink: #111; }
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
h1 { font-size: 20px; margin: 0 0 var(--gap); }
h2 { font-size: 16px; margin: 20px 0 8px; }
h3 { font-size: 14px; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 16px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 8px 14px;
  background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; white-space: nowrap; font-size: 17px; }
.brand span { font-size: 14px; }
#nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
#nav a { padding: 6px 10px; border-radius: 8px; text-decoration: none; white-space: nowrap; color: var(--muted); font-size: 14px; }
#nav a.on { color: var(--ink); background: var(--bg); font-weight: 600; }
#nav .sep { width: 1px; background: var(--line); margin: 4px 6px; }
.bell { text-decoration: none; background: var(--bad); color: #fff; border-radius: 99px; font-size: 12px; padding: 1px 7px; }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: var(--gap); }
.row { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; gap: 12px; align-items: center; padding: 10px 0; flex-wrap: wrap; }
.item .grow { flex: 1; min-width: 180px; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 7px 12px;
  border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--bad); }
button.small { padding: 4px 9px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); }
input[type=checkbox], input[type=radio] { width: auto; margin-right: 6px; }
.check { display: flex; align-items: flex-start; gap: 6px; color: var(--ink); font-size: 14px; }
.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline > div { flex: 1; min-width: 110px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: 13px; cursor: pointer; background: var(--card); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.tag { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: currentColor; } .tag.warn { color: var(--warn); border-color: currentColor; }
.tag.bad { color: var(--bad); border-color: currentColor; } .tag.info { color: var(--info); border-color: currentColor; }
.banner { border-left: 4px solid var(--warn); }
.banner.bad { border-left-color: var(--bad); } .banner.ok { border-left-color: var(--ok); }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--line); flex: none; }
.thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }

/* Week calendar */
.cal { display: grid; grid-template-columns: 44px repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); overflow: hidden; font-size: 12px; padding-bottom: 10px; }
.cal .head { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--line); font-weight: 600; }
.cal .head.today { color: var(--accent); }
.cal .times { position: relative; border-right: 1px solid var(--line); }
.cal .times div { position: absolute; right: 4px; color: var(--muted); transform: translateY(-6px); }
.cal .day { position: relative; border-left: 1px solid var(--line); cursor: pointer; }
.cal .day.closed { background: repeating-linear-gradient(45deg, transparent 0 6px, var(--line) 6px 7px); cursor: default; }
.cal .hr { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.cal .ev { position: absolute; left: 2px; right: 2px; border-radius: 6px; padding: 2px 4px; overflow: hidden; background: var(--line);
  border-left: 3px solid var(--muted); line-height: 1.2; }
.cal .ev.mine { background: color-mix(in srgb, var(--accent) 22%, transparent); border-left-color: var(--accent); }
.cal .ev.req { opacity: .6; border-style: dashed; }
.cal .now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); }
.daily { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daily .cell { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 64px; cursor: pointer; font-size: 13px; }
.daily .cell.closed { opacity: .5; cursor: default; }
.daily .cell.taken { border-color: var(--muted); }
.daily .cell.mine { border-color: var(--accent); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 20; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); max-width: 460px; width: calc(100% - 24px); padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.45); }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.center { text-align: center; }
.hero { max-width: 420px; margin: 10vh auto; text-align: center; }
.hero .logo { font-size: 54px; color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
@media (max-width: 640px) {
  .brand span { display: none; }
  main { padding: 10px; }
  .cal { font-size: 10px; grid-template-columns: 30px repeat(7, 1fr); }
  .cal .ev .t2 { display: none; }
}
