/* ReliefLine Call Log — palette matched to acquisition.com */
:root {
  --paper: #ffffff;
  --panel: #f6f6f4;
  --panel-2: #efefec;
  --ink: #000000;
  --ink-soft: #5f7079;
  --ink-faint: #9aa4a9;
  --border: #e4e4df;

  --violet: #6f00ff;
  --violet-soft: #f1e8ff;
  --red: #f44336;
  --red-soft: #fde9e7;
  --amber: #b26a00;
  --amber-soft: #fbf0dd;
  --green: #1f9d55;
  --green-soft: #e5f4ec;

  --radius: 12px;
  --shadow: 0 24px 60px -34px rgba(20, 12, 40, 0.35);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--violet); }

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px;
  background: var(--panel);
}
.login-card {
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px 28px; width: 100%; max-width: 320px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 28px -18px rgba(0, 0, 0, 0.18);
}
.login-card .brand {
  align-self: center; margin-bottom: 24px;
}
.login-card .brand svg { width: 24px; height: 24px; }
.login-card .brand .wm { font-size: 1.18rem; }
.login-card label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 6px;
}
.login-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--paper); margin-bottom: 14px;
}
.login-card input:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 4px; }
.login-card .err {
  color: var(--red); font-size: 0.82rem; margin-bottom: 12px;
  padding: 8px 10px; background: var(--red-soft); border-radius: 8px;
}

/* ---------- brand mark ---------- */

.brand { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.brand svg { width: 20px; height: 20px; stroke: var(--ink); fill: none; stroke-width: 2; transform: translate(1.5px, 2px); }
.brand .wm { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.brand .wm b { color: var(--violet); font-weight: 700; }

/* ---------- layout ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.topbar .inner {
  max-width: 1160px; margin: 0 auto; padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .right { display: flex; align-items: center; gap: 14px; }
.linkbtn { background: none; border: none; color: var(--ink-soft); cursor: pointer; font-weight: 600; font-size: 0.85rem; }
.linkbtn:hover { color: var(--ink); }

.page { max-width: 1160px; margin: 0 auto; padding: 28px 24px 80px; }

/* ---------- stat tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 22px; }
.tile {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.tile .n { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.tile .k { margin-top: 6px; font-size: 0.76rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.tile.alert .n { color: var(--red); }
.tile.followup .n { color: var(--amber); }

/* ---------- filter bar ---------- */

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px;
}
.search {
  flex: 1 1 240px; min-width: 200px;
  display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px;
}
.search input { border: none; background: none; outline: none; padding: 10px 0; width: 100%; }
.search svg { width: 15px; height: 15px; stroke: var(--ink-faint); fill: none; stroke-width: 2; flex-shrink: 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--paper); color: var(--ink-soft);
  padding: 7px 12px; border-radius: 100px; cursor: pointer; font-size: 0.82rem; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.cat-leasing[aria-pressed="true"] { background: var(--violet); border-color: var(--violet); }
.chip.cat-emergency[aria-pressed="true"] { background: var(--red); border-color: var(--red); }

/* ---------- table ---------- */

.table-wrap { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 0.72rem; font-weight: 700; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.04em; padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel); }
tbody tr[aria-selected="true"] { background: var(--violet-soft); }

.cell-time { white-space: nowrap; color: var(--ink-soft); font-size: 0.85rem; }
.cell-who .name { font-weight: 600; }
.cell-who .num { color: var(--ink-soft); font-size: 0.83rem; }
.cell-reason { color: var(--ink-soft); max-width: 340px; }
.cell-reason .outcome { color: var(--ink); font-weight: 500; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 0.74rem; font-weight: 700;
  text-transform: capitalize; white-space: nowrap;
}
.badge.leasing { background: var(--violet-soft); color: var(--violet); }
.badge.maintenance { background: var(--panel-2); color: var(--ink-soft); }
.badge.emergency { background: var(--red-soft); color: var(--red); }
.badge.other { background: var(--panel-2); color: var(--ink-soft); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 600; color: var(--ink-soft);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
.pill.new::before { background: var(--violet); }
.pill.followup { color: var(--amber); }
.pill.followup::before { background: var(--amber); }
.pill.handled { color: var(--green); }
.pill.handled::before { background: var(--green); }

.empty { padding: 60px 20px; text-align: center; color: var(--ink-faint); }

/* ---------- detail drawer ---------- */

.scrim {
  position: fixed; inset: 0; background: rgba(10, 6, 20, 0.28);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease; z-index: 40;
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(520px, 94vw);
  background: var(--paper); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  transform: translateX(100%); transition: transform 0.22s cubic-bezier(.2,.8,.2,1); z-index: 50;
  display: flex; flex-direction: column;
}
body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
body.drawer-open .drawer { transform: translateX(0); }

.drawer-head { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 1.15rem; }
.drawer-head .sub { color: var(--ink-soft); font-size: 0.85rem; margin-top: 2px; }
.x { background: none; border: none; cursor: pointer; color: var(--ink-faint); font-size: 1.3rem; line-height: 1; padding: 2px 6px; }
.x:hover { color: var(--ink); }

.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; margin-bottom: 20px; }
.kv dt { color: var(--ink-faint); font-size: 0.8rem; font-weight: 600; }
.kv dd { margin: 0; }
.kv dd .copy { margin-left: 8px; font-size: 0.72rem; color: var(--violet); cursor: pointer; background: none; border: none; font-weight: 700; }

.field-label { font-size: 0.75rem; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; margin: 18px 0 8px; }
.status-row { display: flex; gap: 6px; }
.status-row button {
  border: 1px solid var(--border); background: var(--paper); border-radius: 100px;
  padding: 7px 14px; cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft);
}
.status-row button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
textarea#notes {
  width: 100%; min-height: 84px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  resize: vertical; background: var(--paper);
}
textarea#notes:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
.saved-hint { font-size: 0.76rem; color: var(--green); margin-top: 6px; min-height: 1em; }

audio { width: 100%; margin-top: 6px; }
.transcript {
  white-space: pre-wrap; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.6;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  max-height: 320px; overflow-y: auto;
}

.btn {
  display: inline-flex; align-items: center; gap: 7px; border: none; border-radius: 100px;
  padding: 9px 18px; font-weight: 700; font-size: 0.86rem; cursor: pointer;
  background: var(--violet); color: #fff;
}
.btn:hover { opacity: 0.9; }
.btn.ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--border); }

.devbar { margin-top: 18px; font-size: 0.8rem; color: var(--ink-faint); }
.devbar button { font-size: 0.8rem; }

@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .cell-hide-sm { display: none; }
}

/* ---------- admin panel ---------- */

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 1.4rem; margin: 0; }

.badge.active { background: var(--green-soft); color: var(--green); }
.badge.paused { background: var(--amber-soft); color: var(--amber); }
.badge.cancelled { background: var(--panel-2); color: var(--ink-faint); }

.client-form { display: grid; gap: 12px; }
.client-form label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.client-form input, .client-form select, .client-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--paper);
}
.client-form input:focus, .client-form select:focus, .client-form textarea:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
.client-form textarea { resize: vertical; min-height: 64px; }

.flags { display: grid; gap: 8px; }
.flags label { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--ink); font-weight: 500; }
.flags input { width: auto; }

.reveal {
  background: var(--violet-soft); border: 1px solid color-mix(in srgb, var(--violet) 30%, var(--border));
  border-radius: 10px; padding: 12px 14px; font-size: 0.85rem; margin-top: 10px;
}
.reveal code { background: var(--paper); padding: 2px 6px; border-radius: 6px; font-size: 0.85rem; }

.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.user-row .email { font-size: 0.88rem; }
.user-row .acts { display: flex; gap: 8px; }
.mini { border: 1px solid var(--border); background: var(--paper); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.mini:hover { color: var(--ink); }
.mini.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, var(--border)); }

.danger-zone { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.danger-zone h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--red); margin: 0 0 8px; }
.danger-zone p { font-size: 0.84rem; color: var(--ink-soft); margin: 0 0 10px; }
.danger-zone input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; width: 100%; margin-bottom: 8px; }
.btn.red { background: var(--red); }

.rowlink { color: var(--violet); font-weight: 600; }
