/* Clienora - one stylesheet, no build step, works offline (on-prem). RTL & LTR via logical properties. */
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url("../fonts/plex-arabic-400.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url("../fonts/plex-arabic-600.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url("../fonts/plex-arabic-700.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url("../fonts/plex-latin-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url("../fonts/plex-latin-600.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url("../fonts/plex-latin-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --line: #e3e1d8;
  --text: #1d2321;
  --muted: #6b716d;
  --brand: #0e6b5c;
  --brand-ink: #ffffff;
  --brand-soft: #e2f1ec;
  --accent: #c2410c;
  --ok: #15803d;   --ok-soft: #dcfce7;
  --warn: #a16207; --warn-soft: #fef3c7;
  --bad: #b91c1c;  --bad-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --wa: #128c7e;   --wa-bubble: #d9fdd3; --wa-bg: #efeae2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 2px 8px rgba(20, 30, 25, .04);
  --sidebar: 236px;
  --font: "Plex Arabic", "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121514; --surface: #1a1e1c; --surface-2: #222724; --line: #2e3430; --text: #e8ebe9; --muted: #9aa39e;
    --brand: #34b39b; --brand-ink: #06231d; --brand-soft: #173a33;
    --ok-soft: #12331f; --warn-soft: #3a2e10; --bad-soft: #3b1515; --info-soft: #172544;
    --wa-bubble: #134d37; --wa-bg: #0f1412; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #121514; --surface: #1a1e1c; --surface-2: #222724; --line: #2e3430; --text: #e8ebe9; --muted: #9aa39e;
  --brand: #34b39b; --brand-ink: #06231d; --brand-soft: #173a33;
  --ok-soft: #12331f; --warn-soft: #3a2e10; --bad-soft: #3b1515; --info-soft: #172544;
  --wa-bubble: #134d37; --wa-bg: #0f1412; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; }
h3 { font-size: .98rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
td.num, th.num { display: table-cell; text-align: start; }
[dir="rtl"] td.num { text-align: right; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; }
.brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem 1rem; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: block; }
.nav-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: .8rem .6rem .25rem; }
.nav a { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav .ico { width: 1.3rem; text-align: center; }
.nav .count { margin-inline-start: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; min-width: 1.3rem; text-align: center; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .85rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar .spacer { flex: 1; }
.content { padding: 1.5rem; max-width: 1280px; width: 100%; }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--text); cursor: pointer; }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-inline-start: 0; top: 0; z-index: 20; width: 270px; transform: translateX(-110%); transition: transform .2s; box-shadow: var(--shadow); }
  [dir="rtl"] .sidebar { transform: translateX(110%); }
  .sidebar.open { transform: none !important; }
  .menu-toggle { display: block; }
  .content { padding: 1rem; }
  .topbar { padding: .6rem 1rem; }
}

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }
.card + .card { margin-top: 1rem; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }
.card-head .actions { margin-inline-start: auto; display: flex; gap: .4rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3, .split { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .grid-4 .card { padding: .8rem .85rem; }
  .grid-4 .stat .value { font-size: 1.3rem; }
  .grid-4 .stat .label { font-size: .78rem; }
}

.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .8rem; color: var(--muted); }
.stat a.value { color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa); filter: brightness(1.08); }
.btn-danger { color: var(--bad); border-color: var(--bad-soft); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.inline { display: inline; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }

.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }
.banner { padding: .6rem 1.5rem; font-weight: 600; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.banner a { font-weight: 700; text-decoration: underline; color: inherit; }
.banner-warn { background: var(--warn-soft); color: var(--warn); }
.banner-bad { background: var(--bad-soft); color: var(--bad); }
.banner-info { background: var(--info-soft); color: var(--info); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .6rem .7rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .row-link { font-weight: 600; color: var(--text); }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty .big { font-size: 2.2rem; display: block; margin-bottom: .4rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.field .errors { color: var(--bad); font-size: .85rem; margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel],
input[type=date], input[type=datetime-local], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); vertical-align: middle; }
.checkbox-list ul, ul.checkbox-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.form-actions { display: flex; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }
.search { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.search input { max-width: 320px; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .5rem .9rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); }

.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 1rem; align-items: center; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .7rem; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .t-ico { width: 2rem; height: 2rem; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.timeline .t-body { flex: 1; min-width: 0; }
.timeline .t-meta { font-size: .8rem; color: var(--muted); }
.done-text { text-decoration: line-through; color: var(--muted); }
.overdue { color: var(--bad); font-weight: 600; }

/* ---------- Pipeline bars ---------- */
.bar-row { display: grid; grid-template-columns: 150px 1fr max-content; gap: .6rem; align-items: center; margin: .45rem 0; font-size: .9rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 100px 1fr max-content; } }

/* ---------- Kanban ---------- */
.board { display: flex; gap: .8rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.column { flex: 0 0 272px; background: var(--surface-2); border-radius: var(--radius); padding: .6rem; border: 1px solid var(--line); }
.column-head { display: flex; justify-content: space-between; align-items: baseline; padding: .2rem .3rem .6rem; gap: .5rem; }
.column-head strong { font-size: .92rem; }
.column-head small { font-variant-numeric: tabular-nums; }
.column.won .column-head strong { color: var(--ok); }
.column.lost .column-head strong { color: var(--bad); }
.column-body { min-height: 80px; display: flex; flex-direction: column; gap: .5rem; }
.deal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; cursor: grab; box-shadow: var(--shadow); }
.deal-card:active { cursor: grabbing; }
.deal-card a { color: var(--text); font-weight: 600; }
.deal-card .meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: .3rem; gap: .5rem; }
.sortable-ghost { opacity: .35; }

/* ---------- WhatsApp inbox ---------- */
.inbox { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - 150px); min-height: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.inbox-list { border-inline-end: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.inbox-list .search { padding: .6rem; border-bottom: 1px solid var(--line); }
.inbox-list .search input { max-width: none; }
.conv { display: flex; gap: .6rem; padding: .7rem .8rem; border-bottom: 1px solid var(--line); color: var(--text); }
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.active { background: var(--brand-soft); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.conv .c-main { flex: 1; min-width: 0; }
.conv .c-top { display: flex; justify-content: space-between; gap: .4rem; }
.conv .c-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .c-sub { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot { background: var(--wa); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .4rem; font-weight: 700; }
.chat { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat-head .actions { margin-inline-start: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.chat-body { flex: 1; overflow-y: auto; padding: 1rem; background: var(--wa-bg); display: flex; flex-direction: column; gap: .4rem; }
.bubble { max-width: min(75%, 520px); padding: .45rem .7rem .3rem; border-radius: 10px; background: var(--surface); box-shadow: 0 1px 1px rgba(0,0,0,.06); overflow-wrap: anywhere; }
.bubble .b-text { white-space: pre-wrap; }
.bubble.in { align-self: flex-start; border-start-start-radius: 2px; }
.bubble.out { align-self: flex-end; background: var(--wa-bubble); border-start-end-radius: 2px; }
.bubble .b-meta { font-size: .72rem; color: var(--muted); text-align: end; margin-top: .15rem; }
.bubble .b-options { display: flex; flex-direction: column; gap: .3rem; margin-top: .4rem; }
.bubble .b-options span, .bubble .b-options button { display: block; text-align: center; padding: .35rem; border-top: 1px solid var(--line); color: var(--wa); font-weight: 600; background: none; border-inline: 0; border-bottom: 0; font: inherit; cursor: default; }
.bubble .b-options button { cursor: pointer; }
.bubble.failed { outline: 1px solid var(--bad); }
.chat-foot { border-top: 1px solid var(--line); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.chat-foot form.send { display: flex; gap: .5rem; align-items: flex-end; }
.chat-foot textarea { resize: none; min-height: 44px; max-height: 160px; }
.quick { display: flex; gap: .3rem; flex-wrap: wrap; }
.quick button { font-size: .8rem; }
.day-sep { align-self: center; font-size: .75rem; background: var(--surface); color: var(--muted); padding: .1rem .6rem; border-radius: 999px; }
@media (max-width: 800px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox.has-current .inbox-list { display: none; }
  .inbox:not(.has-current) .chat { display: none; }
  .chat-body { min-height: 55vh; max-height: 65vh; }
}

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; font-size: 1.3rem; padding-bottom: 1.2rem; }
.lang-switch { display: flex; gap: .5rem; justify-content: center; margin-top: 1rem; font-size: .9rem; }

/* ---------- Print (receipts) ---------- */
@media print {
  .sidebar, .topbar, .no-print, .banner { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; color: #000; }
}

/* ---------- Drawn icons ---------- */
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; display: inline-block; }
.btn .i { width: 1.1em; height: 1.1em; }
.nav .ico { display: inline-flex; color: var(--muted); }
.nav a.active .ico, .nav a:hover .ico { color: var(--brand); }
.nav .ico .i { width: 1.2rem; height: 1.2rem; }
.page-head h1 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.page-head h1 > .i { color: var(--brand); width: 1.15em; height: 1.15em; }
.card-head h2, h2 { display: flex; align-items: center; gap: .45rem; }
h2 > .i, .card-head h2 > .i { color: var(--brand); }
.stat .label { display: flex; align-items: center; gap: .35rem; }
.stat .label .i { color: var(--brand); }
.empty .big .i, .empty .big { width: 2.6rem; height: 2.6rem; color: var(--muted); display: inline-block; }
.empty .big .i { stroke-width: 1.4; }
.timeline .t-ico .i { width: 1.05rem; height: 1.05rem; color: var(--brand); }
.banner .i { width: 1.2em; height: 1.2em; }
.read .i { color: #34b7f1; }
.b-meta .i { width: .95em; height: .95em; }
.svc-inline { display: inline-flex; align-items: center; gap: .35rem; }
.svc-inline .svc-icon { width: 1.15em; height: 1.15em; color: var(--brand); }
.svc-thumb { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.svc-thumb .svc-icon { width: 26px; height: 26px; }
img.svc-icon { object-fit: contain; border-radius: 6px; }
svg.svc-icon { color: inherit; }

/* ---------- Icon picker ---------- */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: .45rem; max-height: 330px; overflow-y: auto; padding: 2px; }
.icon-option { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; padding: 10px; }
.icon-option:hover { border-color: var(--brand); color: var(--brand); }
.icon-option.selected { border: 2px solid var(--brand); background: var(--brand-soft); color: var(--brand); }
.icon-option .i, .icon-option img { width: 28px; height: 28px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 2rem 1rem; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; text-align: center; }
.dropzone:hover { border-color: var(--brand); }
.dropzone .big { width: 2.6rem; height: 2.6rem; color: var(--brand); }
.small { font-size: .85rem; }
.preview-card { position: sticky; top: 80px; }
.phone { background: var(--surface-2); border-radius: 22px; padding: 1.2rem; display: grid; place-items: center; }
.tile-preview { width: 170px; min-height: 160px; background: var(--surface); border: 2px solid var(--line); border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1rem .6rem; text-align: center; }
.tile-preview .icon { width: 64px; height: 64px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.tile-preview .svc-icon { width: 38px; height: 38px; }
.tile-preview img.svc-icon.svc-img { width: 64px; height: 64px; border-radius: 18px; object-fit: cover; }
.tile-preview strong { font-size: 1.05rem; }
.tile-preview small { color: var(--muted); }

/* ---------- Phone layout: app-style bottom tabs (also inside the iOS/Android apps) ---------- */
.tabbar { display: none; }
@media (max-width: 900px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { padding-top: calc(.6rem + env(safe-area-inset-top)); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset-inline: 0; bottom: 0; z-index: 15;
            background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
            height: 60px; color: var(--muted); font: inherit; font-size: .72rem; background: none; border: 0; cursor: pointer; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--brand); font-weight: 600; }
  .tabbar .i { width: 1.5rem; height: 1.5rem; }
  .tabbar .dot { position: absolute; top: 6px; inset-inline-start: calc(50% + 6px); background: var(--accent); color: #fff; border-radius: 999px;
            font-size: .65rem; min-width: 1.1rem; padding: 0 .3rem; line-height: 1.1rem; text-align: center; }
  .inbox { height: calc(100vh - 200px); }
  .sidebar { padding-top: calc(1rem + env(safe-area-inset-top)); padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) { .hide-sm { display: none !important; } .table th, .table td { padding: .55rem .5rem; } }
