:root {
  --bg: #0b0b0d;
  --panel: #131317;
  --panel-2: #191920;
  --line: #26262f;
  --text: #edeef2;
  --dim: #8e8fa0;
  --dimmer: #5d5e6d;
  --accent: #7c9cff;
  --accent-soft: #7c9cff22;
  --danger: #ff7a7a;
  --radius: 14px;
  --side: 268px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f6f8; --panel: #ffffff; --panel-2: #f0f0f4; --line: #e2e2ea;
    --text: #17171c; --dim: #63647a; --dimmer: #9293a6; --accent: #3d5bd9; --accent-soft: #3d5bd914;
  }
}

* { box-sizing: border-box; }

/* The UA rule for [hidden] is a bare attribute selector, so ANY class rule
   setting display beats it and the element stays on screen. Several panels
   below set display on a class and toggle .hidden via the attribute, so
   without this the whole app renders stacked at once. */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.boot { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--dimmer); }

.wordmark {
  margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em;
}

/* ------------------------------------------------------------- sign in */
.gate { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.gate-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 20px; padding: 30px 26px;
}
.gate-sub { margin: 6px 0 22px; color: var(--dim); font-size: 14px; }
.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.tab {
  flex: 1; border: 0; background: transparent; color: var(--dim);
  padding: 8px; border-radius: 7px; font-size: 13px; font-weight: 600;
}
.tab.is-on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px #0004; }

label { display: block; font-size: 12px; font-weight: 600; color: var(--dim); margin-bottom: 14px; }
input, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 13px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; outline: none; font-weight: 400;
}
input:focus, textarea:focus { border-color: var(--accent); background: var(--bg); }
input::placeholder, textarea::placeholder { color: var(--dimmer); }

.primary {
  width: 100%; padding: 11px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.primary:hover { filter: brightness(1.08); }
.ghost {
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); font-weight: 600; white-space: nowrap;
}
.link { border: 0; background: none; color: var(--dim); text-decoration: underline; padding: 0; font-size: 13px; }
.icon { border: 0; background: none; color: var(--dim); font-size: 20px; line-height: 1; padding: 4px 8px; }
.error { color: var(--danger); font-size: 13px; margin: 0 0 12px; }
.hint { color: var(--dimmer); font-size: 12px; }

/* ----------------------------------------------------------------- app */
.app { display: grid; grid-template-columns: var(--side) 1fr; height: 100%; }

.side {
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 16px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
}
.side-head { display: flex; align-items: center; justify-content: space-between; }
#side-close { display: none; }

.number-card {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 14px; display: grid; gap: 2px;
}
.number-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--dimmer); }
.number {
  border: 0; background: none; padding: 0; text-align: left;
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: var(--text);
}
.number:hover { color: var(--accent); }

.views { display: grid; gap: 2px; }
.view {
  text-align: left; border: 0; background: none; color: var(--dim);
  padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 14px;
}
.view:hover { background: var(--panel-2); }
.view.is-on { background: var(--accent-soft); color: var(--accent); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.tag-btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--dim);
  padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.tag-btn:hover { color: var(--text); }
.tag-btn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-btn .n { opacity: .55; margin-left: 5px; }

.side-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--dimmer); gap: 8px;
}
.side-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { overflow-y: auto; padding: 0 20px 80px; }
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center;
  padding: 16px 0; background: linear-gradient(var(--bg) 72%, transparent);
}
.bar input { margin: 0; }
#side-open { display: none; }
.chip {
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 5px 11px; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer;
}

.compose { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 20px; }
.compose textarea { margin: 0; resize: none; min-height: 44px; max-height: 40vh; }
.compose .primary { width: auto; padding: 11px 20px; align-self: stretch; }
.compose-reminder { gap: 8px; }
.compose-reminder input { margin: 0; }
#rem-at { max-width: 220px; }

.feed { display: grid; gap: 10px; max-width: 760px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.card.pinned { border-color: var(--accent); }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--dimmer); margin-bottom: 7px; }
.card-top .src {
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  background: var(--panel-2); border-radius: 5px; padding: 1px 6px;
}
.card-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }
.card-actions button { border: 0; background: none; color: var(--dimmer); padding: 2px 5px; border-radius: 6px; font-size: 12px; }
.card-actions button:hover { background: var(--panel-2); color: var(--text); }
.card-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.card-body a { color: var(--accent); }
.card-body .h { color: var(--accent); font-weight: 600; }
.card-media { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.card-media img { max-height: 220px; border-radius: 10px; border: 1px solid var(--line); }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.card-tags .t {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--dim);
  border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600;
}
.card-tags .t.auto { border-style: dashed; }
.card-tags .t:hover { color: var(--text); }
.card.due { border-left: 3px solid var(--accent); }
.card.done { opacity: .5; }

.empty { color: var(--dimmer); text-align: center; padding: 48px 20px; }

.settings { max-width: 620px; }
.settings h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--dimmer); margin: 26px 0 10px; }
.row { display: flex; gap: 8px; }
.row input { margin: 0; }
.phones { display: grid; gap: 8px; margin-bottom: 10px; }
.phone {
  display: flex; align-items: center; gap: 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.phone .v { font-weight: 600; }
.phone .badge { font-size: 11px; color: var(--dimmer); }
.phone button { margin-left: auto; border: 0; background: none; color: var(--danger); font-size: 12px; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 84vw; max-width: var(--side);
    transform: translateX(-101%); transition: transform .2s ease; z-index: 20;
  }
  .app.side-open .side { transform: none; box-shadow: 0 0 60px #000a; }
  #side-open, #side-close { display: block; }
  .main { padding: 0 14px 80px; }
  .compose { flex-direction: column; }
  .compose .primary { width: 100%; }
  .compose-reminder { flex-direction: column; }
  #rem-at { max-width: none; }
}

.boot { flex-direction: column; gap: 14px; text-align: center; padding: 24px; }
.boot p { margin: 0; max-width: 32ch; }
