/* Admin dashboard — private, one person, mostly on a phone in a spare minute.
   Light, high-contrast theme: it stays legible on a phone screen in daylight,
   which is where I'll actually read it. Dense enough to scan, big enough to tap
   one-handed. No decoration that costs a scroll. No third-party anything. */

:root {
  --bg: #f4f5f4; --surface: #ffffff; --ink: #14201b; --muted: #5b6660; --dim: #8a938d;
  --line: #e2e6e3; --accent: #0b6b4f; --accent-ink: #fff; --accent-weak: #e2f1ea;
  --new: #0b6b4f; --replied: #2563eb; --closed: #6b7280; --bad: #b3341f; --warn: #b45309;
  --radius: 12px; --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.4; -webkit-font-smoothing: antialiased; font-size: 15px; }
.boot { text-align: center; padding: 60px 20px; color: var(--muted); }
:where(a,button,input,select,textarea,[tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.app { max-width: 720px; margin: 0 auto; min-height: 100dvh; }

/* Login */
.login { max-width: 360px; margin: 14vh auto; padding: 26px; background: var(--surface); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(20,32,27,.1); }
.login h1 { font-size: 1.15rem; margin: 0 0 4px; }
.login p { color: var(--muted); margin: 0 0 16px; font-size: .9rem; }
.login input { width: 100%; padding: 13px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; margin-bottom: 14px; }
.msg { padding: 9px 12px; border-radius: 9px; font-size: .88rem; margin-bottom: 12px; }
.msg.err { background: #fbe7e3; color: var(--bad); }

/* Bars */
.bar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.bar h1 { font-size: 1.02rem; margin: 0; }
.bar .sub { color: var(--dim); font-size: .74rem; }
.linkbtn { background: none; border: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 6px; }
.tabs { display: flex; gap: 4px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 49px; z-index: 4; }
.tab { flex: 1; padding: 9px; border-radius: 9px; border: none; background: var(--bg); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.view { padding: 14px 16px 40px; }

/* Filters */
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input, .filters select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: var(--surface); }
.filters input { flex: 1; min-width: 140px; }
.count { color: var(--dim); font-size: .78rem; margin: 0 0 10px; }

/* Enquiry list */
.enq-list { display: grid; gap: 8px; }
.enq { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.enq.new { border-left-color: var(--new); background: #fbfffd; }
.enq .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.enq .name { font-weight: 700; }
.enq .when { color: var(--dim); font-size: .74rem; white-space: nowrap; }
.enq .meta { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.enq .snippet { color: var(--ink); font-size: .88rem; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; }
.pill.new { background: var(--accent-weak); color: var(--new); }
.pill.read { background: #eef1f0; color: var(--muted); }
.pill.replied { background: #e5edff; color: var(--replied); }
.pill.closed { background: #eef1f0; color: var(--closed); }
.src { display: inline-block; font-size: .68rem; font-weight: 700; color: var(--muted); background: #eef1f0; border-radius: 6px; padding: 2px 7px; }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px 18px; text-align: center; color: var(--muted); }
.loadmore { display: block; width: 100%; margin-top: 14px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }

/* Detail sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(20,32,27,.4); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
@media (min-width: 560px) { .sheet-back { align-items: center; } }
.sheet { background: var(--surface); width: 100%; max-width: 520px; border-radius: 16px 16px 0 0; padding: 20px; max-height: 90vh; overflow-y: auto; }
@media (min-width: 560px) { .sheet { border-radius: 16px; } }
.sheet h2 { margin: 0 0 2px; font-size: 1.2rem; }
.sheet .subline { color: var(--muted); font-size: .85rem; margin: 0 0 14px; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; margin: 0 0 14px; font-size: .92rem; }
.kv dt { color: var(--dim); } .kv dd { margin: 0; }
.kv a { color: var(--accent); }
.orig { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: .92rem; white-space: pre-wrap; margin-bottom: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.btn { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.btn.danger { color: var(--bad); border-color: #f0cfc8; }
.btn.block { width: 100%; }
.note-area { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; min-height: 60px; margin-bottom: 10px; }
.callrow { display: flex; gap: 8px; margin-bottom: 14px; }
.callrow .btn { flex: 1; text-align: center; text-decoration: none; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat .n { font-size: 1.5rem; font-weight: 800; }
.stat .l { color: var(--dim); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.tool-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
.tool-row .th { display: flex; justify-content: space-between; font-weight: 700; }
.tool-row .acts { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 46px; margin-top: 14px; }
.spark .b { flex: 1; background: var(--accent-weak); border-radius: 2px 2px 0 0; min-height: 2px; }
.spark .b.today { background: var(--accent); }
.note-line { color: var(--dim); font-size: .75rem; margin-top: 6px; }
.corr { background: var(--accent-weak); border-radius: var(--radius); padding: 14px; margin-top: 16px; }
.corr b { font-size: 1.15rem; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .88rem; z-index: 40; }
h2.sec { font-size: .95rem; margin: 18px 0 8px; }
