:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --panel-2: #faf9f6;
  --ink: #16151a;
  --ink-2: #4b4954;
  --muted: #8a8793;
  --line: #e6e2da;
  --line-2: #efece6;
  --side: #121116;
  --side-ink: #c9c6cf;
  --accent: #ff5a1f;
  --accent-ink: #ffffff;
  --accent-soft: #fff0e9;
  --ok: #1d8a52;
  --ok-soft: #e4f4ea;
  --warn: #b7791f;
  --warn-soft: #fbf1dc;
  --bad: #c8352b;
  --bad-soft: #fbe6e3;
  --info: #2f5fd0;
  --info-soft: #e7eefc;
  --violet: #6b46c1;
  --violet-soft: #efe9fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 18, 30, .05), 0 4px 16px rgba(20, 18, 30, .05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e12;
    --panel: #18171c;
    --panel-2: #1d1c22;
    --ink: #f1eff5;
    --ink-2: #c3c0cb;
    --muted: #8b8894;
    --line: #2b2a31;
    --line-2: #232228;
    --side: #0a090c;
    --accent-soft: #3a1d12;
    --ok-soft: #12301f;
    --warn-soft: #33270f;
    --bad-soft: #3a1714;
    --info-soft: #152341;
    --violet-soft: #251a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
}
a { color: inherit; }
h1, h2, h3 { font-family: 'Space Grotesk', Inter, sans-serif; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: Inter; font-weight: 600; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: #fff; padding: 4px 6px 20px; }
.brand-mark {
  background: var(--accent); color: #fff; font: 700 13px 'Space Grotesk'; border-radius: 9px;
  width: 40px; height: 40px; display: grid; place-items: center; letter-spacing: .04em;
}
.brand-text { font: 600 13px/1.25 'Space Grotesk'; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  text-decoration: none; font-weight: 500;
}
.sidebar nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: .75; }
.sidebar nav a:hover { background: #1f1d25; color: #fff; }
.sidebar nav a.active { background: #26232d; color: #fff; }
.sidebar nav a.active svg { fill: var(--accent); opacity: 1; }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; }
.nav-badge:empty { display: none; }
.new-lead { margin-top: 18px; justify-content: center; }
.sidebar-foot { margin-top: 10px; font: 600 11px 'Space Grotesk'; letter-spacing: .2em; color: #5c5966; padding: 6px; }

/* ---------- Layout ---------- */
.view { flex: 1; min-width: 0; padding: 28px 32px 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; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); gap: 10px; }
.grid { display: grid; gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); padding: 8px 14px; border-radius: 9px; font: 600 13px Inter; cursor: pointer; text-decoration: none;
  white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #ec4a10; border-color: #ec4a10; }
.btn-dark { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-kombajn { background: linear-gradient(135deg, #ff5a1f, #ff8a3d); border: 0; color: #fff; padding: 10px 16px; box-shadow: 0 4px 14px rgba(255, 90, 31, .3); }
.btn-kombajn svg { width: 16px; height: 16px; fill: #fff; }
.btn-kombajn.done { background: var(--ok); box-shadow: none; }

input, select, textarea {
  font: 14px Inter; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; font-size: 13px; cursor: pointer; }
.check input { width: auto; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.st-NA-BIEŻĄCO { background: var(--info-soft); color: var(--info); }
.st-SZANSA { background: var(--accent-soft); color: var(--accent); }
.st-ODPOWIEDŹ-OGÓLNA { background: var(--violet-soft); color: var(--violet); }
.st-ODMOWA, .st-BŁĄD-MAIL { background: var(--bad-soft); color: var(--bad); }
.st-ODMOWA---PRZYPOMNIENIA { background: var(--warn-soft); color: var(--warn); }
.st-BRAK-ZADAŃ { background: var(--line-2); color: var(--muted); }
.opp-ZAKOŃCZONE { background: var(--line-2); color: var(--muted); }
.opp-ZAWIESZONE { background: var(--warn-soft); color: var(--warn); }
.opp-NA-BIEŻĄCO { background: var(--ok-soft); color: var(--ok); }

.ev { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; padding: 2px 7px; border-radius: 5px; }
.ev-WYSŁANA { background: var(--info-soft); color: var(--info); }
.ev-ODPOWIEDŹ { background: var(--ok-soft); color: var(--ok); }
.ev-KALENDARZ { background: var(--warn-soft); color: var(--warn); }
.ev-SZANSA, .ev-KOMBAJN { background: var(--accent-soft); color: var(--accent); }
.ev-ROZMOWA, .ev-CZATY { background: var(--violet-soft); color: var(--violet); }
.ev-ZWROTKA { background: var(--bad-soft); color: var(--bad); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; text-decoration: none; display: block; }
.kpi .v { font: 700 30px/1.1 'Space Grotesk'; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi .s { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.kpi.alert .v { color: var(--bad); }
.kpi.hot { background: var(--side); border-color: var(--side); color: #fff; }
.kpi.hot .v { color: var(--accent); }
a.kpi:hover { border-color: var(--muted); }

.dash { grid-template-columns: 1.4fr 1fr; align-items: start; }
.dash > .grid { align-content: start; }
.bars { display: flex; flex-direction: column; gap: 9px; padding: 16px 18px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; display: flex; }
.bar-fill { height: 100%; background: var(--ink-2); }
.bar-fill.r { background: var(--ok); }
.bar-fill.o { background: var(--accent); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.months { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 16px 18px 6px; }
.month { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.month .cols { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.month .c { width: 40%; max-width: 16px; border-radius: 3px 3px 0 0; background: var(--info); min-height: 2px; }
.month .c.r { background: var(--ok); }
.month span { font-size: 10.5px; color: var(--muted); }

.feed { list-style: none; margin: 0; padding: 4px 0; }
.feed li { padding: 10px 18px; border-top: 1px solid var(--line-2); display: grid; grid-template-columns: 78px 1fr; gap: 10px; }
.feed li:first-child { border-top: 0; }
.feed a { font-weight: 600; text-decoration: none; }
.feed a:hover { color: var(--accent); }
.feed .t { color: var(--ink-2); font-size: 13px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Leads table ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-2); align-items: center; }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { width: auto; min-width: 150px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px 0; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 4px 11px; font: 600 12px Inter; cursor: pointer; color: var(--ink-2); }
.chip b { color: var(--muted); font-weight: 600; margin-left: 4px; }
.chip.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.chip.on b { color: inherit; opacity: .7; }

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; background: var(--panel-2); position: sticky; top: 0; }
.tbl th.sorted { color: var(--ink); }
.tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr.lead-row { cursor: pointer; }
.tbl tr.lead-row:hover td { background: var(--panel-2); }
.tbl .name { font-weight: 600; }
.tbl .sub { color: var(--muted); font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .last { max-width: 240px; color: var(--ink-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-over { color: var(--bad); font-weight: 700; }
.due-today { color: var(--accent); font-weight: 700; }
.due-soon { color: var(--warn); font-weight: 600; }
.yes { color: var(--ok); font-weight: 800; }
.dup { color: var(--warn); font-size: 11px; font-weight: 700; }
.tbl-foot { padding: 10px 16px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.k-icon { display: inline-block; font-size: 10px; font-weight: 800; color: var(--ok); border: 1px solid var(--ok); border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }

/* ---------- Lead detail ---------- */
.lead-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 20px; }
.lead-head .crumb { font-size: 12px; color: var(--muted); text-decoration: none; }
.lead-head .crumb:hover { color: var(--accent); }
.lead-head h1 { margin: 6px 0 8px; font-size: 28px; }
.lead-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.side-stack { display: flex; flex-direction: column; gap: 16px; }
.side-stack .panel + .panel { margin-top: 0; }

.composer { padding: 16px 18px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.type-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.type-pick button { border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 5px 10px; font: 600 12px Inter; cursor: pointer; color: var(--ink-2); }
.type-pick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.composer-foot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.composer-foot input[type=date] { width: 150px; }
.composer-foot select { width: auto; }
.quick-days { display: inline-flex; gap: 4px; }
.quick-days button { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 4px 8px; font: 600 11.5px Inter; cursor: pointer; color: var(--ink-2); }
.quick-days button.on { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }

.timeline { padding: 6px 18px 18px; }
.tl-day { display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding-top: 16px; }
.tl-date { font: 600 13px 'Space Grotesk'; color: var(--ink-2); padding-top: 2px; }
.tl-date small { display: block; font: 500 11px Inter; color: var(--muted); }
.tl-items { border-left: 2px solid var(--line); padding-left: 16px; display: flex; flex-direction: column; gap: 10px; }
.tl-item { position: relative; }
.tl-item::before { content: ''; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line); }
.tl-item.t-ODPOWIEDŹ::before { border-color: var(--ok); background: var(--ok); }
.tl-item.t-SZANSA::before, .tl-item.t-KOMBAJN::before { border-color: var(--accent); background: var(--accent); }
.tl-item .txt { white-space: pre-wrap; margin-top: 3px; color: var(--ink); }
.tl-item .tools { position: absolute; right: 0; top: -2px; display: none; gap: 2px; }
.tl-item:hover .tools { display: flex; }
.scope-opp { font-size: 10px; font-weight: 700; color: var(--accent); margin-left: 6px; letter-spacing: .05em; }
.tl-filter { display: flex; gap: 6px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.contact { padding: 10px 0; border-top: 1px solid var(--line-2); }
.contact:first-child { border-top: 0; padding-top: 0; }
.contact .n { font-weight: 600; }
.contact a { color: var(--info); text-decoration: none; display: block; font-size: 13px; word-break: break-all; }
.contact a:hover { text-decoration: underline; }

.next-box { padding: 16px 18px; }
.next-box .when { font: 700 22px 'Space Grotesk'; }
.next-box.over { background: var(--bad-soft); }
.next-box.over .when { color: var(--bad); }

.kombajn-box { padding: 18px; background: var(--side); color: #fff; border-color: var(--side); }
.kombajn-box h2 { color: #fff; display: flex; align-items: center; gap: 8px; }
.kombajn-box p { color: #b3b0bb; font-size: 13px; margin: 6px 0 14px; }
.kombajn-box a.link { color: #ffb08f; font-size: 12px; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); min-height: 300px; display: flex; flex-direction: column; }
.col.drop { outline: 2px dashed var(--accent); }
.col-head { padding: 12px 14px; display: flex; justify-content: space-between; font: 600 12px Inter; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.cards { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; cursor: grab; box-shadow: var(--shadow); text-decoration: none; display: block; }
.card:hover { border-color: var(--accent); }
.card .n { font-weight: 600; }
.card .p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card .m { font-size: 12px; color: var(--ink-2); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .f { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11.5px; }

/* ---------- Modal & toasts ---------- */
.modal { position: fixed; inset: 0; background: rgba(10, 9, 14, .55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border-radius: 14px; width: min(860px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal-box.sm { width: min(480px, 100%); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 18px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }
.section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.contact-edit { display: grid; grid-template-columns: 1fr 1fr 1.4fr 1fr 32px; gap: 8px; margin-bottom: 8px; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--side); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-weight: 500; max-width: 380px; animation: tin .2s ease-out; }
.toast.err { background: var(--bad); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .lead-layout, .dash { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; }
  .brand { padding: 0; }
  .brand-text, .sidebar-foot { display: none; }
  .sidebar nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .sidebar nav a { font-size: 13px; padding: 7px 9px; white-space: nowrap; }
  .new-lead { margin: 0 0 0 auto; }
  .view { padding: 18px 16px 40px; }
  .contact-edit { grid-template-columns: 1fr 1fr; }
  .tl-day { grid-template-columns: 1fr; gap: 6px; }
  .bar-row { grid-template-columns: 90px 1fr 56px; }
}

/* ---------- Zespół, logowanie ---------- */
.avatar { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: var(--ink); color: var(--panel); display: inline-grid; place-items: center; font: 700 10.5px Inter; letter-spacing: .02em; }
.author { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 8px; }
.user-box { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 10px 8px; border-top: 1px solid #26232d; }
.user-box .avatar { background: var(--accent); color: #fff; }
.user-box .ub-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.user-box .ub-text b { color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .ub-text span { font-size: 11px; color: #7d7a86; }
.user-box .btn-ghost { color: #9a97a3; padding: 4px 8px; }
.user-box .btn-ghost:hover { background: #26232d; color: #fff; }
.owner-row { margin-top: 10px; gap: 6px; }
.owner-sel { width: auto; padding: 4px 8px; font-size: 13px; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 7px 14px; font: 600 13px Inter; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--panel); }

.auth { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-items: center; padding: 20px; }
.auth[hidden] { display: none; }
body.auth-mode .sidebar, body.auth-mode .view { display: none; }
.auth-box { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px 30px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.auth-box .brand-mark { width: 48px; height: 48px; }

/* ---------- Maile ---------- */
.mail-toggle { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mail-compose { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--panel-2); }
.mail-compose[hidden] { display: none; }
.mail-compose textarea { min-height: 160px; font-size: 13.5px; }
.mail-tag { font-size: 10px; font-weight: 800; letter-spacing: .05em; color: var(--info); border: 1px solid var(--info); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.mail-view { margin-top: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.mail-view summary { cursor: pointer; padding: 8px 12px; font-size: 13px; list-style: none; }
.mail-view summary::-webkit-details-marker { display: none; }
.mail-view summary::before { content: '✉ '; color: var(--info); }
.mail-view[open] summary { border-bottom: 1px solid var(--line); }
.mail-view .mail-body { white-space: pre-wrap; padding: 12px; font-size: 13.5px; line-height: 1.55; max-height: 420px; overflow: auto; }
.mail-view .row { padding: 0 12px 10px; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.tpl-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.tpl-card + .tpl-card { margin-top: 0; }
.tpl-body { white-space: pre-wrap; font-size: 13px; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; max-height: 220px; overflow: auto; flex: 1; }
code { font-size: 12px; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }
@media (max-width: 760px) { .user-box { display: none; } }
