/* ============================================================
   Claims CRM — visual system
   Palette: "ink & paper" with a petrol primary and an ochre
   action accent. Claim numbers are set in mono to read as the
   case references they are. The ochre "Next steps" panel is the
   one piece of boldness; everything else stays quiet.
   ============================================================ */

:root {
  --ink: #16202b;
  --ink-2: #55616e;
  --ink-3: #8a94a0;

  --paper: #eceeec;
  --surface: #ffffff;
  --surface-2: #f6f8f6;
  --line: #dce1dc;
  --line-2: #e7ebe7;

  --petrol: #115e67;
  --petrol-700: #0d474e;
  --petrol-900: #0a343a;
  --petrol-tint: #e3f0f0;

  --ochre: #a9661b;
  --ochre-strong: #8f5414;
  --ochre-bg: #fbf2e3;
  --ochre-line: #e8cd9c;

  --danger: #a23b3b;
  --danger-bg: #f8eaea;

  --st-open: #115e67;        --st-open-bg: #e3f0f0;
  --st-active: #a9661b;      --st-active-bg: #faf0df;
  --st-hold: #56616e;        --st-hold-bg: #ebeef0;
  --st-settled: #3a7350;     --st-settled-bg: #e6f1e9;
  --st-declined: #a23b3b;    --st-declined-bg: #f7e9e9;

  --font-display: 'Archivo', system-ui, -apple-system, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(16, 32, 43, 0.06), 0 1px 3px rgba(16, 32, 43, 0.05);
  --shadow: 0 6px 22px rgba(16, 32, 43, 0.08), 0 1px 3px rgba(16, 32, 43, 0.06);
  --shadow-lg: 0 22px 60px rgba(10, 52, 58, 0.22);

  --topbar-h: 60px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 600; }

button { font-family: inherit; }

.hidden { display: none !important; }

.mono { font-family: var(--font-mono); }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.04s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #cdd4cd; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--petrol);
  border-color: var(--petrol);
  color: #fff;
}
.btn-primary:hover { background: var(--petrol-700); border-color: var(--petrol-700); }

.btn-ochre {
  background: var(--ochre);
  border-color: var(--ochre);
  color: #fff;
}
.btn-ochre:hover { background: var(--ochre-strong); border-color: var(--ochre-strong); }

.btn-danger { color: var(--danger); border-color: #e6cccc; background: #fff; }
.btn-danger:hover { background: var(--danger-bg); border-color: #dcb4b4; }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(16, 32, 43, 0.06); }

.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Form fields ---------- */
.field { display: block; margin-bottom: 14px; }
.field > label {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--petrol);
  box-shadow: 0 0 0 3px rgba(17, 94, 103, 0.14);
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2355616e' stroke-width='2.2'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

/* ============================================================
   Sign-in screen
   ============================================================ */
.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(17, 94, 103, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(169, 102, 27, 0.08), transparent 60%),
    var(--paper);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 30px 28px;
}
.login-mark {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}
.login-mark .logo { width: 34px; height: 34px; flex: none; }
.login-mark .wordmark { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.login-mark .sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .lede { color: var(--ink-2); font-size: 14px; margin: 0 0 22px; }
.login-error {
  background: var(--danger-bg);
  border: 1px solid #e7cccc;
  color: #7e2e2e;
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ============================================================
   App shell
   ============================================================ */
.app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: none;
  background: var(--petrol-900);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  z-index: 30;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; flex: none; }
.topbar .brand .logo { width: 28px; height: 28px; }
.topbar .brand .name { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.topbar .brand .name small { display: block; font-weight: 500; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); margin-top: 1px; }

.search {
  flex: 1;
  max-width: 520px;
  position: relative;
  display: flex;
  align-items: center;
}
.search svg { position: absolute; left: 12px; color: rgba(255, 255, 255, 0.6); pointer-events: none; }
.search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 999px;
  padding: 9px 14px 9px 38px;
  font-size: 14px;
  font-family: var(--font-mono);
  outline: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.search input::placeholder { color: rgba(255, 255, 255, 0.55); font-family: var(--font-body); }
.search input:focus { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.4); }

.topbar .spacer { flex: 1; }

.user-menu { position: relative; flex: none; }
.user-button {
  display: flex; align-items: center; gap: 9px;
  background: transparent; border: 0; color: #fff; cursor: pointer;
  padding: 6px 8px; border-radius: var(--r-sm);
}
.user-button:hover { background: rgba(255, 255, 255, 0.10); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ochre); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 13px; flex: none;
}
.user-button .uname { font-size: 14px; font-weight: 500; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 40;
}
.menu-pop .who { padding: 8px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-pop .who strong { display: block; font-size: 14px; }
.menu-pop .who span { font-size: 12px; color: var(--ink-3); }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: transparent; border: 0; text-align: left;
  padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 14px; color: var(--ink);
}
.menu-item:hover { background: var(--surface-2); }

/* ---------- Workspace: list | detail ---------- */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 0;
  overflow: hidden;
}

.list-pane {
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.list-head {
  flex: none;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.list-head .title { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.list-head .count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

.claim-list { overflow-y: auto; flex: 1; padding: 8px; }

.claim-card {
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: 12px 13px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.1s ease, border-color 0.1s ease;
  position: relative;
}
.claim-card:hover { background: var(--surface-2); }
.claim-card.active { background: var(--petrol-tint); border-color: #bcdcdc; }
.claim-card .row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.claim-card .cnum { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--petrol-700); }
.claim-card.active .cnum { color: var(--petrol-900); }
.claim-card .client { font-weight: 600; font-size: 14.5px; margin-top: 5px; color: var(--ink); }
.claim-card .client.empty { color: var(--ink-3); font-weight: 500; font-style: italic; }
.claim-card .snippet { font-size: 13px; color: var(--ink-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.claim-card .snippet b { color: var(--ochre-strong); font-weight: 600; font-family: var(--font-display); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.claim-card .meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.claim-card .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-weight: 600;
  font-size: 11px; letter-spacing: 0.03em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.st-open { color: var(--st-open); background: var(--st-open-bg); }
.pill.st-active { color: var(--st-active); background: var(--st-active-bg); }
.pill.st-hold { color: var(--st-hold); background: var(--st-hold-bg); }
.pill.st-settled { color: var(--st-settled); background: var(--st-settled-bg); }
.pill.st-declined { color: var(--st-declined); background: var(--st-declined-bg); }

/* ---------- Detail pane ---------- */
.detail-pane { min-height: 0; overflow-y: auto; background: var(--paper); }

.detail-empty {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
  color: var(--ink-3);
}
.detail-empty .ill { width: 56px; height: 56px; margin: 0 auto 16px; opacity: 0.6; }
.detail-empty h2 { font-size: 18px; color: var(--ink-2); margin-bottom: 6px; }
.detail-empty p { max-width: 320px; margin: 0 auto; font-size: 14px; }

.detail { padding: 22px 26px 60px; max-width: 920px; }

.detail-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.detail-head .id-block { flex: 1; min-width: 220px; }
.eyebrow { font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.detail-head .cnum { font-family: var(--font-mono); font-size: 22px; font-weight: 500; color: var(--ink); margin-top: 3px; letter-spacing: -0.01em; }
.detail-head .client { font-size: 16px; color: var(--ink-2); margin-top: 3px; font-weight: 500; }
.detail-head .actions { display: flex; align-items: center; gap: 8px; }

.status-control { display: flex; align-items: center; gap: 8px; }
.status-control .select { width: auto; min-width: 150px; }

/* The signature element: the Next Steps action panel */
.next-steps {
  margin-top: 20px;
  background: var(--ochre-bg);
  border: 1px solid var(--ochre-line);
  border-left: 4px solid var(--ochre);
  border-radius: var(--r);
  padding: 16px 18px;
  position: relative;
}
.next-steps .ns-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.next-steps .ns-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ochre-strong); }
.next-steps .ns-title svg { color: var(--ochre); }
.next-steps textarea {
  width: 100%;
  border: 1px solid var(--ochre-line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  resize: vertical;
  min-height: 76px;
  outline: none;
}
.next-steps textarea:focus { border-color: var(--ochre); box-shadow: 0 0 0 3px rgba(169, 102, 27, 0.15); background: #fff; }
.next-steps .ns-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.next-steps .ns-stamp { font-size: 12px; color: var(--ochre-strong); font-style: italic; }
.next-steps .ns-hint { font-size: 11.5px; color: var(--ink-3); }

/* Tabs */
.tabs { display: flex; gap: 2px; margin-top: 26px; border-bottom: 1px solid var(--line); }
.tab {
  background: transparent; border: 0; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 13.5px;
  color: var(--ink-2); padding: 10px 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--petrol-900); border-bottom-color: var(--petrol); }
.tab .badge { font-family: var(--font-mono); font-size: 11px; background: var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 1px 7px; }
.tab.active .badge { background: var(--petrol-tint); color: var(--petrol-700); }

.tab-panel { padding-top: 18px; }

/* Upload row */
.uploader {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px;
  flex-wrap: wrap;
}
.uploader.drag { border-color: var(--petrol); background: var(--petrol-tint); }
.uploader .u-text { flex: 1; min-width: 160px; font-size: 13.5px; color: var(--ink-2); }
.uploader .u-text strong { color: var(--ink); font-weight: 600; }
.uploader .note-input { flex: 1; min-width: 160px; }

/* File rows */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 11px 13px;
}
.file-icon {
  width: 38px; height: 38px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--surface-2); color: var(--petrol);
}
.file-icon.email { color: var(--ochre); background: var(--ochre-bg); }
.file-main { flex: 1; min-width: 0; }
.file-main .fname { font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-main .fmeta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.file-main .fnote { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; font-style: italic; }
.file-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; border-radius: var(--r-sm);
  color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-bg); border-color: #e6cccc; }

.empty-files { text-align: center; color: var(--ink-3); padding: 28px 16px; font-size: 14px; }

/* Details tab form */
.detail-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.detail-form .form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.created-note { font-size: 12px; color: var(--ink-3); }

/* ============================================================
   Modal
   ============================================================ */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 30, 35, 0.42);
  display: grid; place-items: center; padding: 20px; z-index: 60;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 560px; background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 18px; }
.modal-head .eyebrow { margin-bottom: 2px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }
.modal-error { background: var(--danger-bg); border: 1px solid #e7cccc; color: #7e2e2e; border-radius: var(--r-sm); padding: 9px 11px; font-size: 13px; margin-bottom: 14px; }

.dropzone {
  border: 1px dashed var(--line); border-radius: var(--r);
  padding: 16px; text-align: center; color: var(--ink-2);
  font-size: 13.5px; cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--petrol); background: var(--petrol-tint); }
.chosen-files { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.chosen-file { display: flex; align-items: center; gap: 8px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 10px; }
.chosen-file .x { margin-left: auto; cursor: pointer; color: var(--ink-3); border: 0; background: none; }

/* ============================================================
   Toast
   ============================================================ */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px;
  animation: toast-in 0.22s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--petrol-900); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Back button (mobile) */
.back-btn { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .list-pane { border-right: 0; }
  .detail-pane { display: none; }
  .topbar .brand .name small { display: none; }

  body.show-detail .list-pane { display: none; }
  body.show-detail .detail-pane { display: block; }
  .back-btn { display: inline-flex; }

  .detail { padding: 18px 16px 56px; }
  .form-grid { grid-template-columns: 1fr; }
  .user-button .uname { display: none; }
}

@media (max-width: 560px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar .brand .name { font-size: 0; } /* keep just the logo on tiny screens */
  .detail-head .cnum { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   v2 — ASAS branding, nav, statuses, due dates, key info,
   resources, team, email viewer
   ============================================================ */

/* ---------- ASAS branding ---------- */
.login-brand { text-align: center; margin-bottom: 20px; }
.login-logo { max-width: 240px; width: 100%; height: auto; display: block; margin: 0 auto 10px; }
.login-appname {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--petrol-900);
}

.topbar .brand .logo-chip {
  background: #fff; border-radius: 8px; padding: 3px 6px;
  display: inline-flex; align-items: center; flex: none;
}
.topbar .brand .logo-chip img { height: 30px; width: auto; display: block; }

/* ---------- Main nav ---------- */
.main-nav { display: flex; gap: 4px; flex: none; }
.nav-btn {
  background: transparent; border: 0; cursor: pointer;
  color: rgba(255,255,255,0.72);
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  padding: 8px 13px; border-radius: 999px;
}
.nav-btn:hover { color: #fff; background: rgba(255,255,255,0.10); }
.nav-btn.active { color: #fff; background: rgba(255,255,255,0.16); }

.main-area { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.main-area > .workspace { flex: 1; }
.page-view { flex: 1; overflow-y: auto; padding: 26px; }
.page-inner { max-width: 860px; margin: 0 auto; }

body[data-view="resources"] #search-wrap,
body[data-view="team"] #search-wrap,
body[data-view="resources"] #new-claim-btn,
body[data-view="team"] #new-claim-btn { display: none; }

/* ---------- Status pills (v2 set) ---------- */
.pill { max-width: 100%; }
.pill .pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.st-active   { color: var(--petrol-700); background: var(--petrol-tint); }
.pill.st-evidence { color: var(--ochre-strong); background: var(--ochre-bg); }
.pill.st-subs     { color: #5b447e; background: #ece7f4; }
.pill.st-settled  { color: var(--st-settled); background: var(--st-settled-bg); }
.pill.st-closed   { color: var(--st-hold); background: var(--st-hold-bg); }

/* ---------- Due-date urgency ---------- */
.claim-card { border-left: 4px solid transparent; }
.claim-card.due-now { border-left-color: #c0392b; background: #fdf5f4; }
.claim-card.due-now:hover { background: #fbecea; }
.claim-card.due-now.active { border-color: #e5b6b0; border-left-color: #c0392b; background: #fbecea; }
.due-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-display); font-weight: 600; font-size: 11px;
  padding: 2px 8px; border-radius: 999px;
  color: var(--ink-2); background: var(--line-2);
}
.due-chip.red { color: #fff; background: #c0392b; }
.ns-due { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ns-due label { font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ochre-strong); }
.ns-due input[type="date"] {
  border: 1px solid var(--ochre-line); background: rgba(255,255,255,0.7);
  border-radius: var(--r-sm); padding: 6px 9px; font-family: var(--font-body); font-size: 13.5px; color: var(--ink);
}
.ns-due input[type="date"]:focus { outline: none; border-color: var(--ochre); box-shadow: 0 0 0 3px rgba(169,102,27,0.15); }
.ns-due .clear-due { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 12px; text-decoration: underline; }
.ns-due .due-flag { font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #c0392b; }

/* ---------- Key information strip ---------- */
.key-info {
  margin-top: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.key-info .ki { padding: 12px 14px; border-left: 1px solid var(--line-2); min-width: 0; }
.key-info .ki:first-child { border-left: 0; }
.key-info .ki .ki-label {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px;
}
.key-info .ki .ki-value { font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: break-word; }
.key-info .ki .ki-value.empty { color: var(--ink-3); font-weight: 400; }
.key-info .ki .ki-value.mono { font-family: var(--font-mono); font-weight: 500; font-size: 13.5px; }
@media (max-width: 760px) {
  .key-info { grid-template-columns: 1fr 1fr; }
  .key-info .ki:nth-child(odd) { border-left: 0; }
  .key-info .ki:nth-child(n+3) { border-top: 1px solid var(--line-2); }
}

/* ---------- Page views (Resources / Team) ---------- */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--ink-2); margin: 4px 0 0; font-size: 14px; }

.res-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; overflow: hidden; }
.res-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-2); background: var(--surface-2);
}
.res-head h2 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.res-head .res-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.res-body { padding: 12px 14px; }
.res-body .file-list { gap: 6px; }
.res-body .file-row { border: 0; border-top: 1px solid var(--line-2); border-radius: 0; padding: 10px 2px; }
.res-body .file-row:first-child { border-top: 0; }
.res-empty { color: var(--ink-3); font-size: 13.5px; padding: 6px 2px 8px; }
.res-drop.drag { outline: 2px dashed var(--petrol); outline-offset: -6px; background: var(--petrol-tint); }

/* ---------- Team ---------- */
.team-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; overflow: hidden; }
.team-card .tc-head { padding: 13px 16px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.team-card .tc-head h2 { font-size: 14.5px; }
.team-card .tc-body { padding: 16px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line-2); }
.user-row:first-child { border-top: 0; }
.user-row .u-main { flex: 1; min-width: 0; }
.user-row .u-name { font-weight: 600; font-size: 14.5px; }
.user-row .u-sub { font-size: 12.5px; color: var(--ink-3); }
.role-tag {
  display: inline-flex; font-family: var(--font-display); font-weight: 600; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; letter-spacing: 0.03em;
}
.role-tag.admin { color: var(--petrol-700); background: var(--petrol-tint); }
.role-tag.staff { color: var(--ink-2); background: var(--line-2); }
.menu-pop .who .role-tag { margin-top: 5px; }

/* ---------- Email viewer ---------- */
.modal.email-modal { max-width: 780px; }
.email-meta { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 14px; }
.email-meta .em-row { display: flex; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.email-meta .em-row:first-child { border-top: 0; background: var(--surface-2); }
.email-meta .em-label { flex: none; width: 64px; font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding-top: 2px; }
.email-meta .em-value { flex: 1; min-width: 0; overflow-wrap: break-word; }
.email-meta .em-value.subject { font-weight: 600; font-size: 14.5px; }
.email-body-frame { width: 100%; height: 46vh; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.email-attachments { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.email-attachments .att { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px; margin: 3px 6px 0 0; }
.email-note { font-size: 12px; color: var(--ink-3); margin-top: 10px; }

@media (max-width: 900px) {
  .main-nav { order: 3; width: 100%; justify-content: center; padding-bottom: 8px; }
  .topbar { flex-wrap: wrap; height: auto; padding-top: 8px; }
  .search { min-width: 180px; }
}

/* ============================================================
   v3 — FINEOS-style workbench, tasks, notes, history
   ============================================================ */

.select-mini { width: auto; font-size: 12.5px; padding: 5px 26px 5px 8px; }

/* ---------- Workbench ---------- */
.wb-greeting { margin-bottom: 4px; }
.wb-sub { color: var(--ink-2); font-size: 14px; margin: 2px 0 20px; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 16px; min-width: 118px; cursor: pointer; flex: 1;
  transition: border-color .12s ease, transform .06s ease;
}
.stat-card:hover { border-color: var(--petrol); }
.stat-card:active { transform: translateY(1px); }
.stat-card .sc-num { font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.stat-card .sc-label { font-size: 12px; color: var(--ink-2); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.stat-card .sc-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--ink-3)); flex: none; }
.stat-card.total .sc-label::before { display: none; }

.wb-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; overflow: hidden; }
.wb-card .wb-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: var(--surface-2);
}
.wb-card .wb-head h2 { font-size: 14.5px; }
.wb-body { padding: 6px 16px 12px; }
.wb-empty { color: var(--ink-3); font-size: 13.5px; padding: 14px 0; }

.seg { display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 12.5px;
  padding: 5px 13px; border-radius: 999px; color: var(--ink-2);
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Task rows (workbench + claim tab) ---------- */
.task-row { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.task-row:first-child { border-top: 0; }
.task-check {
  width: 20px; height: 20px; flex: none; margin-top: 1px;
  border: 2px solid var(--line); border-radius: 6px; background: var(--surface);
  cursor: pointer; display: grid; place-items: center; color: transparent;
  transition: all .12s ease;
}
.task-check:hover { border-color: var(--petrol); }
.task-check.done { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14px; }
.task-row.done .task-title { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.task-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.claim-ref {
  font-family: var(--font-mono); font-size: 12px; color: var(--petrol-700);
  background: var(--petrol-tint); border-radius: 6px; padding: 1px 7px; cursor: pointer;
}
.claim-ref:hover { background: #d3e7e7; }
.prio { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-display); font-weight: 600; font-size: 11px; }
.prio::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.prio.p-high { color: #a93226; } .prio.p-high::before { background: #c0392b; }
.prio.p-normal { color: var(--ink-2); } .prio.p-normal::before { background: var(--ink-3); }
.prio.p-low { color: var(--ink-3); } .prio.p-low::before { background: var(--line); }

/* Add-task composer */
.task-composer {
  display: grid; grid-template-columns: 1fr 150px 138px 104px auto; gap: 8px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r);
  padding: 10px; margin-bottom: 12px; align-items: center;
}
@media (max-width: 820px) { .task-composer { grid-template-columns: 1fr 1fr; } .task-composer .input, .task-composer .select { width: 100%; } }

/* ---------- File notes ---------- */
.note-composer { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 14px; }
.note-composer .nc-row { display: flex; gap: 8px; margin-top: 8px; justify-content: space-between; align-items: center; }
.note-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; }
.note-top { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.note-type {
  font-family: var(--font-display); font-weight: 600; font-size: 11px; letter-spacing: .03em;
  padding: 2px 9px; border-radius: 999px; background: var(--petrol-tint); color: var(--petrol-700);
}
.note-type.t-phone { background: #e8f0e6; color: #3a7350; }
.note-type.t-meeting { background: var(--ochre-bg); color: var(--ochre-strong); }
.note-type.t-letter { background: #ece7f4; color: #5b447e; }
.note-meta { font-size: 12px; color: var(--ink-3); }
.note-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: break-word; }
.note-row .icon-btn { margin-left: auto; }

/* ---------- History (audit trail) ---------- */
.hist-list { border-left: 2px solid var(--line); margin-left: 7px; padding-left: 18px; }
.hist-row { position: relative; padding: 7px 0; }
.hist-row::before {
  content: ""; position: absolute; left: -23.5px; top: 14px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--petrol);
}
.hist-action { font-size: 14px; }
.hist-meta { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

/* recent claims mini-rows on workbench */
.mini-claim { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.mini-claim:first-child { border-top: 0; }
.mini-claim:hover .mc-num { text-decoration: underline; }
.mini-claim .mc-num { font-family: var(--font-mono); font-size: 13px; color: var(--petrol-700); flex: none; }
.mini-claim .mc-name { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-claim .mc-time { font-size: 12px; color: var(--ink-3); flex: none; }

/* ============================================================
   v4 — payments, related claims, email-in code
   ============================================================ */

.tabs { flex-wrap: wrap; }

/* Email-in code chip */
.fcode {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 8px; font-size: 12px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 6px 4px 11px;
}
.fcode .mono { color: var(--petrol-700); font-weight: 500; }
.fcode-copy {
  border: 0; background: var(--petrol-tint); color: var(--petrol-700); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 11px;
  border-radius: 999px; padding: 3px 9px;
}
.fcode-copy:hover { background: #d3e7e7; }

/* Client live-claims badge on list cards */
.live-badge {
  display: inline-block; vertical-align: 1px; margin-left: 6px;
  font-family: var(--font-display); font-weight: 700; font-size: 10.5px;
  color: var(--petrol-700); background: var(--petrol-tint);
  border-radius: 999px; padding: 1px 7px;
}

/* Related claims strip */
.rel-section {
  margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 12px;
}
.rel-label { font-size: 12.5px; color: var(--ink-2); margin-right: 2px; }
.rel-label strong { color: var(--petrol-700); }
.rel-none { font-size: 12.5px; color: var(--ink-3); }
.rel-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; font-size: 12.5px;
}
.rel-chip:hover { border-color: var(--petrol); }
.rel-chip .rel-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.rel-chip.live .mono { color: var(--petrol-700); font-weight: 500; }
.rel-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 11px; padding: 0 0 0 2px; }
.rel-x:hover { color: var(--danger); }
.rel-section .btn { margin-left: auto; }

/* Payments */
.pay-total {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #3a7350;
  border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px;
}
.pay-figure { font-family: var(--font-display); font-weight: 700; font-size: 26px; color: #2c5940; }
.pay-count { font-size: 12.5px; color: var(--ink-3); }
.pay-composer {
  display: grid; grid-template-columns: 150px 150px 1fr auto; gap: 8px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r);
  padding: 10px; margin-bottom: 12px; align-items: center;
}
@media (max-width: 820px) { .pay-composer { grid-template-columns: 1fr 1fr; } }
.file-icon.pay { color: #3a7350; background: #e6f1e9; }
.stat-card.pay-card .sc-num { font-size: 19px; color: #2c5940; }
