/* ---------------------------------------------------------------------
   EB1A case review

   Design intent: this is a tool people sit in front of for hours, reading
   dense applicant records and making consequential decisions. So the
   palette is low-chroma and quiet, the type is small but generously
   leaded, and the only saturated colour in the interface is reserved for
   assessment outcomes -- where colour actually carries meaning. Anything
   else competing for attention would be noise.

   Type: IBM Plex Sans for the interface, IBM Plex Mono for case IDs and
   timestamps. Monospaced identifiers are genuinely easier to scan and
   compare down a column, which is what this screen is for.
   --------------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --ink:        #16191d;
  --ink-2:      #4a5058;
  --ink-3:      #767d86;
  --line:       #e0e3e7;
  --line-2:     #eef0f3;
  --paper:      #ffffff;
  --paper-2:    #f7f8f9;
  --paper-3:    #f0f2f4;

  /* Assessment outcomes. Deliberately desaturated -- these sit next to a
     person's name, and a vivid red beside "Not yet eligible" reads as a
     verdict rather than a preliminary screening note. */
  --strong:     #1f6f4a;
  --strong-bg:  #e8f2ec;
  --possible:   #7a5a12;
  --possible-bg:#f6efdd;
  --weak:       #8a4038;
  --weak-bg:    #f6eae8;
  --unknown:    #5b6068;
  --unknown-bg: #eff1f3;

  --focus:      #2b5f9e;
  --danger:     #9a3b32;

  --radius:     6px;
  --radius-lg:  10px;

  --shadow-sm:  0 1px 2px rgba(16,19,23,.06);
  --shadow-lg:  0 16px 48px rgba(16,19,23,.14);

  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, select { font-family: inherit; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* --- Buttons --------------------------------------------------------- */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 13px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  transition: background-color .12s ease, border-color .12s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #2b3038; }

.btn-quiet { border-color: var(--line); background: var(--paper); color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--paper-3); color: var(--ink); }

.btn-danger { color: var(--danger); border-color: var(--line); background: var(--paper); }
.btn-danger:hover:not(:disabled) { background: var(--weak-bg); }

.btn-block { width: 100%; padding: 10px; }

/* --- Fields ---------------------------------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field input, .field select, .select, .search {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--focus); }

.form-error {
  background: var(--weak-bg);
  color: var(--weak);
  border-radius: var(--radius);
  padding: 9px 11px;
  margin: 0 0 14px;
  font-size: 13px;
}

.hint { font-size: 12.5px; color: var(--ink-3); margin: 6px 0 14px; }

/* --- Sign in --------------------------------------------------------- */
.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, var(--paper-2) 0%, var(--paper-3) 100%);
}
.signin-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}
.signin-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 6px;
}
.signin-title { font-size: 22px; font-weight: 600; margin: 0 0 22px; letter-spacing: -.01em; }
.signin-note { font-size: 13px; color: var(--ink-2); margin: -12px 0 20px; }

/* --- Top bar --------------------------------------------------------- */
.topbar {
  height: 52px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.wordmark {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: .08em;
  font-size: 13px;
}
.topbar-sep { width: 1px; height: 18px; background: var(--line); }
.topbar-context { font-size: 13px; color: var(--ink-2); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.who { font-size: 12.5px; color: var(--ink-3); margin-right: 4px; }

/* --- Layout ---------------------------------------------------------- */
.main {
  display: grid;
  grid-template-columns: 208px 1fr;
  gap: 22px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 18px 48px;
}

/* --- Status rail ----------------------------------------------------- */
.rail { display: flex; flex-direction: column; gap: 1px; }
.rail-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}
.rail-item:hover { background: var(--paper-3); }
.rail-item[aria-current="true"] {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.rail-count { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.rail-item[aria-current="true"] .rail-count { color: var(--ink-2); }
.rail-divider { height: 1px; background: var(--line); margin: 7px 0; }

/* --- Toolbar --------------------------------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.search-wrap { flex: 1; min-width: 0; }
.select { width: auto; }
.result-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* --- Table ----------------------------------------------------------- */
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 14px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--paper-2); }

.table-compact thead th { padding: 8px 12px; }
.table-compact tbody td { padding: 8px 12px; font-size: 13px; }
.table-compact tbody tr { cursor: default; }

.cell-name { font-weight: 500; }
.cell-sub { font-size: 12.5px; color: var(--ink-3); }
.cell-mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }

/* --- Pills ----------------------------------------------------------- */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pill-strong   { background: var(--strong-bg);   color: var(--strong); }
.pill-possible { background: var(--possible-bg); color: var(--possible); }
.pill-weak     { background: var(--weak-bg);     color: var(--weak); }
.pill-unknown  { background: var(--unknown-bg);  color: var(--unknown); }

.status-chip {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--paper-2);
  white-space: nowrap;
}

/* Quality warning: shown when extraction was partial, because an
   assessment built on half a CV should not look as trustworthy as one
   built on all of it. */
.flag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--weak);
  border-bottom: 1px dotted currentColor;
  cursor: help;
}

/* --- Empty / loading ------------------------------------------------- */
.state {
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

/* --- Pager ----------------------------------------------------------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}
.pager-info { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* --- Drawer ---------------------------------------------------------- */
.drawer-scrim, .modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(16,19,23,.32);
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100vw;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: slide-in .16s ease-out;
}
@keyframes slide-in { from { transform: translateX(14px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.drawer-name { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.drawer-case { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin: 3px 0 0; }
.drawer-body { padding: 20px 22px 40px; overflow-y: auto; flex: 1; width: 100%; max-width: 980px; margin: 0 auto; }

.section { margin-bottom: 26px; }
.section-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-2);
}

.kv { display: grid; grid-template-columns: 128px 1fr; gap: 5px 14px; }
.kv dt { font-size: 12.5px; color: var(--ink-3); }
.kv dd { margin: 0; font-size: 13.5px; }

.criterion {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
}
.criterion:last-child { border-bottom: none; }
.criterion-mark { flex-shrink: 0; width: 16px; font-family: var(--mono); font-size: 13px; }
.criterion-mark.met { color: var(--strong); }
.criterion-mark.unmet { color: var(--ink-3); }
.criterion-body { flex: 1; min-width: 0; }
.criterion-title { font-weight: 500; font-size: 13.5px; }
.criterion-why { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.criterion-conf {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.notice {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 18px;
}
.notice-warn { border-left-color: var(--weak); background: var(--weak-bg); color: var(--weak); }

.bullets { margin: 0; padding-left: 17px; font-size: 13.5px; }
.bullets li { margin-bottom: 5px; }

.status-row { display: flex; gap: 8px; align-items: center; }
.status-row .select { flex: 1; }

/* --- Modal ----------------------------------------------------------- */
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 600; margin: 0; }
.modal-body { padding: 18px 20px 26px; overflow-y: auto; }

.add-user { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.add-user-title { font-size: 13px; font-weight: 600; margin: 0 0 14px; }
.add-user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* --- Toast ----------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 90;
  box-shadow: var(--shadow-lg);
}

/* --- Responsive ------------------------------------------------------ */
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .rail-item { width: auto; }
  .rail-divider { display: none; }
  .add-user-grid { grid-template-columns: 1fr; }
  .col-assessment { display: none; }
  .table tbody td:nth-child(5) { display: none; }
}

/* --- Assignment ------------------------------------------------------
   The avatar chip is deliberately quiet. Whose case it is matters, but it
   is reference information while scanning a queue -- it should not compete
   with the applicant's name for attention.
   -------------------------------------------------------------------- */
.assignee {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
}
.avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 1px solid var(--line);
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-2);
  flex-shrink: 0;
}
/* Own cases get a filled marker -- the one thing worth spotting instantly
   when scanning a shared queue is which rows are yours. */
.assignee-mine .avatar {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.assignee-mine { color: var(--ink); font-weight: 500; }

.unclaimed {
  font-size: 12.5px;
  color: var(--ink-3);
  font-style: italic;
}

.claim-inline {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  border-radius: var(--radius);
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
}
.claim-inline:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.assign-panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
}
.assign-current {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}
.assign-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.assign-transfer { display: flex; gap: 8px; margin-top: 11px; }
.assign-transfer .select { flex: 1; }

.history-row {
  display: flex;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 12.5px;
}
.history-row:last-child { border-bottom: none; }
.history-when {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  flex-shrink: 0;
  width: 118px;
}
.history-what { color: var(--ink-2); }

@media (max-width: 900px) {
  .table tbody td:nth-child(5) { display: none; }
}
