/* AZ Hub — warm paper theme (matched to My Universe artifact) */
:root {
  --bg: #faf9f5;
  --panel: #ffffff;
  --card: #ffffff;
  --hover: #f5f3ec;
  --line: #ece9e0;
  --line2: #e0ddd2;
  --ink: #141413;
  --ink2: #46443d;
  --muted: #85827a;
  --faint: #b0aea5;
  --accent: #d97757;
  --accent-soft: #f7ece7;
  --accent-ink: #b3543a;
  --green: #788c5d;
  --green-soft: #eef1e7;
  --red: #be4a32;
  --red-soft: #f7e7e1;
  --amber: #a87f3d;
  --amber-soft: #f3ecdd;
  --blue: #6a9bcc;
  --blue-soft: #eaf1f8;
  --radius: 15px;
  --shadow: 0 1px 2px rgba(20, 20, 19, 0.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 13.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.main { min-width: 0; }
a { color: inherit; text-decoration: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.center { text-align: center; }
.link { color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.link:hover { text-decoration: underline; }
.danger-text { color: var(--red); }

/* shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 212px; flex-shrink: 0; padding: 18px 12px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 18px; font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.brand.big { justify-content: center; padding: 0 0 8px; font-size: 19px; }
.brand-name { color: var(--ink); }
.brand-name b, .brand-hub { color: var(--accent); }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(217, 119, 87, 0.28);
}
.sidebar nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  border-radius: 9px; color: var(--ink2); font-weight: 550; font-size: 13px;
}
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.nav-icon { width: 19px; text-align: center; font-size: 14px; }
.logout-form { padding: 6px 4px; }

.main { flex: 1; padding: 24px 30px 90px; max-width: 1160px; }

/* header */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
h2 { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.head-actions { display: flex; gap: 8px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow); }
.tile-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.tile-label { font-size: 11px; color: var(--muted); margin-top: 1px; font-weight: 600; }
.tile.accent .tile-value { color: var(--accent-ink); }
.tile.danger .tile-value { color: var(--red); }

/* layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid-2 > * { min-width: 0; }
.prose { overflow-wrap: break-word; }
.panel {
  min-width: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.subhead { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 13px 0 5px; }
.subhead.danger-text { color: var(--red); }

/* rows */
.row {
  display: flex; align-items: center; gap: 11px; padding: 9px 8px;
  border-radius: 9px; border-bottom: 1px solid var(--line);
}
.row:last-of-type { border-bottom: none; }
a.row:hover, .task-row:hover { background: var(--hover); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title.strike { text-decoration: line-through; color: var(--muted); }
.row-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.avatar.sq { border-radius: 9px; background: var(--amber-soft); color: var(--amber); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 650; padding: 2px 9px; border-radius: 99px;
  background: var(--line); color: var(--ink2); white-space: nowrap; border: 0;
}
.prio { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 99px; flex-shrink: 0; }
.prio.p1 { background: var(--red-soft); color: var(--red); }
.prio.p2 { background: var(--amber-soft); color: var(--amber); }
.prio.p3 { background: #efece4; color: #9a978d; }
.prio.p4 { background: var(--hover); color: var(--faint); }

/* checkbox */
.check {
  width: 19px; height: 19px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--line2); background: #fff; cursor: pointer;
}
.check:hover { border-color: var(--green); }
.check.done { background: var(--green); border-color: var(--green); position: relative; }
.check.done::after { content: '✓'; color: #fff; font-size: 11px; position: absolute; top: -2px; left: 3px; }

/* buttons & forms */
.btn, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 17px; border-radius: 10px; font-weight: 650; font-size: 12.5px;
  border: 0; cursor: pointer; font-family: inherit; transition: filter 0.12s;
}
.btn { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(217, 119, 87, 0.28); }
.btn:hover { filter: brightness(1.06); }
.btn.small { padding: 7px 13px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn-ghost { background: #fff; color: var(--ink2); border: 1px solid var(--line2); box-shadow: var(--shadow); }
.btn-ghost:hover { background: var(--hover); }
.btn-ghost.small { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.form { display: flex; flex-direction: column; gap: 13px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input, select, textarea {
  background: #fff; border: 1px solid var(--line2); border-radius: 10px;
  padding: 9px 12px; color: var(--ink); font-size: 13.5px; font-family: inherit; width: 100%;
  text-transform: none; letter-spacing: normal; font-weight: 500;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 160px; }
.filters select { width: auto; }
.filters button { flex-shrink: 0; }
.quick-add { display: flex; gap: 8px; margin-bottom: 10px; }
.quick-add input[name="content"], .quick-add input[name="body"] { flex: 1; }
.quick-add input[type="date"] { width: auto; }

/* tabs */
.tabs { display: flex; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 14px; font-size: 13px; font-weight: 650; color: var(--muted); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink2); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* prose */
.prose { font-size: 13.5px; color: var(--ink2); }
.prose.article { font-size: 14.5px; max-width: 720px; color: var(--ink); }
.prose h1, .prose h2, .prose h3 { margin: 18px 0 8px; color: var(--ink); text-transform: none; letter-spacing: normal; }
.prose h1 { font-size: 19px; } .prose h2 { font-size: 16px; font-weight: 750; } .prose h3 { font-size: 14px; font-weight: 700; }
.prose p, .prose ul, .prose ol { margin: 8px 0; }
.prose ul, .prose ol { padding-left: 22px; }
.prose code { background: var(--hover); border: 1px solid var(--line); padding: 1px 5px; border-radius: 6px; font-size: 12px; }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); margin: 10px 0; }
.prose a { color: var(--accent-ink); text-decoration: underline; }
.prose strong { color: var(--ink); }
.digest-body { max-height: 420px; overflow-y: auto; }
.digest-meta { font-size: 11.5px; margin-bottom: 8px; }

/* details */
.dl { display: grid; grid-template-columns: 90px 1fr; gap: 7px 12px; font-size: 13px; margin-bottom: 12px; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { color: var(--ink2); }
.note { padding: 10px 0; border-bottom: 1px solid var(--line); }
.note-date { font-size: 11px; margin-top: 4px; }
.token-box {
  background: var(--bg); border: 1px dashed var(--accent); border-radius: 10px;
  padding: 12px; word-break: break-all; margin-bottom: 10px; user-select: all; color: var(--accent-ink);
}
.flash {
  background: var(--green-soft); border: 1px solid var(--green);
  color: var(--green); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; font-weight: 600;
}

/* auth */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg); }
.auth-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 10px 32px rgba(20, 20, 19, 0.12);
}

/* mobile */
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; width: 100%;
    flex-direction: row; align-items: center; padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--line);
    background: rgba(250, 249, 245, 0.96); backdrop-filter: blur(12px); z-index: 50;
  }
  .brand, .logout-form { display: none; }
  .sidebar nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 3px; padding: 6px 9px; font-size: 10px; }
  .nav-icon { font-size: 17px; }
  .main { padding: 18px 14px 96px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
}
