/* Publy — โทนแบบ Apple: พื้นเทาอ่อน การ์ดขาว เงานุ่ม มุมโค้ง รองรับโหมดมืดอัตโนมัติ */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --surface-3: #e8e8ed;
  --glass: rgba(250, 250, 252, 0.78);
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #a1a1a6;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.12);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --green: #28a745;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #c77700;
  --orange-soft: rgba(255, 159, 10, 0.16);
  --red: #d70015;
  --red-soft: rgba(255, 59, 48, 0.12);
  --purple: #8e44ad;
  --purple-soft: rgba(175, 82, 222, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --side-w: 240px;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Sukhumvit Set", "Helvetica Neue", "Noto Sans Thai", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-3: #3a3a3c;
    --glass: rgba(28, 28, 30, 0.72);
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #6e6e73;
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.15);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --purple: #bf5af2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); min-height: 100vh; font-size: 14px; line-height: 1.45; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* ---------- shell ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 10;
  background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; padding: 0 8px 16px; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 800;
  background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 55%, #bf5af2 100%); box-shadow: 0 2px 8px rgba(94, 92, 230, 0.35);
}
.create-btn { width: 100%; justify-content: center; margin-bottom: 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink); font-weight: 500; text-decoration: none;
}
.nav a svg { color: var(--ink-2); }
.nav a:hover { background: var(--surface-3); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a.active svg { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 11px; color: var(--ink-2); background: var(--surface-3); border-radius: 999px; padding: 1px 7px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }

main { margin-left: var(--side-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.topbar .sub { color: var(--ink-2); font-size: 13px; }
#view { padding: 8px 28px 80px; max-width: 1440px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 980px; padding: 8px 16px;
  background: var(--surface-3); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, transform 0.1s, opacity 0.15s; text-decoration: none;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--red); background: transparent; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.lg { padding: 11px 22px; font-size: 15px; font-weight: 600; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2);
  display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

input[type=text], input[type=password], input[type=url], input[type=search], input[type=datetime-local], select, textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 12px;
  background: var(--surface); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: vertical; line-height: 1.6; }
label.field { display: block; }
label.field > span { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }

.seg {
  display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 2px; gap: 2px; max-width: 100%; overflow-x: auto;
}
.seg button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 500;
  color: var(--ink); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.seg.sm button { padding: 4px 10px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.switch { position: relative; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; transition: background 0.2s; cursor: pointer; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; background: #fff; border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.2s;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.dry { background: var(--purple-soft); color: var(--purple); }
.pill.live { background: var(--red-soft); color: var(--red); }
.st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.scheduled { background: var(--accent-soft); color: var(--accent); }
.st.publishing { background: var(--orange-soft); color: var(--orange); }
.st.done, .st.published { background: var(--green-soft); color: var(--green); }
.st.simulated { background: var(--purple-soft); color: var(--purple); }
.st.partial { background: var(--orange-soft); color: var(--orange); }
.st.failed { background: var(--red-soft); color: var(--red); }

.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.panel-head h3, h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 18px; }
.warn { display: flex; gap: 8px; align-items: flex-start; background: var(--orange-soft); color: var(--orange); border-radius: var(--r-sm); padding: 8px 12px; font-size: 13px; }
.errbox { background: var(--red-soft); color: var(--red); border-radius: var(--r-sm); padding: 8px 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.empty { text-align: center; padding: 56px 20px; color: var(--ink-2); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- avatars ---------- */
.av {
  position: relative; border-radius: 50%; background: var(--surface-3) center/cover; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 12px;
}
.pbadge {
  position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--surface); font-size: 7.5px; display: grid; place-items: center; color: #fff; font-weight: 800; line-height: 1;
}
.av-stack { display: flex; align-items: center; }
.av-stack .av { box-shadow: 0 0 0 2px var(--surface); }
.av-stack .av + .av, .av-stack .more { margin-left: -8px; }
.av-stack .more { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); font-size: 11px; font-weight: 600; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.pglyph { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; }

/* ---------- composer ---------- */
.composer { display: grid; grid-template-columns: 280px minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1240px) { .composer { grid-template-columns: 260px minmax(0, 1fr); } .preview-col { grid-column: 1 / -1; } }
@media (max-width: 860px) { .composer { grid-template-columns: 1fr; } }
.acc-panel { position: sticky; top: 76px; padding: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 96px); }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { padding-left: 32px; background: var(--surface-2); border-color: transparent; border-radius: 10px; }
.search input:focus { background: var(--surface); }
.pfilters { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--surface-2); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--ink);
}
.chip.on { background: var(--ink); color: var(--surface); }
.acc-tools { display: flex; justify-content: space-between; font-size: 12px; padding: 2px 2px 8px; border-bottom: 1px solid var(--line); }
.acc-list { overflow-y: auto; margin: 0 -6px; padding: 6px 6px 0; flex: 1; min-height: 120px; }
.acc-row {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; border-radius: 10px;
  padding: 7px 8px; cursor: pointer; text-align: left;
}
.acc-row:hover { background: var(--surface-2); }
.acc-row .nm { flex: 1; min-width: 0; }
.acc-row .nm b { display: block; font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-row .nm small { color: var(--ink-2); font-size: 11px; }
.check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex-shrink: 0; transition: all 0.15s; }
.acc-row.on .check { background: var(--accent); border-color: var(--accent); }
.acc-row.on .check::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }

.editor { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.write { padding: 0; overflow: hidden; position: relative; }
.write-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.write .tabs-wrap { padding: 12px 18px 0; }
.write textarea {
  border: 0; border-radius: 0; box-shadow: none !important; background: transparent; min-height: 220px;
  padding: 14px 18px; font-size: 15px; resize: none;
}
.write .thumbs { padding: 0 18px 12px; }
.write-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--surface-2); }
.tool { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: 8px; padding: 6px 10px; color: var(--ink-2); cursor: pointer; font-weight: 500; font-size: 13px; }
.tool:hover { background: var(--surface-3); color: var(--ink); }
.counter { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; padding: 0 8px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.counter .over { color: var(--red); font-weight: 600; }
.hint { font-size: 12px; color: var(--ink-2); padding: 0 8px; }
.drop-over::after {
  content: "วางไฟล์ที่นี่"; position: absolute; inset: 6px; border: 2px dashed var(--accent); border-radius: 14px;
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); display: grid; place-items: center; color: var(--accent); font-weight: 600; font-size: 15px;
}
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 88px; height: 88px; border-radius: 12px; overflow: hidden; background: #000; box-shadow: var(--shadow-sm); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(8px); }
.thumb .vid { position: absolute; left: 6px; bottom: 5px; color: #fff; font-size: 11px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.thumb.pick { cursor: pointer; width: 104px; height: 104px; }
.thumb.pick.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.uploading { width: 88px; height: 88px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 11px; color: var(--ink-2); }

.when-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.when-row input { max-width: 240px; }
.action-bar {
  position: sticky; bottom: 16px; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lg);
}
.action-bar.static { position: static; box-shadow: var(--shadow); }
.problems { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.problems:empty { display: none; }

/* ---------- previews ---------- */
.preview-col { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 96px); overflow-y: auto; }
.pv { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.pv-head { display: flex; gap: 10px; align-items: center; padding: 12px 14px 8px; }
.pv-head b { font-size: 13.5px; display: block; line-height: 1.2; }
.pv-head small { color: var(--ink-2); font-size: 12px; }
.pv-text { padding: 0 14px 10px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.pv-media { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; background: #000; }
.pv-media.one { grid-template-columns: 1fr; }
.pv-media img, .pv-media video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.pv-media.one img, .pv-media.one video { aspect-ratio: auto; max-height: 420px; }
.pv-actions { display: flex; justify-content: space-around; padding: 6px 8px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.pv-actions span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; }
.pv.ig .pv-media img, .pv.ig .pv-media video { aspect-ratio: 4 / 5; }
.pv.ig .pv-media { grid-template-columns: 1fr; }
.ig-actions { display: flex; gap: 14px; padding: 10px 14px 6px; color: var(--ink); }
.ig-actions .sp { margin-left: auto; }
.pv.ig .pv-text { padding-top: 0; }
.pv.x { display: flex; gap: 10px; padding: 12px 14px; }
.pv.x .x-body { flex: 1; min-width: 0; }
.pv.x .pv-text, .pv.x .x-head { padding: 0; }
.pv.x .x-head { font-size: 13.5px; margin-bottom: 2px; }
.pv.x .x-head small { color: var(--ink-2); }
.pv.x .pv-media { border-radius: 14px; overflow: hidden; margin-top: 8px; border: 1px solid var(--line); }
.pv.x .x-actions { display: flex; justify-content: space-between; color: var(--ink-2); margin-top: 10px; max-width: 300px; }
.pv.vertical { background: #000; color: #fff; aspect-ratio: 9 / 16; max-height: 560px; position: relative; display: flex; align-items: flex-end; }
.pv.vertical video, .pv.vertical img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pv.vertical .v-over { position: relative; padding: 14px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); width: 100%; }
.pv.vertical .v-over b { display: block; margin-bottom: 4px; }
.pv.vertical .v-over p { margin: 0; font-size: 13px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pv-note { text-align: center; font-size: 12px; color: var(--ink-2); }

/* ---------- posts ---------- */
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 16px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-sm); }
@media (max-width: 760px) { .post { grid-template-columns: 1fr; } }
.post-thumb { width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.post-thumb img, .post-thumb video { width: 100%; height: 100%; object-fit: cover; }
.post-text { white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.post-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.targets { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.target { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.cal .dow { padding: 10px; font-size: 11px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; text-align: right; border-bottom: 1px solid var(--line); }
.cal .day { min-height: 124px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: background 0.1s; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day:hover { background: var(--surface-2); }
.cal .day:hover .add-hint { opacity: 1; }
.cal .day.other { background: color-mix(in srgb, var(--surface-2) 50%, var(--surface)); }
.cal .day.other .dn { color: var(--ink-3); }
.cal .day.weekend:not(.other) { background: color-mix(in srgb, var(--surface-2) 35%, var(--surface)); }
.day-top { display: flex; justify-content: space-between; align-items: center; }
.add-hint { opacity: 0; color: var(--accent); font-size: 16px; line-height: 1; padding-left: 4px; transition: opacity 0.15s; }
.dn { width: 26px; height: 26px; display: grid; place-items: center; font-size: 13px; font-weight: 500; border-radius: 50%; margin-left: auto; }
.cal .day.today .dn { background: var(--red); color: #fff; font-weight: 700; }
.ev {
  display: flex; align-items: center; gap: 5px; font-size: 11.5px; border-radius: 6px; padding: 3px 6px;
  background: var(--accent-soft); color: var(--ink); white-space: nowrap; overflow: hidden; cursor: pointer;
}
.ev .t { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ev .tx { overflow: hidden; text-overflow: ellipsis; }
.ev.done { background: var(--green-soft); }
.ev.simulated { background: var(--purple-soft); }
.ev.failed, .ev.partial { background: var(--red-soft); }
.ev.draft { background: var(--surface-3); }
.ev .dots { display: inline-flex; gap: 2px; }
.ev .dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }

/* ---------- accounts / settings ---------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.prov-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.prov-head .glyphs { display: flex; gap: 4px; }
.acc-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.acc-item + .acc-item { border-top: 1px solid var(--line); }
.acc-item b { font-weight: 500; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.group-title { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.02em; margin: 26px 4px 8px; }
.group-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; }
.group-row + .group-row { border-top: 1px solid var(--line); }
.group-row .lbl { flex: 1; min-width: 0; }
.group-row .lbl b { font-weight: 500; display: block; }
.group-row .lbl small { color: var(--ink-2); font-size: 12px; display: block; margin-top: 2px; }
.group-row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.copy { display: flex; gap: 6px; }
.copy input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; background: var(--surface-2); }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* ---------- modal + toast ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, 0.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.15s; }
.modal-box { background: var(--surface); border-radius: 20px; padding: 22px; width: min(780px, 100%); max-height: 86vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } }
#toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 40; align-items: center; }
.toast {
  background: rgba(29, 29, 31, 0.92); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 500; max-width: 90vw;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(20px); animation: pop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.err { background: var(--red); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% 0%, rgba(10, 132, 255, 0.12), transparent), radial-gradient(900px 500px at 100% 100%, rgba(191, 90, 242, 0.12), transparent), var(--bg); }
.login-card { width: min(360px, 100%); text-align: center; padding: 32px 28px; }
.login-card .logo { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; margin: 0 auto 14px; }
.login-card h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.025em; }
.login-card form { text-align: left; margin-top: 20px; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .side { position: fixed; inset: auto 0 0 0; width: auto; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .brand, .create-btn, .side-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10px; padding: 4px 6px; }
  .nav .count { display: none; }
  main { margin-left: 0; padding-bottom: 70px; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 20px; }
  #view { padding: 4px 16px 80px; }
  .acc-panel, .preview-col { position: static; max-height: none; }
  .acc-list { max-height: 300px; }
  .cal .day { min-height: 70px; padding: 3px; }
  .ev .tx, .ev .t { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .action-bar { bottom: 80px; }
  .post-thumb.none { display: none; }
}
