/* Dramour Desk — the shop's palette: ivory paper, ink type, espresso rail, gold accents. */
:root {
  --ivory: #FAF8F4;
  --paper: #FFFFFF;
  --sand: #F3EDE4;
  --sand-2: #EDE5D8;
  --border: #E7E0D4;
  --ink: #1F1A16;
  --ink-2: #3B332C;
  --stone: #6E655C;
  --espresso: #2A211C;
  --espresso-2: #3A2E27;
  --gold: #C8A868;
  --bronze: #7A5C22;
  --contrast: #D2C09C;
  --wa: #2F8F5B;
  --ig: #A0447A;
  --web: #7A5C22;
  --amber: #B7791F;
  --amber-bg: #FBF1DE;
  --error: #B42318;
  --error-bg: #FDECEA;
  --ok: #2F7A4E;
  --note: #FFF7DD;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 26, 22, .06), 0 4px 16px rgba(31, 26, 22, .06);
  --serif: 'Playfair Display', Georgia, serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --rail: 76px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ivory); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--bronze); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
.muted { color: var(--stone); }
.small { font-size: 12px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── buttons & inputs ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--paper); color: var(--ink); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--contrast); background: var(--sand); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.btn.primary:hover { background: var(--espresso-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sand); }
.btn.small { min-height: 30px; padding: 0 11px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.input, select.input, textarea.input { width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--paper); transition: border-color .15s; }
.input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(200, 168, 104, .18); }
textarea.input { resize: vertical; min-height: 80px; }
label.field { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--stone); font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--sand); color: var(--ink-2); white-space: nowrap; }
.pill.gold { background: #F6EBD3; color: var(--bronze); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.ok { background: #E4F2EA; color: var(--ok); }
.pill.err { background: var(--error-bg); color: var(--error); }
.pill.dark { background: var(--ink); color: var(--ivory); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--stone); }
.dot.on { background: var(--ok); }
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--sand-2); cursor: pointer; transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(17px); }

/* ── shell ── */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; height: 100vh; height: 100dvh; }
.rail { background: var(--espresso); color: var(--contrast); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 4px; }
.rail .logo { width: 40px; height: 40px; border-radius: 11px; margin-bottom: 14px; }
.rail a { position: relative; width: 62px; padding: 9px 0 7px; border-radius: 12px; display: grid; justify-items: center; gap: 3px; color: var(--contrast); text-decoration: none; font-size: 10.5px; font-weight: 500; transition: background .15s, color .15s; }
.rail a svg { width: 21px; height: 21px; }
.rail a:hover { background: var(--espresso-2); color: var(--ivory); }
.rail a.active { background: var(--espresso-2); color: var(--gold); }
.rail a.active::before { content: ''; position: absolute; left: -7px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--gold); }
.rail .badge { position: absolute; top: 4px; right: 9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: var(--ink); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.rail .spacer { flex: 1; }
.rail .me { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--espresso-2); color: var(--gold); font-weight: 600; cursor: pointer; }
.main { min-width: 0; min-height: 0; overflow: auto; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 28px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }

/* ── cards ── */
.card { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 6px 10px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--contrast); transform: translateY(-1px); }
.kpi .label { font-size: 12px; color: var(--stone); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--stone); margin-top: 2px; }
.kpi.alert { border-color: #EBCB8B; background: linear-gradient(180deg, #FFFBF2, var(--paper)); }
.kpi.alert .value { color: var(--bronze); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { font-size: 17px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.dash-grid .stack { display: grid; gap: 14px; align-content: start; }
.list { display: grid; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--border); text-decoration: none; color: inherit; cursor: pointer; border-radius: 8px; }
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--ivory); }
.empty { padding: 26px 10px; text-align: center; color: var(--stone); font-size: 13px; }
.empty svg { width: 28px; height: 28px; color: var(--contrast); display: block; margin: 0 auto 8px; }
.chart { width: 100%; height: 190px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--stone); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.connect { background: var(--sand); border: 1px dashed var(--contrast); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.connect svg { width: 22px; height: 22px; color: var(--bronze); flex: none; }

/* ── avatars & channel marks ── */
.avatar { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--sand-2); color: var(--ink-2); font-weight: 600; font-size: 13px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar .ch { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--paper); color: #fff; }
.avatar .ch svg { width: 10px; height: 10px; }
.ch-whatsapp { background: var(--wa); }
.ch-instagram { background: var(--ig); }
.ch-web { background: var(--web); }
.ch-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.ch-label svg { width: 13px; height: 13px; }
.ch-label.whatsapp { color: var(--wa); }
.ch-label.instagram { color: var(--ig); }
.ch-label.web { color: var(--web); }

/* ── inbox ── */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; height: 100%; }
.inbox.no-panel { grid-template-columns: 340px minmax(0, 1fr); }
.inbox.no-panel .cpanel { display: none; }
.clist { border-right: 1px solid var(--border); background: var(--paper); display: flex; flex-direction: column; min-height: 0; }
.clist-head { padding: 16px 14px 10px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.clist-head h2 { font-size: 20px; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--stone); }
.search .input { padding-left: 34px; background: var(--ivory); border-color: transparent; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--stone); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { background: var(--ivory); color: var(--ink); }
.tab.active { background: var(--ink); color: var(--ivory); }
.tab .n { font-size: 11px; opacity: .75; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--paper); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; color: var(--ink-2); }
.chip svg { width: 12px; height: 12px; }
.chip.active { border-color: var(--ink); background: var(--ink); color: var(--ivory); }
.clist-body { overflow-y: auto; overflow-x: hidden; flex: 1; }
.crow { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; text-decoration: none; color: inherit; position: relative; transition: background .12s; }
.crow:hover { background: var(--ivory); }
.crow.active { background: var(--sand); }
.crow.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); }
.crow .body { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.crow .top { display: flex; align-items: baseline; gap: 8px; }
.crow .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.crow .time { font-size: 11.5px; color: var(--stone); flex: none; font-variant-numeric: tabular-nums; }
.crow .preview { color: var(--stone); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow.unread .name { color: var(--ink); }
.crow.unread .preview { color: var(--ink-2); font-weight: 500; }
.crow .tags { display: flex; gap: 5px; margin-top: 3px; flex-wrap: wrap; }
.unread-n { min-width: 19px; height: 19px; border-radius: 10px; background: var(--gold); color: var(--ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }

.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ivory); }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--paper); min-height: 66px; }
.thread-head .who { flex: 1; min-width: 0; }
.thread-head .who b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-head .actions { display: flex; gap: 8px; align-items: center; }
.botbar { display: flex; align-items: center; gap: 10px; padding: 8px 18px; font-size: 13px; border-bottom: 1px solid var(--border); }
.botbar.bot { background: #F6EFE2; color: var(--bronze); }
.botbar.human { background: #EEF6F1; color: var(--ok); }
.botbar svg { width: 16px; height: 16px; flex: none; }
.botbar .grow { font-weight: 500; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; font-size: 11.5px; color: var(--stone); background: var(--sand); padding: 2px 10px; border-radius: 999px; margin: 10px 0 4px; }
.msg { max-width: min(560px, 78%); display: grid; gap: 3px; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; justify-items: end; }
.bubble { padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(31,26,22,.05); }
.msg.in .bubble { background: var(--paper); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg.out .bubble { background: var(--ink); color: var(--ivory); border-bottom-right-radius: 5px; }
.msg.out.bot .bubble, .msg.out.automation .bubble { background: var(--sand); color: var(--ink); border: 1px solid var(--sand-2); }
.msg.out.failed .bubble { background: var(--error-bg); color: var(--error); border: 1px solid #F3C4BF; }
.msg .meta { font-size: 11px; color: var(--stone); display: flex; gap: 6px; align-items: center; padding: 0 4px; }
.msg .meta svg { width: 14px; height: 14px; }
.msg .meta .read { color: #3B82C4; }
.msg img.media { max-width: 260px; max-height: 320px; border-radius: 12px; display: block; cursor: zoom-in; border: 1px solid var(--border); }
.msg .opts { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; max-width: 420px; }
.msg .opts span { font-size: 12px; border: 1px solid var(--contrast); color: var(--bronze); border-radius: 999px; padding: 2px 9px; background: var(--paper); }
.sys { align-self: center; font-size: 12px; color: var(--stone); display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.sys svg { width: 13px; height: 13px; }
.note { align-self: stretch; max-width: none; }
.note .bubble { background: var(--note); color: var(--ink); border: 1px dashed #E2C985; border-radius: 12px; }
.window { margin: 0 18px 10px; padding: 10px 14px; border-radius: 10px; background: var(--amber-bg); color: #7A4D0B; font-size: 13px; display: grid; gap: 8px; }
.composer { padding: 10px 18px 14px; background: var(--ivory); position: relative; }
.composer-box { background: var(--paper); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); transition: border-color .15s; }
.composer-box:focus-within { border-color: var(--contrast); }
.composer-box.private { background: var(--note); border-color: #E2C985; }
.composer .modes { display: flex; gap: 2px; padding: 6px 8px 0; }
.composer .modes button { border: 0; background: none; font-size: 12.5px; font-weight: 500; color: var(--stone); padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.composer .modes button.active { color: var(--ink); background: var(--sand); }
.composer-box.private .modes button.active { background: #F6E7B8; }
.composer textarea { display: block; width: 100%; border: 0; background: transparent; resize: none; padding: 8px 14px; min-height: 44px; max-height: 200px; outline: none; }
.composer .bar { display: flex; align-items: center; gap: 6px; padding: 4px 8px 8px; }
.composer .attach-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--sand); padding: 3px 4px 3px 10px; border-radius: 999px; font-size: 12px; }
.qr-pop { position: absolute; bottom: calc(100% - 4px); left: 18px; right: 18px; max-height: 260px; overflow: auto; background: var(--paper); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(31,26,22,.15); padding: 6px; z-index: 5; }
.qr-pop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.qr-pop button:hover, .qr-pop button.sel { background: var(--sand); }
.qr-pop b { font-size: 12px; color: var(--bronze); }
.qr-pop span { display: block; color: var(--stone); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cpanel { border-left: 1px solid var(--border); background: var(--paper); overflow-y: auto; padding: 20px 18px 40px; display: grid; gap: 18px; align-content: start; }
.cpanel .who { display: grid; justify-items: center; text-align: center; gap: 8px; }
.cpanel .who h2 { font-size: 18px; }
.cpanel section { display: grid; gap: 8px; }
.cpanel section > h3 { font-family: var(--sans); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--stone); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.kv { display: grid; grid-template-columns: 22px 1fr; gap: 6px 8px; align-items: center; font-size: 13px; }
.kv svg { width: 15px; height: 15px; color: var(--stone); }
.kv .input { min-height: 30px; padding: 4px 8px; border-color: transparent; background: transparent; }
.kv .input:hover { border-color: var(--border); }
.kv .input:focus { border-color: var(--gold); background: var(--paper); }
.tagset { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tagset .pill button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: 13px; line-height: 1; }
.tagset input { border: 1px dashed var(--border); border-radius: 999px; padding: 2px 10px; width: 92px; font-size: 12px; background: transparent; }
.order { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; font-size: 12.5px; }
.order .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13px; }
.mini { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 12.5px; display: grid; gap: 3px; cursor: pointer; text-decoration: none; color: inherit; }
.mini:hover { border-color: var(--contrast); }
.thread-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--stone); padding: 30px; }
.thread-empty img { width: 64px; opacity: .9; margin-bottom: 12px; border-radius: 16px; }

/* ── leads board ── */
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 12px; }
.col { background: var(--sand); border-radius: var(--radius); padding: 10px; min-height: 160px; transition: background .15s; }
.col.over { background: var(--sand-2); outline: 2px dashed var(--contrast); }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; font-weight: 600; font-size: 13px; }
.col-head .n { color: var(--stone); font-weight: 500; }
.lcard { background: var(--paper); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; cursor: grab; display: grid; gap: 6px; box-shadow: 0 1px 2px rgba(31,26,22,.05); transition: box-shadow .15s, transform .15s; }
.lcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.lcard.dragging { opacity: .5; }
.lcard .t { font-weight: 600; font-size: 13.5px; }
.lcard .foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--stone); }

/* ── tables ── */
.table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--stone); font-weight: 600; padding: 10px 14px; background: var(--ivory); border-bottom: 1px solid var(--border); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--ivory); }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }

/* ── settings ── */
.settings { display: grid; gap: 16px; max-width: 860px; }
.settings .card { display: grid; gap: 14px; }
.chan { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.chan:first-of-type { border-top: 0; }
.code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12px; background: var(--ivory); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; word-break: break-all; user-select: all; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: inline-flex; }
.days input { display: none; }
.days span { border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 13px; }
.days input:checked + span { background: var(--ink); color: var(--ivory); border-color: var(--ink); }

/* ── auth ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 0%, #F3EDE4 0%, var(--ivory) 60%); }
.auth .card { width: min(400px, 100%); padding: 32px 28px; display: grid; gap: 16px; }
.auth .brand { display: grid; justify-items: center; gap: 10px; text-align: center; margin-bottom: 6px; }
.auth .brand img { width: 56px; border-radius: 15px; }
.err { color: var(--error); font-size: 13px; min-height: 18px; }

/* ── modal & toast ── */
.modal-back { position: fixed; inset: 0; background: rgba(31, 26, 22, .4); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: var(--paper); border-radius: 16px; width: min(520px, 100%); max-height: 90vh; overflow: auto; padding: 22px; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(31,26,22,.25); animation: rise .18s cubic-bezier(.2,.8,.2,1); }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; }
.lightbox { position: fixed; inset: 0; background: rgba(20, 16, 13, .88); z-index: 60; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 10px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--ivory); padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 70; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--error); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ── phones ── */
@media (max-width: 1180px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox .cpanel { position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 92vw); z-index: 30; box-shadow: -10px 0 40px rgba(31,26,22,.18); }
  .inbox.no-panel .cpanel { display: none; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; }
  .rail .logo, .rail .spacer, .rail .me { display: none; }
  .rail a { width: auto; flex: 1; padding: 7px 0 5px; }
  .rail a.active::before { display: none; }
  .rail a.hide-sm { display: none; }
  .rail .badge { right: calc(50% - 22px); }
  .page { padding: 20px 16px 40px; }
  .inbox, .inbox.no-panel { grid-template-columns: 1fr; }
  .inbox.open .clist { display: none; }
  .inbox:not(.open) .thread { display: none; }
  .thread-head { padding: 10px 12px; }
  .thread-head .actions .hide-sm { display: none; }
  .msgs { padding: 14px 12px 6px; }
  .composer { padding: 8px 10px 10px; }
  .msg { max-width: 86%; }
  .board { grid-template-columns: repeat(5, 78vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .grid2 { grid-template-columns: 1fr; }
  .hide-sm, .table .hide-sm { display: none; }
  h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
