/* Paleta de marca Zuxon: grafito #18232c, acero #263747, cobre #b87345, marfil #f1e9da, papel #f8f4ec, plata #c5cdd2 */
:root {
  --bg: #f8f4ec;
  --surface: #fffdf9;
  --surface-2: #f1e9da;
  --border: #e4dac8;
  --text: #18232c;
  --muted: #6c7881;
  --brand: #b87345;
  --brand-strong: #a3643a;
  --brand-soft: #f6e6d6;
  --brand-grad: linear-gradient(135deg, #d2925c 0%, #b87345 100%);
  --steel: #263747;
  --ok: #2f8a63;
  --ok-soft: #e1f1e8;
  --warn: #a8761c;
  --warn-soft: #f8edd3;
  --bad: #b5443a;
  --bad-soft: #f9e5e2;
  --side-bg: #18232c;
  --side-text: #f1e9da;
  --side-muted: #9aa7b0;
  --side-hover: rgba(241, 233, 218, .07);
  --side-line: rgba(241, 233, 218, .1);
  --shadow: 0 1px 2px rgba(24, 35, 44, .05), 0 6px 20px rgba(24, 35, 44, .06);
  --radius: 12px;
  --side: 236px;
  --display: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111920; --surface: #18232c; --surface-2: #203039; --border: #2b3b48; --text: #f1e9da; --muted: #9aa7b0;
    --brand: #d2925c; --brand-strong: #e3b48f; --brand-soft: #3a2b20; --steel: #c5cdd2;
    --ok: #6fcf97; --ok-soft: #173329; --warn: #e3b45c; --warn-soft: #362b16; --bad: #e57a6f; --bad-soft: #3b1f1c;
    --side-bg: #0d141a; --side-line: rgba(241, 233, 218, .08);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111920; --surface: #18232c; --surface-2: #203039; --border: #2b3b48; --text: #f1e9da; --muted: #9aa7b0;
  --brand: #d2925c; --brand-strong: #e3b48f; --brand-soft: #3a2b20; --steel: #c5cdd2;
  --ok: #6fcf97; --ok-soft: #173329; --warn: #e3b45c; --warn-soft: #362b16; --bad: #e57a6f; --bad-soft: #3b1f1c;
  --side-bg: #0d141a; --side-line: rgba(241, 233, 218, .08);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-family: var(--display); letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; }
.brand-iso { width: 34px; height: auto; flex: none; display: block; }
.brand-name { height: 15px; width: auto; display: block; }
.brand-word { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--brand); }
.brand small { display: block; font-weight: 500; color: var(--side-muted); font-size: 11px; margin-top: 4px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; position: relative;
  color: var(--side-muted); font-weight: 520; text-decoration: none;
}
.nav a:hover { background: var(--side-hover); color: var(--side-text); text-decoration: none; }
.nav a.active { background: rgba(210, 146, 92, .14); color: #e3b48f; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-grad); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; }
.side .icon-btn { color: var(--side-muted); }
.side .icon-btn:hover { background: var(--side-hover); color: var(--side-text); }
.side .small.muted { color: var(--side-muted); }
.side-foot { margin-top: auto; border-top: 1px solid var(--side-line); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.icon-btn.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; padding-left: 34px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; max-height: 60vh; overflow: auto; z-index: 40;
}
.search-results .group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 8px 4px; }
.search-results a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--text); text-decoration: none; }
.search-results a:hover, .search-results a.focus { background: var(--surface-2); }
.page { padding: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .spacer { flex: 1; }

/* ---------- controls ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 80px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 560; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand-grad); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(184,115,69,.25); }
.btn.primary:hover { background: var(--brand-strong); }
:root[data-theme="dark"] .btn.primary { color: #18232c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #18232c; } }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 540; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 540; }
.kpi .value { font-size: 24px; font-weight: 680; margin-top: 4px; letter-spacing: -.01em; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.two { grid-template-columns: 2fr 1fr; }
.half { grid-template-columns: 1fr 1fr; }
.detail { grid-template-columns: 340px 1fr; align-items: start; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 580; background: var(--surface-2); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- badges / avatars ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.lead { background: var(--brand-soft); color: var(--brand); }
.badge.prospecto { background: var(--warn-soft); color: var(--warn); }
.badge.cliente, .badge.won { background: var(--ok-soft); color: var(--ok); }
.badge.inactivo { background: var(--surface-2); color: var(--muted); }
.badge.lost, .badge.red { background: var(--bad-soft); color: var(--bad); }
.badge.open { background: var(--brand-soft); color: var(--brand); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--brand);
}
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.tag { display: inline-block; padding: 1px 7px; border: 1px solid var(--border); border-radius: 6px; font-size: 11.5px; margin: 0 4px 4px 0; color: var(--muted); }

/* ---------- kanban ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 280px; background: var(--surface-2); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.col-head { padding: 12px 14px 8px; }
.col-head .row { display: flex; justify-content: space-between; align-items: center; }
.col-head .meta { font-size: 12px; color: var(--muted); }
.col-bar { height: 3px; border-radius: 3px; background: var(--border); margin-top: 8px; overflow: hidden; }
.col-bar span { display: block; height: 100%; background: var(--brand-grad); }
.col-body { padding: 4px 10px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col.drop .col-body { outline: 2px dashed var(--brand); outline-offset: -4px; border-radius: 8px; }
.deal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.deal-card:hover { border-color: var(--brand); }
.deal-card.dragging { opacity: .5; }
.deal-card .t { font-weight: 580; margin-bottom: 2px; }
.deal-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.deal-card .v { font-weight: 650; }

/* ---------- charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding: 10px 4px 0; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars .b .fill { width: 100%; max-width: 46px; background: var(--brand-grad); border-radius: 6px 6px 2px 2px; min-height: 2px; transition: height .4s; }
.bars .b .fill.cur { background: var(--steel); }
.bars .b .lbl { font-size: 11.5px; color: var(--muted); }
.bars .b .val { font-size: 11.5px; font-weight: 600; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.hbar .track { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: var(--brand-grad); border-radius: 6px; }

/* ---------- detail / timeline ---------- */
.props { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13.5px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.tl-item:last-child { border-bottom: 0; }
.tl-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.tl-icon svg { width: 15px; height: 15px; }
.tl-item.done .tl-title { color: var(--muted); }
.tl-item.done.task .tl-title { text-decoration: line-through; }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-weight: 560; overflow-wrap: anywhere; }
.tl-notes { white-space: pre-wrap; margin-top: 4px; color: var(--muted); font-size: 13px; }
.composer { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.composer .row { display: flex; gap: 8px; flex-wrap: wrap; }
.composer .row > * { flex: 1; min-width: 140px; }
.check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; display: grid; place-items: center; flex: none; padding: 0; }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.check svg { width: 12px; height: 12px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row .body { flex: 1; min-width: 0; }
.task-row .body .t { font-weight: 560; }
.task-row.done .t { text-decoration: line-through; color: var(--muted); }
.overdue { color: var(--bad); font-weight: 600; }
.today { color: var(--warn); font-weight: 600; }

/* ---------- modal / toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 12, 20, .45); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-head { padding: 18px 20px 6px; display: flex; align-items: center; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 12px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 560; color: var(--muted); }
.field .req { color: var(--bad); }
.error-msg { color: var(--bad); font-size: 13px; margin-top: 8px; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--side-bg); color: var(--side-text); border-left: 3px solid var(--brand); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); animation: up .2s; max-width: 360px; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(700px 420px at 50% 20%, var(--brand-soft), transparent), var(--bg); }
.auth-logo { display: block; margin: 0 auto 6px; width: 150px; height: auto; }
.auth .card { width: 100%; max-width: 420px; padding: 28px; }

.auth form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.auth .btn { justify-content: center; padding: 10px; }

.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.stage-row { display: grid; grid-template-columns: 28px 1fr 110px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.drag-handle { cursor: grab; color: var(--muted); text-align: center; user-select: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .two, .half, .detail { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .topbar .new-label { display: none; }
  .page { padding: 16px; }
  .form { grid-template-columns: 1fr; }
  .col { flex-basis: 250px; }
  th, td { padding: 9px 10px; }
  .hide-sm { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 19px; }
}

/* ---------- logos según tema ---------- */
.only-dark { display: none !important; }
:root[data-theme="dark"] .only-light { display: none !important; }
:root[data-theme="dark"] .only-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-light { display: none !important; }
  :root:not([data-theme="light"]) .only-dark { display: block !important; }
}

/* ---------- leads e integraciones ---------- */
.badge.temp-caliente { background: var(--bad-soft); color: var(--bad); }
.badge.temp-templado { background: var(--warn-soft); color: var(--warn); }
.badge.temp-frio { background: var(--surface-2); color: var(--muted); }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; margin: 8px 0; max-height: 50vh; }
.inline-code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
details { margin-top: 10px; }
details summary { cursor: pointer; font-weight: 560; color: var(--brand); }

/* ---------- avisos ---------- */
.notif { position: relative; }
.notif-btn { position: relative; width: 38px; height: 38px; }
.notif-count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; border: 2px solid var(--surface); }
.notif-count[hidden] { display: none; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(24,35,44,.18); z-index: 45; display: flex; flex-direction: column; max-height: min(560px, 75vh); }
.notif-head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-head .spacer { flex: 1; }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; position: relative; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.unread { background: var(--brand-soft); }
.notif-item.unread::after { content: ""; position: absolute; right: 12px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.notif-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.notif-ico svg { width: 15px; height: 15px; }
.notif-ico.type-lead_caliente { background: var(--bad-soft); color: var(--bad); }
.notif-ico.type-lead_nuevo { background: var(--brand-soft); color: var(--brand); }
.notif-ico.type-cita { background: var(--ok-soft); color: var(--ok); }
.notif-text { display: flex; flex-direction: column; min-width: 0; padding-right: 14px; }
.notif-title { font-weight: 600; font-size: 13.5px; }
.notif-item:not(.unread) .notif-title { font-weight: 520; }
.notif-body { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-time { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.notif-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@media (max-width: 760px) { .notif-panel { position: fixed; right: 16px; left: 16px; top: 60px; width: auto; } }

/* ---------------------------------------------------------------- correos */
.notice { display: flex; gap: 12px; align-items: center; background: var(--brand-soft); border-color: transparent; }
.notice svg { width: 20px; height: 20px; color: var(--brand); flex: none; }
.bad-text { color: var(--bad); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.mail-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: var(--surface-2); text-decoration: none; }
.mail-row * { text-decoration: none; }
.mail-row .body { flex: 1; min-width: 0; }
.mail-row .t { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mail-row .s { margin: 2px 0; }
.mail-body { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 8px; padding: 14px 16px; line-height: 1.55; }
.rule-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.rule-row:last-child { border-bottom: 0; }
.rule-row .body { flex: 1; min-width: 0; }
.rule-row .t { font-weight: 600; margin-bottom: 8px; }
.rule-ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rule-ctl select { max-width: 100%; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch > span { position: absolute; inset: 0; background: var(--border); border-radius: 22px; transition: .15s; cursor: pointer; }
.switch > span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { opacity: .5; cursor: default; }
.switch-line { display: inline-flex; gap: 10px; align-items: center; font-weight: 560; cursor: pointer; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; cursor: pointer; }
.chip:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.filters .spacer { flex: 1; }
.mail-detail { grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 900px) { .mail-detail { grid-template-columns: 1fr; } }
