/* Dinango Lodge – staff portal */
:root {
  --ink: #0F172B; --ink-2: #273248; --muted: #697386; --faint: #98A0AE;
  --paper: #F4F1EA; --surface: #FFFFFF; --sunk: #FAF8F3; --line: #E5DFD3; --line-2: #EFEAE1;
  --amber: #FEA116; --amber-d: #B76B00; --amber-50: #FFF4DC;
  --green: #12704A; --green-50: #E5F4EC; --red: #B42318; --red-50: #FDECEA; --blue: #1E4FC2; --blue-50: #E8EEFC; --grey-50: #EEF0F2;
  --r: 10px; --r-s: 7px; --shadow: 0 1px 2px rgba(15, 23, 43, .05), 0 1px 1px rgba(15, 23, 43, .03);
  --shadow-l: 0 12px 40px rgba(15, 23, 43, .16);
  --side: 252px; --top: 64px;
  --font: 'Heebo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --head: 'Montserrat', var(--font);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--amber-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 700; letter-spacing: -.01em; margin: 0; color: var(--ink); }
code { background: var(--grey-50); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 10px; top: 10px; z-index: 999; background: #fff; padding: 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; } .right { text-align: right; } .mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt0 { margin-top: 0; }
.only-m { display: none !important; }
:focus-visible { outline: 3px solid rgba(254, 161, 22, .55); outline-offset: 2px; }

/* ---------- Auth screens ---------- */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: var(--ink); background-image: radial-gradient(circle at 20% 0%, #1b2742 0, transparent 55%); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border-radius: 14px; padding: 34px 30px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.auth-logo { width: 72px; height: 72px; object-fit: contain; display: block; margin: 0 auto 10px; }
.auth-kicker { text-align: center; margin: 0 0 4px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.auth-card h1 { text-align: center; font-size: 22px; margin-bottom: 20px; }
.auth-links { text-align: center; margin: 16px 0 0; font-size: 14px; }
.auth-foot { margin-top: 18px; font-size: 14px; } .auth-foot a { color: #c7cede; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.stack small { font-weight: 400; color: var(--muted); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 6px; }
.code-input { font-size: 26px !important; letter-spacing: 8px; text-align: center; font-family: var(--head) !important; }
button.link { background: none; border: 0; color: var(--amber-d); cursor: pointer; font: inherit; }

/* ---------- Inputs ---------- */
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(254, 161, 22, .18); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--ink); }
input[readonly] { background: var(--sunk); }
textarea { resize: vertical; min-height: 44px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23697386' stroke-width='1.6' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.fld small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.grid { display: grid; gap: 16px 18px; 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)); }
.span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.form-actions .grow { margin-right: auto; }
/* Toggle */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { width: 40px; height: 23px; border-radius: 20px; background: #d5d0c5; position: relative; flex: 0 0 40px; transition: background .2s; }
.switch .slider::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { transform: translateX(17px); }
.switch input:focus-visible + .slider { outline: 3px solid rgba(254, 161, 22, .55); }
.fld-toggle small { margin-left: 52px; }
.img-field { display: flex; gap: 12px; align-items: center; }
.img-field img { width: 64px; height: 64px; object-fit: contain; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-s); flex: 0 0 64px; }
.img-field > div { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 14px/1 var(--font); padding: 10px 15px; border-radius: var(--r-s); border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--sunk); border-color: #d6cfc0; }
.btn:active { transform: translateY(1px); }
.btn i { font-size: 13px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #1e2a44; border-color: #1e2a44; }
.btn-accent { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn-accent:hover { background: #f29400; border-color: #f29400; }
.btn-ok { background: var(--green); border-color: var(--green); color: #fff; } .btn-ok:hover { background: #0e5c3c; }
.btn-danger { color: var(--red); } .btn-danger:hover { background: var(--red-50); border-color: #f2c4bf; }
.btn-ghost { border-color: transparent; background: transparent; } .btn-ghost:hover { background: rgba(15, 23, 43, .05); }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-block { width: 100%; padding: 13px 16px; font-size: 15px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
form.inline { display: inline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.icon-btn:hover { background: rgba(15, 23, 43, .06); }

/* ---------- Alerts / toasts ---------- */
.alert { border-radius: var(--r-s); padding: 11px 14px; font-size: 14px; margin-bottom: 14px; border: 1px solid; }
.alert-err { background: var(--red-50); color: #7a1c14; border-color: #f5c6c1; }
.alert-ok { background: var(--green-50); color: #0c4a31; border-color: #b9e0cb; }
.alert-info { background: var(--blue-50); color: #1e3a8a; border-color: #c9d6f7; }
.alert-warn { background: var(--amber-50); color: #6b4100; border-color: #f6d48f; }
.toast { position: relative; display: flex; align-items: center; gap: 10px; border-radius: var(--r-s); padding: 12px 44px 12px 14px; margin-bottom: 16px; font-weight: 500; border: 1px solid; animation: tIn .25s ease; }
.toast button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 20px; color: inherit; cursor: pointer; opacity: .6; }
.toast-ok { background: var(--green-50); color: #0c4a31; border-color: #b9e0cb; }
.toast-err { background: var(--red-50); color: #7a1c14; border-color: #f5c6c1; }
.toast-info { background: var(--blue-50); color: #1e3a8a; border-color: #c9d6f7; }
@keyframes tIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- App shell ---------- */
.app { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--ink); color: #c7cede; display: flex; flex-direction: column; z-index: 40; }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 1px solid rgba(255, 255, 255, .07); height: var(--top); }
.side-brand img { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.side-brand strong { display: block; color: #fff; font-family: var(--head); font-size: 15px; line-height: 1.2; }
.side-brand span { font-size: 12px; color: #8792a8; }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; scrollbar-width: thin; scrollbar-color: #2b3753 transparent; }
.side-group { font-size: 11px; text-transform: uppercase; letter-spacing: .11em; color: #6f7a91; padding: 16px 10px 6px; font-weight: 600; }
.side-nav a, .side-foot a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 7px; color: #c7cede; font-size: 14.5px; text-decoration: none; position: relative; }
.side-nav a i, .side-foot a i { width: 18px; text-align: center; font-size: 14px; color: #7f8aa3; }
.side-nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.side-nav a.on { background: rgba(254, 161, 22, .12); color: #fff; font-weight: 600; }
.side-nav a.on i { color: var(--amber); }
.side-nav a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.side-nav .badge { margin-left: auto; }
.badge { background: var(--amber); color: var(--ink); border-radius: 20px; font-size: 11.5px; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center; line-height: 18px; }
.side-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .07); }
.shell { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 26px; background: rgba(244, 241, 234, .9); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-search { margin-left: auto; position: relative; width: min(360px, 40vw); }
.top-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 13px; }
.top-search input { padding: 9px 12px 9px 34px; background: #fff; border-radius: 20px; font-size: 14px; }
.top-user { position: relative; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font: 700 13px var(--head); cursor: pointer; }
.menu { position: absolute; right: 0; top: 48px; min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-l); padding: 6px; display: none; z-index: 60; }
.menu.open { display: block; animation: tIn .15s ease; }
.menu-head { padding: 10px 12px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-head strong { display: block; } .menu-head span { font-size: 13px; color: var(--muted); }
.menu a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 6px; color: var(--ink); font-size: 14px; text-decoration: none; }
.menu a i { width: 16px; color: var(--muted); }
.menu a:hover { background: var(--sunk); }
.main { padding: 26px; max-width: 1360px; width: 100%; }
.scrim { display: none; }
.tabbar { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-h h3 { font-size: 15.5px; }
.card-h p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-b { padding: 18px; }
.card-b.flush { padding: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 14.5px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none !important; color: var(--ink); display: block; position: relative; overflow: hidden; }
.stat:hover { border-color: #d6cfc0; }
.stat .lbl { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .lbl i { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--sunk); color: var(--ink-2); font-size: 12px; }
.stat .num { font: 700 30px/1.1 var(--head); margin-top: 10px; letter-spacing: -.02em; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.hot .lbl i { background: var(--amber-50); color: var(--amber-d); }
.stat .bar { height: 5px; background: var(--grey-50); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.stat .bar span { display: block; height: 100%; background: var(--green); border-radius: 4px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--sunk); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fdfcf9; }
.tbl .main-cell strong { display: block; font-weight: 600; }
.tbl .main-cell span { font-size: 13px; color: var(--muted); }
.tbl a.row-link { color: var(--ink); font-weight: 600; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions .btn { margin-left: 4px; }
.tbl tr.unread td { font-weight: 600; }
.tbl tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--grey-50); color: #4b5563; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill-green { background: var(--green-50); color: var(--green); }
.pill-amber { background: var(--amber-50); color: var(--amber-d); }
.pill-red { background: var(--red-50); color: var(--red); }
.pill-blue { background: var(--blue-50); color: var(--blue); }
.pill-ink { background: var(--ink); color: #fff; }

/* ---------- Tabs / filters ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--amber); }
.tabs a .badge { margin-left: 6px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 150px; padding: 8px 12px; font-size: 14px; }
.filters input[type=search] { min-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 6px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.chips a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips a .n { opacity: .6; margin-left: 4px; font-weight: 500; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty i { font-size: 30px; color: #c9c1b1; margin-bottom: 10px; }
.empty h2, .empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty p { margin: 0 auto; max-width: 420px; }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 4px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.pager a:hover { background: var(--sunk); }
.pager a.on { background: var(--ink); color: #fff; }

/* ---------- Lists (activity, timeline) ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list .ic { width: 32px; height: 32px; border-radius: 8px; background: var(--sunk); display: flex; align-items: center; justify-content: center; color: var(--ink-2); flex: 0 0 32px; font-size: 13px; }
.list .t { flex: 1; min-width: 0; }
.list .t strong { font-weight: 600; }
.list .t small { display: block; color: var(--muted); font-size: 13px; }
.list .when { font-size: 12.5px; color: var(--faint); white-space: nowrap; }
.list a.li-link { color: inherit; text-decoration: none; display: flex; gap: 12px; flex: 1; }

/* ---------- Bars chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding: 6px 2px 0; }
.bars div { flex: 1; background: #e8e2d5; border-radius: 4px 4px 0 0; position: relative; min-height: 3px; }
.bars div.v { background: var(--ink); }
.bars div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px); background: var(--ink); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 5px; white-space: nowrap; z-index: 5; }
.bars-x { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); margin-top: 6px; }

/* ---------- Calendar ---------- */
.cal-wrap { overflow-x: auto; border-radius: var(--r); }
table.cal { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.cal th, .cal td { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); text-align: center; padding: 0; }
.cal thead th { position: sticky; top: 0; background: var(--sunk); font-weight: 600; padding: 8px 4px; min-width: 42px; z-index: 2; }
.cal thead th small { display: block; font-size: 10.5px; color: var(--faint); font-weight: 500; text-transform: uppercase; }
.cal thead th.wkend { background: #f3efe6; }
.cal thead th.today { background: var(--amber-50); color: var(--amber-d); }
.cal .room { position: sticky; left: 0; background: #fff; text-align: left; padding: 10px 14px; min-width: 170px; z-index: 1; font-weight: 600; box-shadow: 1px 0 0 var(--line); }
.cal .room small { display: block; font-weight: 400; color: var(--muted); }
.cal td.c { height: 50px; cursor: pointer; font-weight: 700; position: relative; }
.cal td.c a { display: flex; flex-direction: column; justify-content: center; height: 100%; color: inherit; text-decoration: none; }
.cal td.c small { font-size: 10.5px; font-weight: 500; opacity: .85; }
.cal td.free { background: #fff; color: var(--faint); }
.cal td.part { background: #e8f3ec; color: var(--green); }
.cal td.most { background: #fff1d6; color: var(--amber-d); }
.cal td.full { background: #f9dcd8; color: var(--red); }
.cal td.closed { background: repeating-linear-gradient(45deg, #f1eee8, #f1eee8 5px, #e7e2d8 5px, #e7e2d8 10px); color: var(--muted); }
.cal td .pend { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding: 12px 18px; }
.cal-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--line); }

/* ---------- Inbox ---------- */
.mail-list .from { font-weight: 600; } .mail-list .subj { color: var(--ink-2); } .mail-list .snip { color: var(--muted); font-size: 13px; }
.mail-list td { cursor: pointer; }
.mail-body iframe { width: 100%; min-height: 420px; border: 0; background: #fff; }
.mail-meta { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.mail-meta .av { width: 42px; height: 42px; border-radius: 50%; background: var(--amber-50); color: var(--amber-d); display: flex; align-items: center; justify-content: center; font: 700 15px var(--head); flex: 0 0 42px; }
.attach { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; margin: 4px 6px 0 0; background: var(--sunk); }
.quote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--muted); white-space: pre-wrap; font-size: 14px; max-height: 260px; overflow: auto; }

/* ---------- Editor ---------- */
.editor { border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; overflow: hidden; }
.editor:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(254, 161, 22, .18); }
.ed-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line-2); background: var(--sunk); position: sticky; top: var(--top); z-index: 3; }
.ed-bar button, .ed-bar select { border: 0; background: transparent; border-radius: 5px; padding: 6px 9px; cursor: pointer; color: var(--ink-2); font-size: 14px; width: auto; }
.ed-bar select { padding: 6px 28px 6px 9px; background-color: transparent; }
.ed-bar button:hover { background: #ece6da; }
.ed-bar button.on { background: var(--ink); color: #fff; }
.ed-bar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
.ed-area { min-height: 340px; padding: 18px 20px; outline: none; font-size: 15.5px; line-height: 1.65; max-height: 70vh; overflow-y: auto; }
.ed-area h2 { font-size: 22px; margin: 18px 0 8px; } .ed-area h3 { font-size: 18px; margin: 16px 0 6px; }
.ed-area img { max-width: 100%; height: auto; border-radius: 6px; }
.ed-area .row { display: flex; gap: 16px; flex-wrap: wrap; } .ed-area .row > [class*=col] { flex: 1 1 260px; }
.ed-area .border { border: 1px dashed var(--line); padding: 10px; border-radius: 6px; }
.ed-src { display: none; width: 100%; min-height: 340px; border: 0; border-radius: 0; font: 13px/1.55 ui-monospace, Menlo, Consolas, monospace; padding: 16px; }
.editor.src .ed-area { display: none; } .editor.src .ed-src { display: block; }

/* ---------- Media picker / modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 43, .55); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 12px; width: min(920px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-l); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.modal-b { padding: 18px; overflow-y: auto; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.media-grid .m { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sunk); cursor: pointer; position: relative; }
.media-grid .m img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.media-grid .m .cap { font-size: 12px; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; }
.media-grid .m:hover { border-color: var(--amber); }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); background: var(--sunk); margin-bottom: 16px; }
.drop.over { border-color: var(--amber); background: var(--amber-50); }

/* ---------- Misc ---------- */
.health { list-style: none; padding: 0; margin: 0; }
.health li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); font-size: 14.5px; }
.health li:last-child { border-bottom: 0; }
.ok-t { color: var(--green); font-weight: 600; } .bad-t { color: var(--red); font-weight: 600; } .warn-t { color: var(--amber-d); font-weight: 600; }
pre.log { background: var(--ink); color: #d7dceb; padding: 16px; border-radius: 8px; font-size: 12.5px; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.matrix th, .matrix td { text-align: center; } .matrix td:first-child, .matrix th:first-child { text-align: left; }
.qr { background: #fff; padding: 12px; border: 1px solid var(--line); border-radius: 8px; display: inline-block; }
.secret { font: 600 16px ui-monospace, Menlo, monospace; letter-spacing: 2px; background: var(--sunk); padding: 8px 12px; border-radius: 6px; display: inline-block; word-break: break-all; }
.note { background: var(--sunk); border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px; font-size: 14px; color: var(--ink-2); }
.timeline { white-space: pre-wrap; font-size: 14px; background: var(--sunk); border-radius: 8px; padding: 12px; max-height: 260px; overflow: auto; }
.search-group h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.pw-meter { height: 5px; border-radius: 4px; background: var(--grey-50); overflow: hidden; margin-top: 2px; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.sortable-handle { cursor: grab; color: var(--faint); }

/* ---------- Responsive / app mode ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  :root { --top: 58px; }
  .only-m { display: inline-flex !important; }
  .side { transform: translateX(-100%); transition: transform .25s ease; width: min(300px, 84vw); box-shadow: var(--shadow-l); z-index: 80; }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(15, 23, 43, .45); z-index: 70; }
  .shell { margin-left: 0; }
  .top { padding: 0 12px; padding-top: env(safe-area-inset-top, 0px); height: calc(var(--top) + env(safe-area-inset-top, 0px)); background: var(--ink); border-bottom: 0; }
  .top .icon-btn, .top-title { color: #fff; }
  .top-search { display: none; }
  .top-user { margin-left: auto; }
  .avatar { background: var(--amber); color: var(--ink); }
  .main { padding: 16px 14px calc(92px + var(--safe-b)); }
  .page-head h2 { font-size: 20px; }
  .grid, .grid-3, .grid-4, .cols-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); box-shadow: 0 -4px 20px rgba(15, 23, 43, .06); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 5px 0; background: none; border: 0; position: relative; font-family: var(--font); cursor: pointer; }
  .tabbar i { font-size: 19px; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.on i { color: var(--amber-d); }
  .tabbar .badge { position: absolute; top: 0; left: 52%; font-size: 10px; padding: 0 5px; line-height: 16px; min-width: 16px; }
  /* Tables become cards */
  table.tbl.stack-m thead { display: none; }
  table.tbl.stack-m, table.tbl.stack-m tbody, table.tbl.stack-m tr, table.tbl.stack-m td { display: block; width: 100%; }
  table.tbl.stack-m tr { padding: 12px 14px; border-bottom: 1px solid var(--line-2); position: relative; }
  table.tbl.stack-m td { border: 0; padding: 2px 0; }
  table.tbl.stack-m td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 13px; }
  table.tbl.stack-m td.main-cell::before, table.tbl.stack-m td.actions::before { content: none; }
  table.tbl.stack-m td.actions { text-align: left; padding-top: 8px; }
  table.tbl.stack-m td.actions .btn { margin: 0 6px 0 0; }
  .filters input, .filters select, .filters input[type=search] { min-width: 0; flex: 1 1 140px; }
  .card-b { padding: 14px; }
  .toast { position: sticky; top: calc(var(--top) + 8px); z-index: 20; box-shadow: var(--shadow-l); }
}
@media (display-mode: standalone) { body { overscroll-behavior-y: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
