/* Timbre: dark UI modeled on Otto's dashboard. Tokens first, dark only (the app is always dark, like Otto). */
:root {
  --bg: #212121; --sidebar: #171717; --card: #2f2f2f; --muted-bg: #383838; --hover: #353535;
  --fg: #ececec; --muted: #b4b4b4; --faint: #8a8a8a; --border: #454545; --border-soft: #3a3a3a;
  --brand: #a7e622; --brand-fg: #171717; --danger: #ffb7be; --danger-bg: #48282d;
  --ok: #a7dbb7; --ok-bg: #243a2c; --info: #9ec5ff; --info-bg: #1f2f4a; --warn: #f5d38a; --warn-bg: #45391d;
  --radius: .75rem; --radius-sm: .5rem;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 Inter, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
input, textarea, select, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=datetime-local], input[type=search], textarea, select {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
button, .btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--card);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 13px; white-space: nowrap; }
button:hover, .btn:hover { background: var(--hover); }
.btn-primary { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); font-weight: 500; }
.btn-primary:hover { background: #b8f23a; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
button:disabled { opacity: .6; cursor: wait; }

/* Shell */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex: none; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 12px 8px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; padding: 2px 6px 12px; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); color: var(--brand-fg); display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.new-post { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; margin-bottom: 12px; }
.new-post:hover { background: var(--hover); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--fg); margin-bottom: 2px; }
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--brand); color: var(--brand-fg); }
.nav svg, .new-post svg { width: 16px; height: 16px; flex: none; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border-soft); padding: 10px 6px 0; display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #3b5bdb, #0b1b5a); flex: none; }
.sidebar-foot form { margin-left: auto; }
.content { flex: 1; min-width: 0; }
.page { padding: 20px 28px 40px; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.flash { background: var(--ok-bg); color: var(--ok); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; }
.flash.error { background: var(--danger-bg); color: var(--danger); }
.banner { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }

/* Badges */
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--muted-bg); color: var(--muted); }
.badge.scheduled { background: var(--info-bg); color: var(--info); }
.badge.published { background: var(--ok-bg); color: var(--ok); }
.badge.failed { background: var(--danger-bg); color: var(--danger); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--danger-bg); color: var(--danger); }
.net { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }

/* Drafts: list + editor split */
.split { display: flex; min-height: 100vh; }
.list-col { width: 340px; flex: none; border-right: 1px solid var(--border); padding: 12px; overflow-y: auto; height: 100vh; position: sticky; top: 0; }
.list-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.list-head h2 { margin: 0; }
.list-head select { width: auto; padding: 3px 8px; font-size: 12px; border-radius: 999px; }
.day-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin: 14px 2px 6px; }
.post-card { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
.post-card:hover, .post-card.selected { border-color: #6b6b6b; background: #262626; }
.post-card .meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.post-card .title { font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.card-actions form { display: flex; gap: 6px; }
.card-actions input[type=datetime-local] { width: 170px; padding: 3px 8px; font-size: 12px; border-radius: 999px; }
.editor-col { flex: 1; min-width: 0; display: flex; justify-content: center; padding: 16px 24px 40px; }
.editor { width: 100%; max-width: 620px; }
.editor-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--info); }
.tabs { display: inline-flex; background: var(--card); border: 1px solid var(--border-soft); border-radius: 12px; padding: 3px; margin: 12px auto; }
.tabs button { border: 0; background: transparent; border-radius: 9px; padding: 4px 12px; color: var(--muted); }
.tabs button.on { background: var(--muted-bg); color: var(--fg); }
.tab-pane { display: none; } .tab-pane.on { display: block; }
.tweet { display: flex; gap: 10px; padding: 8px 0; }
.tweet .who { font-size: 13px; } .tweet .who b { font-weight: 600; } .tweet .who span { color: var(--muted); }
.tweet .body { white-space: pre-wrap; word-break: break-word; }
.tweet textarea { background: transparent; border: 0; padding: 0; min-height: 90px; }
.tweet textarea:focus { outline: none; }
.item-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border-soft); padding-bottom: 6px; }
.count.over { color: var(--danger); }
.action-bar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; background: var(--sidebar); border: 1px solid var(--border-soft);
  border-radius: 0 0 var(--radius) var(--radius); padding: 10px 12px; margin-top: 16px; flex-wrap: wrap; }
.action-bar input[type=datetime-local] { width: 190px; border-radius: 999px; padding: 5px 10px; }
.review-box { background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.limit { display: flex; justify-content: space-between; background: var(--muted-bg); border-radius: 8px; padding: 5px 10px; margin-top: 6px; font-size: 13px; }
.report { white-space: pre-wrap; font-size: 13px; color: var(--fg); }
.empty { display: grid; place-items: center; text-align: center; color: var(--muted); min-height: 60vh; }
.empty h2 { color: var(--fg); margin-top: 8px; }

/* Calendar */
.cal { display: grid; grid-template-columns: 200px repeat(var(--days), minmax(150px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; }
.cal-col h2 { margin: 0; font-size: 14px; } .cal-col .sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.cal-item { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 7px 9px; margin-bottom: 8px; font-size: 12px; }
.cal-item:hover { border-color: #6b6b6b; }
.cal-item .t { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 2px; }
.cal-item .t span::before { content: "• "; color: var(--muted); }
.cal-item .x { color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.free { border: 1px dashed var(--border); border-radius: 10px; padding: 18px; text-align: center; color: var(--faint); font-size: 12px; }
.queue-count { font-size: 40px; font-weight: 600; text-align: center; color: var(--muted); }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--border-soft); border-radius: 999px; padding: 2px; }
.seg a { padding: 3px 10px; border-radius: 999px; font-size: 12px; color: var(--muted); }
.seg a.on { background: var(--muted-bg); color: var(--fg); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month .cell { background: var(--card); border: 1px solid var(--border-soft); border-radius: 8px; min-height: 96px; padding: 6px; font-size: 11px; }
.month .cell.out { opacity: .45; } .month .cell .d { color: var(--muted); margin-bottom: 4px; }
.month .cell a { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-bottom: 2px; }

/* Insights */
.stat { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.delta { color: var(--brand); font-size: 12px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 11px; height: 11px; border-radius: 2px; background: var(--muted-bg); display: block; }
.heat i.l1 { background: #3d5212; } .heat i.l2 { background: #5c7d18; } .heat i.l3 { background: #82b01f; } .heat i.l4 { background: var(--brand); }
.chart svg { width: 100%; height: 260px; display: block; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--border); }
td { padding: 7px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Voice guide */
.md h1 { font-size: 18px; margin: 18px 0 8px; } .md h2 { font-size: 16px; margin: 18px 0 6px; } .md h3 { font-size: 14px; }
.md ul { margin: 4px 0 10px; padding-left: 20px; } .md li { margin: 2px 0; }
.md p { margin: 6px 0; }
.two { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* Login / OAuth pages */
body.center { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.narrow { width: 100%; max-width: 380px; }
.narrow form button { margin-top: 14px; width: 100%; justify-content: center; }
.narrow .brand { padding-left: 0; }

@media (max-width: 900px) {
  .app, .split { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; } .sidebar-foot, .new-post { display: none; }
  .list-col { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); }
  .page { padding: 16px; } .two, .grid-3 { grid-template-columns: 1fr; }
}
.sidebar-foot svg { width: 16px; height: 16px; }
.tweet textarea { overflow: hidden; }

/* Chat, like Otto's "Nova conversa" */
.chat { max-width: 760px; margin: 0 auto; padding: 16px 20px 24px; min-height: 100vh; display: flex; flex-direction: column; }
.chat-hero { margin: auto 0; text-align: center; padding-bottom: 12vh; }
.chat-hero h1 { font-size: 26px; }
.chat-hero .composer { margin-top: 18px; text-align: left; }
.chat-title { font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.messages { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.msg-user { align-self: flex-end; max-width: 75%; background: var(--card); border: 1px solid var(--border-soft); border-radius: 16px; padding: 9px 14px; white-space: pre-wrap; }
.msg-ai { max-width: 100%; }
.post-block { border-radius: var(--radius); }
.post-preview { background: transparent; border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
.post-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.post-actions input[type=datetime-local] { width: 190px; border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.review-inline summary { cursor: pointer; display: flex; gap: 8px; align-items: center; margin-top: 6px; list-style: none; }
.alts summary { cursor: pointer; margin: 4px 0 10px; }
.pub-box { background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 10px 14px; }
.pub-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border-soft); }
.pub-box .pub-row:first-of-type { border-top: 0; }
.tool-line { padding-left: 2px; }
.composer { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 10px 12px; }
.composer textarea { background: transparent; border: 0; padding: 2px; min-height: 44px; resize: none; }
.composer textarea:focus { outline: none; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; }
.composer.sticky { position: sticky; bottom: 12px; box-shadow: 0 -12px 24px var(--bg); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.chip-btn { background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--muted); }
.recent { overflow-y: auto; min-height: 0; flex: 1; }
.recent .search { padding: 5px 10px; font-size: 12px; border-radius: 10px; margin-bottom: 6px; }
.recent-label { font-size: 10px; letter-spacing: .04em; margin: 10px 8px 4px; }
.recent-item { display: block; padding: 6px 8px; border-radius: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item:hover, .recent-item.on { background: var(--hover); color: var(--fg); }
@media (max-width: 900px) { .recent { display: none; } .msg-user { max-width: 90%; } }
.verdicts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; }
.verdicts label { margin: 0; display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: 12px; }
