/* CSS Order Intake — reference-data screens. Loaded alongside application.css,
   which owns the top bar, flashes, and the palette these build on. */

:root {
  --ref-accent: #0f766e;
  --ref-attention: #d97706;
  --ref-attention-bg: #fffbeb;
}

/* ---- Shell: fixed left nav, scrolling content -------------------------- */
.ref-shell { display: flex; align-items: flex-start; gap: 24px; padding: 20px 22px; }
.ref-nav { flex: 0 0 168px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 20px; }
.ref-main { flex: 1 1 auto; min-width: 0; max-width: 1000px; }

.ref-navlink {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 11px; border-radius: 7px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); text-decoration: none;
}
.ref-navlink:hover { background: #e2e8f0; color: var(--ink); }
.ref-navlink.current { background: var(--ink); color: #fff; }
.ref-badge {
  background: var(--ref-attention); color: #fff; border-radius: 10px;
  padding: 1px 7px; font-size: 11px; font-weight: 700;
}

/* ---- Page furniture ---------------------------------------------------- */
.ref-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.ref-head h1 { margin: 0; font-size: 21px; letter-spacing: -.2px; }
.ref-headactions { display: flex; align-items: center; gap: 8px; }
.ref-lede { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; max-width: 68ch; }
.ref-note { margin: 0 0 12px; color: var(--muted); font-size: 13px; max-width: 72ch; }
.ref-note-attention {
  background: var(--ref-attention-bg); color: #92400e; border-left: 3px solid var(--ref-attention);
  padding: 8px 12px; border-radius: 0 6px 6px 0;
}
.ref-blank { color: var(--muted); font-style: italic; padding: 14px 0; }

/* ---- Toolbar: search + filters ----------------------------------------- */
.ref-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 12px;
}
.ref-search { display: flex; align-items: center; gap: 7px; }
.ref-filters { display: flex; align-items: center; gap: 4px; }
.ref-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); text-decoration: none; border: 1px solid transparent;
}
.ref-filter:hover { background: #e2e8f0; color: var(--ink); }
.ref-filter.current { background: var(--panel); border-color: var(--line); color: var(--ink); }
.ref-filter-count { color: var(--muted); font-weight: 500; }

/* ---- Controls ---------------------------------------------------------- */
.ref-input {
  width: 100%; padding: 7px 10px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 7px;
}
.ref-input:focus { outline: 2px solid var(--ref-accent); outline-offset: -1px; border-color: var(--ref-accent); }
.ref-input-sm { width: 140px; }
.ref-search .ref-input { width: 260px; }

.ref-btn, .ref-btn button {
  display: inline-block; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 7px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.ref-btn:hover, .ref-btn button:hover { border-color: #94a3b8; }
.ref-btn-primary, .ref-btn-primary button { background: var(--ink); border-color: var(--ink); color: #fff; }
.ref-btn-primary:hover, .ref-btn-primary button:hover { background: #1e293b; border-color: #1e293b; }
.ref-btn-quiet, .ref-btn-quiet button { color: var(--muted); background: transparent; }
.ref-btn-quiet:hover, .ref-btn-quiet button:hover { color: var(--ink); }
/* button_to wraps its button in a block-level form, which would stack the row's
   actions vertically. The class lands on the button, so target the form itself. */
.ref-btn { margin: 0; }
.ref-actions form, .ref-headactions form, .ref-panel-head form, .ref-formactions form { display: inline-block; }

/* ---- Tables ------------------------------------------------------------ */
.ref-table {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 9px; overflow: hidden; font-size: 13.5px;
}
.ref-table th {
  text-align: left; padding: 9px 12px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
  background: #f8fafc; border-bottom: 1px solid var(--line);
}
.ref-table td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.ref-table tbody tr:first-child td { border-top: 0; }
.ref-table tbody tr:hover { background: #f8fafc; }
.ref-strong { font-weight: 600; }
/* application.css leaves links inherited-and-underlined; a table of them reads as
   noise, so the underline waits for a hover. */
.ref-table a { text-decoration: none; }
.ref-table a:hover { text-decoration: underline; }
.ref-key { color: var(--muted); width: 150px; }
.ref-arrow { color: var(--muted); width: 20px; text-align: center; }
.ref-empty { color: #cbd5e1; }
.ref-provenance { color: var(--muted); font-size: 12.5px; }
.ref-actions { text-align: right; white-space: nowrap; }
.ref-actions > * { margin-left: 5px; }
.ref-row-inactive .ref-strong { color: var(--muted); }

/* ---- Pills ------------------------------------------------------------- */
.ref-pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
  background: #e2e8f0; color: var(--muted);
}
.ref-pill-approved { background: #dcfce7; color: #14532d; }
.ref-pill-pending  { background: #fef3c7; color: #92400e; }
.ref-pill-rejected { background: #fee2e2; color: #7f1d1d; }
.ref-pill-inactive { background: #e2e8f0; color: var(--muted); margin-left: 8px; }
.ref-pill-linked { background: #e0e7ff; color: #3730a3; }

/* A consequence worth reading before you save, not an error. */
.ref-warning {
  background: var(--ref-attention-bg); color: #92400e; border: 1px solid #fcd34d;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; line-height: 1.5;
}

/* ---- Panels ------------------------------------------------------------ */
.ref-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px;
}
.ref-panel h2 { margin: 0 0 4px; font-size: 15px; }
.ref-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ref-panel-attention { border-color: #fcd34d; background: var(--ref-attention-bg); }
.ref-panel .ref-table { border: 0; border-radius: 0; background: transparent; }
.ref-panel .ref-table tbody tr:hover { background: transparent; }

/* ---- Overview cards ---------------------------------------------------- */
.ref-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ref-card {
  display: flex; flex-direction: column; gap: 2px; padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: inherit;
}
.ref-card:hover { border-color: #94a3b8; }
.ref-card-count { font-size: 26px; font-weight: 700; letter-spacing: -.6px; }
.ref-card-label { font-size: 13.5px; font-weight: 600; }
.ref-card-note { color: var(--muted); font-size: 12px; line-height: 1.4; }
.ref-card-quiet { background: #f8fafc; }
.ref-card-quiet .ref-card-count { color: var(--muted); }

/* ---- Forms ------------------------------------------------------------- */
.ref-form {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; max-width: 640px;
}
.ref-field { margin-bottom: 16px; }
.ref-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.ref-hint { margin: 0 0 6px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.ref-field-check { display: flex; align-items: center; gap: 8px; }
.ref-field-check label { margin: 0; }
.ref-field-check input { margin: 0; }
.ref-field-inline { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ref-field-inline label { flex: 0 0 130px; margin: 0; }
.ref-field-inline .ref-input { flex: 1 1 auto; }
.ref-field-inline .ref-provenance { flex: 0 0 auto; }
.ref-fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 0 0 16px; }
.ref-fieldset legend { padding: 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.ref-formactions { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.ref-errors {
  background: #fee2e2; color: #7f1d1d; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
}
.ref-errors p { margin: 0 0 4px; font-weight: 600; }
.ref-errors ul { margin: 0; padding-left: 18px; }

/* ---- Pager ------------------------------------------------------------- */
.ref-pager { display: flex; align-items: center; gap: 12px; padding: 14px 2px; }
.ref-pager-count { color: var(--muted); font-size: 12.5px; }

/* ---- Read-only vocabulary chips ---------------------------------------- */
.ref-chips { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; margin: 0; padding: 0; }
.ref-chip {
  padding: 5px 11px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px;
}
