/* Partner Finder – Maslen AT look (maslen.at: red #e30613, ink #1b252f, Roboto / Roboto Slab)

   Colour rules – one system, no ad-hoc shades:
     neutral   surfaces in steps (s1 subtle, s2 hover, s3 pressed) + two line strengths
     accent    Maslen red marks what is ACTIVE: selected option, checked box, switch on, focused field,
               sorted column, selected row, current tab, primary button. Nothing else is red.
     hover     always the same neutral s2 – never a colour
     status    green / amber only for the meaning of a status (contacted, interested, partner) and favourites
   Type scale: title (slab 20) > section (slab 15-16) > group (13/600) > body (14) > label/meta (12)          */
:root {
  --bg: #f0f2f4; --card: #ffffff; --input-bg: #ffffff;
  --text: #1b252f; --text-2: #46505a; --muted: #6a737c;
  --s1: #f7f8f9; --s2: #eff1f3; --s3: #e4e7eb; --line: #e2e5e9; --line-strong: #cdd2d8;
  --hover: var(--s2);
  --acc: #e30613; --acc-dark: #b9050f; --acc-text: #b4050f; --acc-tint: #fdeced; --acc-tint-2: #fff5f6;
  --acc-ring: rgba(227,6,19,.16); --acc-border: #e8545c;
  --brand: var(--acc); --brand-dark: var(--acc-dark); --accent: var(--acc-text);
  --link: var(--text); --link-line: #b9c0c7;
  --ok: #1e7e45; --warn: #a96500;
  --badge-bg: var(--s2); --badge-fg: #39434d; --badge-prio-bg: var(--acc-tint); --badge-prio-fg: var(--acc-text);
  --badge-warn-bg: #fdf3e2; --badge-ok-bg: #e5f4eb; --badge-off-fg: #7a828a;
  --notice-bg: #fff8e6; --notice-line: #f3dc9b; --notice-ok-bg: #e9f6ee; --notice-ok-line: #b9e0c7; --notice-err-bg: #fdecee; --notice-err-line: #f4b9be;
  --log-bg: #131a21; --log-fg: #d4e2ef; --toast-bg: #1b252f; --toast-fg: #ffffff; --star: #c9ced4; --star-on: #f0a20f;
  --topbar-bg: #1b252f; --topbar-fg: #ffffff; --topbar-muted: #a9b3bd; --topbar-line: rgba(255,255,255,.16); --topbar-hover: rgba(255,255,255,.09);
  --knob: #ffffff; --elev: #ffffff; --scrim: rgba(12,17,22,.36);
  --radius: 8px; --shadow: 0 1px 2px rgba(27,37,47,.05), 0 1px 3px rgba(27,37,47,.05);
  --pop-shadow: 0 12px 32px rgba(17,23,29,.16); --modal-shadow: 0 24px 64px rgba(17,23,29,.28);
  --font: "Roboto", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-head: "Roboto Slab", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #11171d; --card: #182029; --input-bg: #141b23;
  --text: #e7ebef; --text-2: #bcc5ce; --muted: #8f9aa5;
  --s1: #1c242e; --s2: #232c37; --s3: #2d3845; --line: #27313c; --line-strong: #3a4652;
  --acc: #ff4d55; --acc-dark: #e0333b; --acc-text: #ff8a90; --acc-tint: #3a1b21; --acc-tint-2: #261b22;
  --acc-ring: rgba(255,77,85,.22); --acc-border: #d9464e;
  --brand: #e30613; --brand-dark: #c1050f;
  --link-line: #55616d;
  --ok: #4cc77f; --warn: #f0a63a;
  --badge-fg: #c6cfd8; --badge-warn-bg: #3b2a10; --badge-ok-bg: #133222; --badge-off-fg: #87929d;
  --notice-bg: #3a2f10; --notice-line: #6b5518; --notice-ok-bg: #143321; --notice-ok-line: #1f5a36; --notice-err-bg: #3d1a1e; --notice-err-line: #6b2b31;
  --log-bg: #0b1015; --log-fg: #cfe0f0; --toast-bg: #e7ebef; --toast-fg: #11171d; --star: #3d4955; --star-on: #f0a20f;
  --topbar-bg: #0c1116; --topbar-line: rgba(255,255,255,.12);
  --elev: #1d2731; --scrim: rgba(0,0,0,.52);
  --shadow: 0 1px 2px rgba(0,0,0,.35); --pop-shadow: 0 12px 32px rgba(0,0,0,.45); --modal-shadow: 0 24px 64px rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ================= base ================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 400; letter-spacing: 0; color: var(--text); }
a { color: var(--link); text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
a.btn, a.brand { text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: Consolas, monospace; }
.ok-text { color: var(--ok); } .err-text { color: var(--acc-text); }
[v-cloak] { display: none; }
.ic { width: 16px; height: 16px; flex: none; display: block; }
.ico { width: 16px; height: 16px; flex: none; } .ico-s { width: 13px; height: 13px; flex: none; }

/* ================= controls ================= */
button, .btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px;
  padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); color: var(--text);
  line-height: 1.2; cursor: pointer; transition: background-color .12s, border-color .12s, color .12s; }
button:hover, .btn:hover { background: var(--hover); text-decoration: none; }
button:active, .btn:active { background: var(--s3); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
button.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
button.small, .btn.small { min-height: 30px; padding: 4px 11px; font-size: 12.5px; }
button.danger-ghost { color: var(--acc-text); }
button.danger-ghost:hover { background: var(--acc-tint); border-color: var(--acc-border); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); min-height: 30px; padding: 4px 8px; font-size: 13px; }
.btn-ghost:hover { color: var(--text); }
.link-btn { min-height: 0; padding: 2px 4px; border: 0; background: transparent; color: var(--text-2); font-size: 12.5px; text-decoration: underline;
  text-decoration-color: var(--link-line); text-underline-offset: 3px; }
.link-btn:hover { background: transparent; color: var(--text); text-decoration-color: currentColor; }
.icon-btn { width: 30px; min-height: 30px; padding: 0; font-size: 15px; line-height: 1; }
.icon-btn > svg { display: block; width: 16px; height: 16px; flex: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--acc-border); outline-offset: 2px; }

input, select, textarea { font: inherit; color: var(--text); background: var(--input-bg); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 10px; }
select, input:not([type=checkbox]):not([type=radio]):not([type=range]) { min-height: 34px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus) { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acc-border); box-shadow: 0 0 0 3px var(--acc-ring); }
input:disabled, select:disabled { background: var(--s1); }
input:-webkit-autofill, input:-webkit-autofill:hover { -webkit-text-fill-color: var(--text); caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset; box-shadow: 0 0 0 1000px var(--input-bg) inset; transition: background-color 9999s ease-out 0s; }
input:-webkit-autofill:focus { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px var(--input-bg) inset, 0 0 0 3px var(--acc-ring); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; vertical-align: middle; accent-color: var(--acc); cursor: pointer; }
textarea.wide { width: 100%; min-height: 90px; }
label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 400; color: var(--text-2); }
label.check { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; line-height: 1.3; }
.field { margin-bottom: 12px; }
.field input, .field select { width: 100%; }
.field input[type=checkbox], .field input[type=radio], label.check input { width: auto; flex: none; }
.checks { display: grid; gap: 2px; }

/* select: own chevron; Chrome/Edge also get the open list in our colours (customizable select) */
select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer; white-space: nowrap; overflow: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a94a3' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px; }
select.small, .toolbar select, .pager select { min-height: 30px; padding: 4px 30px 4px 10px; font-size: 12.5px; background-position: right 10px center; }
select.mini { min-height: 30px; padding: 3px 28px 3px 9px; font-size: 12px; background-position: right 9px center; }
select[multiple] { background-image: none; padding-right: 10px; }
@supports (appearance: base-select) {
  select:not([multiple]), select:not([multiple])::picker(select) { appearance: base-select; }
  select:not([multiple]) { display: inline-flex; align-items: center; line-height: 1.2; }
  select:not([multiple])::picker-icon { display: none; }
  select:not([multiple]):open { border-color: var(--acc-border); box-shadow: 0 0 0 3px var(--acc-ring); }
  ::picker(select) { margin-block: 4px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 8px;
    background: var(--card); color: var(--text); box-shadow: var(--pop-shadow); max-block-size: 340px;
    position-try-order: normal; }   /* open downwards like every other list; flip up only when it does not fit */
  select option { padding: 6px 10px; border-radius: 5px; font-size: 13px; color: var(--text); }
  select option::checkmark { display: none; }
  select option:hover, select option:focus-visible { background: var(--hover); outline: none; }
  select option:checked { background: var(--acc-tint); color: var(--acc-text); font-weight: 600; }
}

/* segmented choice (frequency, weekday, language) */
.seg { display: inline-flex; max-width: 100%; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; }
.seg button { min-height: 32px; padding: 4px 14px; border: 0; border-radius: 0; background: var(--card); color: var(--text-2); font-size: 13px; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button:hover { background: var(--hover); color: var(--text); }
.seg button.on { background: var(--acc-tint); color: var(--acc-text); font-weight: 600; }
.seg.days button { padding: 4px 11px; }
/* on/off switch */
.switch { position: relative; flex: none; width: 38px; min-height: 0; height: 22px; padding: 0; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--line-strong); }
.switch:hover, .switch:active { background: var(--line-strong); }
.switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--knob);
  box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch[aria-checked="true"], .switch[aria-checked="true"]:hover { background: var(--acc); border-color: var(--acc); }
.switch[aria-checked="true"] i { transform: translateX(16px); }
/* (i) with an explanation on hover instead of help texts on the page */
.info { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 15px; height: 15px; margin-left: 4px;
  border: 1px solid var(--muted); border-radius: 50%; color: var(--muted); font: italic 600 10px/1 Georgia, serif;
  cursor: help; vertical-align: middle; user-select: none; text-transform: none; letter-spacing: 0; }
.info:hover { border-color: var(--text); color: var(--text); }
label .info { margin-right: 6px; }

/* ================= top bar ================= */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 20px;
  background: var(--topbar-bg); color: var(--topbar-fg); border-bottom: 3px solid var(--brand); }
.brand { display: flex; align-items: center; gap: 14px; margin-right: 8px; color: var(--topbar-fg); }
.brand img { display: block; height: 30px; width: auto; border-radius: 2px; }
.brand-name { padding-left: 14px; border-left: 1px solid var(--topbar-line); font: 400 17px/1 var(--font-head); letter-spacing: .2px; white-space: nowrap; }
.brand-name small { margin-left: 8px; font: 500 11px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--topbar-muted); }
.topbar .spacer { flex: 1; }
.topbar .btn, .topbar button { min-height: 32px; padding: 4px 12px; font-size: 13px; background: transparent; color: var(--topbar-fg); border-color: var(--topbar-line); }
.topbar .icon-btn { width: 32px; padding: 0; }
.topbar .btn:hover, .topbar button:hover { background: var(--topbar-hover); border-color: rgba(255,255,255,.3); }
.topbar select { min-height: 32px; background-color: transparent; color: var(--topbar-fg); border-color: var(--topbar-line);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c3ccd5' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.topbar select:hover:not(:focus) { background-color: var(--topbar-hover); border-color: rgba(255,255,255,.3); }

/* ================= layout + cards ================= */
.layout { display: grid; grid-template-columns: 272px 1fr; gap: 16px; min-height: calc(100vh - 59px); padding: 18px 20px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.layout > main { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 16px 18px; margin-bottom: 16px; }
.section h3 { margin: 0 0 12px; font-size: 17px; }
.section h4 { margin: 16px 0 8px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } @media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.end { align-items: flex-end; } .row.end .field { margin-bottom: 0; } .row.end label.check { min-height: 34px; }
.row label.check, .toolbar label.check { min-height: 34px; margin: 0 6px 0 0; }
.field .row label.check { min-height: 28px; }
.inline { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; } .inline .small { white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.divider { margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.form-grid .field input, .form-grid .field select { width: 100%; }
.form-grid.cols5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .form-grid.cols5 { grid-template-columns: 1fr 1fr; } .form-grid.cols5 .field { grid-column: auto !important; } }
.notice { margin: 10px 0; padding: 8px 12px; border: 1px solid var(--notice-line); border-radius: 6px; background: var(--notice-bg); font-size: 13px; }
.notice.ok { background: var(--notice-ok-bg); border-color: var(--notice-ok-line); }
.notice.err { background: var(--notice-err-bg); border-color: var(--notice-err-line); }
.steps-guide { display: grid; gap: 6px; margin: 0; padding-left: 20px; }
.btn-group { display: inline-flex; }
.btn-group > * + * { margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn-group > *:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ================= filter sidebar ================= */
.sidebar { position: sticky; top: 74px; align-self: start; display: flex; flex-direction: column; max-height: calc(100vh - 92px); padding: 0; overflow: hidden; }
.side-head { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.side-head .ic { color: var(--text-2); }
.side-head h3 { flex: 1; margin: 0; font-size: 16px; font-weight: 500; }
.count-pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--acc-tint); color: var(--acc-text);
  font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center; }
.side-body { flex: 1; padding: 14px 16px 6px; overflow-x: hidden; overflow-y: auto; }
.side-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--s1); }
.side-foot .primary { flex: 1; }
.fgroup + .fgroup { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.fgroup-title { margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--text); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.pair > * { width: 100%; min-width: 0; }
.search { position: relative; margin-bottom: 16px; }
.search .ic { position: absolute; top: 50%; left: 11px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; min-height: 38px; padding-left: 35px; font-size: 14px; }

/* ================= stats ================= */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 12px 16px 13px; }
.stat .n { font: 400 26px/1.15 var(--font-head); font-variant-numeric: tabular-nums; }
.stat .l { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }

/* ================= tables ================= */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.toolbar .count { color: var(--muted); font-size: 13px; } .toolbar .count b { margin-right: 2px; color: var(--text); font-size: 15px; font-weight: 600; }
.toolbar input:not([type=checkbox]):not([type=radio]) { min-height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: 12.5px; }
.toolbar button { min-height: 30px; font-size: 12.5px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--s1); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; user-select: none; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--text); }
th.sorted, th.sorted:hover { color: var(--acc-text); }
tbody tr:hover td { background: var(--s1); }
tr.selected td, tr.selected:hover td { background: var(--acc-tint-2); }
td.name { font-weight: 600; }
td.name a { color: var(--text); text-decoration: none; } td.name a:hover { text-decoration: underline; text-decoration-color: currentColor; }
td .sub { color: var(--muted); font-size: 12px; font-weight: 400; }
td > input[type=checkbox], th > input[type=checkbox] { display: block; margin: 0 auto; }
.sort-ind { display: inline-block; width: 1.1em; margin-left: 3px; font-size: 10px; text-align: center; }
.leads-table { table-layout: fixed; width: 100%; min-width: 1280px; }
.leads-table td, .leads-table th { overflow-wrap: anywhere; vertical-align: middle; }
.leads-table td.nowrap { white-space: nowrap; overflow-wrap: normal; }
.leads-table select { width: 100%; padding-left: 9px; padding-right: 26px; background-position: right 8px center; }
.leads-table .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
th.star-th { padding: 0; text-align: center; }
th.star-th .star { color: var(--star); } th.star-th:hover .star { color: var(--muted); } th.star-th.sorted .star { color: var(--star-on); }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 14px; color: var(--muted); font-size: 13px; }
.pager select { width: auto; }
.btn-export { font-weight: 500; }
.sidebar, .side-body, .drawer, .tag-list, pre.log, main .card > div { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* badges, stars, tags */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; background: var(--badge-bg); color: var(--badge-fg); font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge.trade { background: var(--badge-bg); color: var(--text); }
.badge.trade.prio { background: var(--badge-prio-bg); color: var(--badge-prio-fg); }
.badge.status-new { background: var(--badge-bg); color: var(--badge-fg); }
.badge.status-contacted { background: var(--badge-warn-bg); color: var(--warn); }
.badge.status-interested { background: var(--badge-ok-bg); color: var(--ok); }
.badge.status-partner { background: var(--ok); color: #fff; }
.badge.status-not_relevant { background: var(--badge-bg); color: var(--badge-off-fg); }
.badge.src { background: var(--badge-bg); color: var(--muted); font-size: 10px; }
.badge.tag { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--text-2); }
.badge.tag.more { flex: none; border-style: dashed; color: var(--muted); }
.badge.tag .tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; color: var(--star); font-size: 17px; line-height: 1; vertical-align: middle; cursor: pointer; }
.star:hover { color: var(--muted); } .star.on, .star.on:hover { color: var(--star-on); }
td .star { display: flex; margin: 0 auto; }
.tag-cell { flex-wrap: nowrap; overflow: hidden; cursor: pointer; }
.tag-cell .badge { flex: 0 1 auto; min-width: 0; }
.tag-add { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; min-height: 0; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.tag-add:hover { background: var(--hover); color: var(--text); }
.tag-add .ico-s { display: block; width: 15px; height: 15px; }
.chip-x { width: 16px; height: 16px; min-height: 0; margin-left: 2px; padding: 0; border: 0; border-radius: 50%; background: transparent;
  color: inherit; opacity: .65; font-size: 13px; line-height: 1; vertical-align: middle; }
.chip-x:hover { opacity: 1; background: var(--s3); }

/* ================= detail drawer ================= */
/* the detail lies ON TOP of the list: the rest dims, the panel is a step lighter (dark mode) and casts a shadow */
.drawer-bg { position: fixed; inset: 0; z-index: 19; background: var(--scrim); animation: pf-fade .16s ease-out; }
.drawer { position: fixed; top: 0; right: 0; z-index: 20; width: 520px; max-width: 100vw; height: 100vh; overflow: auto;
  padding: 22px 24px 28px; background: var(--elev); border-left: 1px solid var(--line-strong);
  box-shadow: -18px 0 48px rgba(10,14,19,.28); animation: pf-slide .2s ease-out; }
@keyframes pf-fade { from { opacity: 0; } }
@keyframes pf-slide { from { transform: translateX(28px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-bg { animation: none; } }
.drawer h2 { margin: 0 40px 8px 0; font-size: 22px; line-height: 1.25; }
.drawer .close { position: absolute; top: 16px; right: 16px; }
.drawer .lead-desc { margin: 10px 0 0; color: var(--text-2); font-size: 13px; }
.dsec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.dsec-title { margin: 0 0 10px; font: 500 15px/1.2 var(--font-head); color: var(--text); }
.dsec .field:last-child { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 7px 12px; align-items: center; font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.history { display: grid; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.history .muted { margin-right: 6px; }

/* ================= modals + dialogs ================= */
.modal-bg { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 11vh 16px 16px; background: var(--scrim); animation: pf-fade .16s ease-out; }
.modal { background: var(--elev); display: flex; flex-direction: column; width: 460px; max-width: 100%; max-height: 82vh; padding: 0; overflow: hidden;
  border-top: 3px solid var(--brand); box-shadow: var(--modal-shadow); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; }
.modal-head h3 { flex: 1; margin: 0; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { display: flex; flex-direction: column; gap: 14px; padding: 6px 20px 20px; overflow: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--s1); }
.modal-foot .err-text { margin-right: auto; font-size: 13px; }
.modal .field { margin-bottom: 0; }
.modal-tabs { display: flex; gap: 22px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.modal-tabs button { gap: 7px; min-height: 0; margin-bottom: -1px; padding: 9px 1px 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; color: var(--muted); font-weight: 500; }
.modal-tabs button:hover { background: none; color: var(--text); }
.modal-tabs button.active { border-bottom-color: var(--brand); color: var(--text); }
.modal-tabs .ic { width: 15px; height: 15px; }
.modal.settings { width: 520px; }
.modal.settings .modal-body { gap: 20px; padding-top: 18px; }
.set-group { display: flex; flex-direction: column; gap: 8px; }
.set-group > .seg, .set-group > .inline, .set-group > .btn-ghost { align-self: flex-start; }
.set-title { font-size: 13px; font-weight: 600; color: var(--text); }
.switch-card { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--s1); cursor: pointer; }
.switch-card > .ic { color: var(--text-2); }
.switch-card .t { flex: 1; } .switch-card b { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.switch-card .t span { display: block; margin-top: 1px; color: var(--muted); font-size: 12.5px; font-weight: 400; }
fieldset.plain { display: flex; flex-direction: column; gap: 20px; min-width: 0; margin: 0; padding: 0; border: 0; transition: opacity .15s; }
fieldset.plain[disabled] { opacity: .42; } fieldset.plain[disabled] * { cursor: not-allowed; }
.email-list { display: grid; gap: 6px; }
.email-row { display: flex; align-items: center; gap: 6px; }
.email-row input { flex: 1; min-width: 0; }
.email-row .icon-btn { width: 34px; min-height: 34px; flex: none; color: var(--muted); }
.email-row .icon-btn:hover { color: var(--text); }
.email-list + .btn-ghost { align-self: flex-start; margin-left: -8px; }
.profile { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--s1); }
.avatar { display: flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--topbar-bg); color: #fff; font: 500 17px/1 var(--font-head); }
:root[data-theme="dark"] .avatar { background: var(--s3); }
.profile b { display: block; font-size: 15px; font-weight: 600; }
.profile .login-name { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.profile .login-name .ic { width: 13px; height: 13px; }
/* confirmation dialog (instead of the browser's own window) */
.modal.dialog { width: 420px; }
.dialog-body { display: flex; gap: 14px; padding: 20px 20px 18px; }
.dialog-icon { display: flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--s2); color: var(--text-2); }
.dialog-icon.danger { background: var(--acc-tint); color: var(--acc-text); }
.dialog-icon .ic { width: 19px; height: 19px; }
.dialog-text { flex: 1; min-width: 0; }
.dialog-text h3 { margin: 7px 0 0; font-size: 17px; line-height: 1.3; }
.dialog-text p { margin: 8px 0 0; color: var(--text-2); font-size: 13.5px; }
.dialog-text input { width: 100%; margin-top: 12px; }
/* tag editor */
/* date field + calendar in the app's colours */
.date-input { position: relative; min-width: 0; }
.date-btn { justify-content: space-between; gap: 4px; width: 100%; min-height: 34px; padding: 6px 8px 6px 10px; background: var(--input-bg); font-size: 13px; font-weight: 400; }
.date-btn:hover:not(.open) { background: var(--input-bg); border-color: var(--muted); }
.date-btn.open { border-color: var(--acc-border); box-shadow: 0 0 0 3px var(--acc-ring); }
.date-btn.empty span { color: var(--muted); }
.date-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-btn .ic { width: 15px; height: 15px; color: var(--muted); }
.date-pop { position: fixed; z-index: 70; width: 264px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); box-shadow: var(--pop-shadow); }
.date-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.date-head b { font-size: 13.5px; font-weight: 600; }
.date-head .icon-btn { border-color: transparent; background: transparent; color: var(--text-2); }
.date-head .icon-btn:hover { background: var(--hover); }
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-grid .wd { padding: 4px 0; color: var(--muted); font-size: 11px; font-weight: 500; text-align: center; }
.date-grid button { min-height: 0; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font-size: 13px; }
.date-grid button:hover { background: var(--hover); }
.date-grid button.out { color: var(--muted); opacity: .55; }
.date-grid button.today { border-color: var(--line-strong); font-weight: 600; }
.date-grid button.sel, .date-grid button.sel:hover { background: var(--acc-tint); border-color: var(--acc-border); color: var(--acc-text); font-weight: 600; }
.date-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.tag-current { min-height: 26px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow: auto; }
.tag-opt { min-height: 28px; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; }
.tag-opt .muted { font-size: 11px; }
.tag-opt.new { border-style: dashed; color: var(--text); }

.toast { position: fixed; bottom: 18px; left: 50%; z-index: 60; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 6px; background: var(--toast-bg); color: var(--toast-fg); font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ================= admin ================= */
.tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.tabs button { min-height: 0; padding: 12px 14px 11px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 500; }
.tabs button:hover { background: none; color: var(--text); }
.tabs button.active { border-bottom-color: var(--brand); color: var(--text); font-weight: 600; }
pre.log { max-height: 420px; overflow: auto; padding: 12px; border-radius: 6px; background: var(--log-bg); color: var(--log-fg); font-size: 12px; white-space: pre-wrap; }
.icon-run { width: 30px; padding: 0; flex: none; }
.src-dot { display: inline-block; width: 8px; height: 8px; margin-right: 3px; border-radius: 50%; }

/* ================= login: roof photo from maslen.at, dark overlay, logo card ================= */
.login-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px;
  background: linear-gradient(160deg, rgba(17,23,29,.80), rgba(27,37,47,.62) 55%, rgba(17,23,29,.86)), url("/static/brand/roof-2560.webp") center / cover no-repeat, #1b252f; }
.login-tools { position: fixed; top: 14px; right: 16px; display: flex; gap: 6px; }
.login-tools select, .login-tools button { background-color: rgba(17,23,29,.35); color: #fff; border-color: rgba(255,255,255,.28); }
.login-tools select:hover, .login-tools button:hover { background-color: rgba(255,255,255,.1); }
.login-tools select.mini { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.login-tools .icon-btn svg { display: block; width: 16px; height: 16px; }
.login { width: 380px; max-width: 100%; padding: 30px 32px 28px; border: 0; border-top: 4px solid var(--brand); box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 7px; margin-bottom: 18px; }
.login-logo .claim { font: 300 13px/1 var(--font-head); letter-spacing: .04em; text-transform: uppercase; color: var(--text); }
.login-logo .claim b { font-weight: 500; }
.login-logo img { display: block; width: 170px; height: auto; }
.login h1 { margin: 0 0 24px; font-size: 24px; text-align: center; }
.login .field { margin-bottom: 12px; }
.login input { width: 100%; }
.login button.primary { width: 100%; min-height: 40px; margin-top: 4px; font-size: 15px; }
