/* Design pass with unslop by Damir Sokolovsky (@heydamir), CC BY 4.0 (.claude/skills/unslop).
   Direction: calm, exact, a little warm. Status tags drawn like a parcel stamp.
   Brand palette chosen by the owner (7 November 2026), "Midnight Opulence":
   #1a1a2e page, #16213e cards, #0f3460 raised surfaces, #efc07b gold accent. */
:root {
  color-scheme: dark;
  --bg: #1a1a2e;
  --card: #16213e;
  --raised: #0f3460;
  --text: #f2ede4;
  --text-2: #c9c6d3;
  --muted: #a3a2b8;
  --hairline: rgba(242, 237, 228, 0.12);
  --field: #6e7aa0;
  --accent: #efc07b;
  --accent-hover: #f5d39f;
  --accent-ink: #efc07b;
  --on-accent: #1a1a2e;
  --error: #ff9b8f;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* Kept for older rules and scripts that read them. */
  --ink: var(--text);
  --line: var(--hairline);
}
/* Brand typeface "BC Arabic" for both languages (owner-licensed; see docs/BRAND_FONT.md).
   Regular serves 400; Bold serves 500 and heavier, which the interface uses for emphasis. */
@font-face {
  font-family: "BC Arabic";
  src: url("fonts/BCArabic-Regular.woff2") format("woff2");
  font-weight: 100 499;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "BC Arabic";
  src: url("fonts/BCArabic-Bold.woff2") format("woff2");
  font-weight: 500 900;
  font-style: normal;
  font-display: swap;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/22px "BC Arabic", system-ui, "Segoe UI", "Noto Sans Arabic", "Noto Sans", Tahoma, sans-serif;
  font-variant-numeric: tabular-nums;
}
main {
  max-width: 1080px;
  margin: auto;
  padding: 24px;
}
header {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding-block: 8px 8px;
}
h1,
h2,
h3,
h4 {
  font-weight: 500;
  margin-block: 0 12px;
}
h1 {
  font-size: 28px;
  line-height: 36px;
  margin: 0;
}
/* Brand lockup: the Amana sealed-parcel mark, the Arabic name and the Latin name. */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* Drawn as a background, not an <img>: pages and tests treat every <img> as private evidence. */
.brand-mark {
  display: block;
  flex: none;
  width: 36px;
  height: 36px;
  background: url("logo.svg") center / contain no-repeat;
}
.brand-small .brand-mark {
  width: 28px;
  height: 28px;
}
.brand-latin {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-2);
}
.brand-small {
  margin: 0 0 8px;
  gap: 8px;
  font-size: 18px;
  line-height: 28px;
  font-weight: 500;
}
.brand-small .brand-latin {
  font-size: 15px;
}
h2 {
  font-size: 20px;
  line-height: 28px;
}
h3 {
  font-size: 17px;
  line-height: 24px;
}
h4 {
  font-size: 15px;
  line-height: 22px;
}
p {
  margin-block: 0 8px;
}
/* Top-level blocks are cards; order cards inside a block are lighter inner cards;
   anything nested deeper is a flat group divided by a hairline, not another box. */
section,
article {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 24px;
  margin-block: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
section article {
  border-radius: 8px;
  padding: 16px;
  margin-block: 12px;
  box-shadow: none;
}
section section,
article section,
article article {
  background: transparent;
  border: 0;
  border-block-start: 1px solid var(--hairline);
  border-radius: 0;
  box-shadow: none;
  padding: 16px 0 0;
  margin-block: 16px 0;
}
.notice {
  background: #1d2440;
  border-color: rgba(239, 192, 123, 0.2);
  border-inline-start: 3px solid var(--accent);
  color: var(--text-2);
  padding: 16px 20px;
  box-shadow: none;
}
label {
  display: block;
  margin-block: 12px;
  color: var(--text);
}
input,
textarea,
button,
select {
  font: inherit;
  border-radius: 8px;
}
input,
textarea,
select {
  border: 1px solid var(--field);
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  min-height: 40px;
  margin-block-start: 4px;
}
input,
textarea {
  width: 100%;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  margin: 0;
  margin-inline: 8px;
  vertical-align: -2px;
  accent-color: var(--accent);
}
textarea {
  min-height: 80px;
}
button {
  min-height: 36px;
  padding: 6px 16px;
  margin-block: 4px;
  margin-inline-end: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
select + button,
input + button {
  margin-inline-start: 8px;
}
button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button:active {
  transform: scale(0.98);
}
/* Actions that load, reload or open something are secondary; form submissions stay primary. */
button[type="button"],
button.secondary {
  background: var(--raised);
  border-color: var(--hairline);
  color: var(--text);
}
button[type="button"]:hover,
button.secondary:hover {
  background: #154479;
  border-color: rgba(242, 237, 228, 0.2);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
:focus-visible {
  outline: 3px solid #f5d39f;
  outline-offset: 2px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
details {
  padding-block: 4px;
  border-block-start: 1px solid var(--hairline);
}
details:first-of-type {
  border-block-start: 0;
}
summary {
  display: list-item;
  min-height: 36px;
  padding-block: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  transition: color 150ms var(--ease);
}
summary:hover {
  color: var(--accent-ink);
}
details[open] > summary {
  margin-block-end: 8px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 13px/20px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
#status {
  min-height: 32px;
  color: var(--text-2);
}
#status.error {
  color: var(--error);
}
.muted,
small {
  color: var(--muted);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: start;
  border-block-end: 1px solid var(--hairline);
  padding: 8px;
}
th {
  font-weight: 500;
  color: var(--text-2);
}
a {
  color: var(--accent-ink);
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}
.hidden,
[hidden] {
  display: none !important;
}
code {
  overflow-wrap: anywhere;
  font: 13px/20px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--raised);
  border-radius: 4px;
  padding: 0 4px;
}
/* Signature: status tags drawn like a parcel stamp, an ink line with an inner ring. */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--accent-ink);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 3px rgba(239, 192, 123, 0.4);
  color: var(--accent-ink);
  background: transparent;
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
/* Overview: stat cards are numbers only; the attention list reuses the stamp tags. */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-block: 0 20px;
}
@media (max-width: 700px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.stat {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 12px 16px;
}
.stat[data-stat="orders"] {
  grid-column: span 2;
}
.stat-label {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
}
.stat-figure {
  margin: 0;
  font-size: 28px;
  line-height: 32px;
  font-weight: 500;
}
.stat[data-stat="deadline_refund_required"][data-nonzero] .stat-figure,
.stat[data-stat="open_cases"][data-nonzero] .stat-figure {
  color: var(--accent);
}
.attention {
  list-style: none;
  margin: 0;
  padding: 0;
}
.attention li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding-block: 6px;
  border-block-end: 1px solid var(--hairline);
}
.attention-name {
  font-weight: 500;
  margin-inline-end: 4px;
}
dl {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4px 16px;
  margin-block: 0 12px;
}
dt {
  color: var(--text-2);
}
dd {
  margin: 0;
}
@media (max-width: 500px) {
  main {
    padding: 16px;
  }
  section,
  article {
    padding: 16px;
  }
  header {
    align-items: flex-start;
  }
  dl {
    grid-template-columns: 1fr;
  }
  header h1 {
    font-size: 22px;
    line-height: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
  button:active {
    transform: none;
  }
}

.evidence-preview img {
  max-width: 100%;
  max-height: 480px;
}

.pdf-mask-value {
  display: block;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Keep explicit reviewer assignment choices and IDs usable on narrow screens. */
[data-purpose="hold-ownership"] select { display: block; max-width: 100%; }
[data-purpose="hold-ownership"] p { overflow-wrap: anywhere; }

#financial-review-queue p, #financial-review-queue h3 { overflow-wrap: anywhere; }
#financial-review-queue select { display: block; max-width: 100%; }
#financial-review-queue .queue-time { display: block; }

[data-purpose=allocation-preview] p { overflow-wrap: anywhere; }

[data-purpose=allocation-proposals] p, [data-purpose=proposal-save] p { overflow-wrap: anywhere; }

[data-purpose=proposal-reviews] p { overflow-wrap: anywhere; }
[data-purpose=proposal-reviews] select { display: block; max-width: 100%; }

/* Existing case context shares the narrow reviewer page with the private queue. */
#review-cases select { display: block; max-width: 100%; }
#review-cases h3, #review-cases p, #review-cases small { overflow-wrap: anywhere; }
.rating-card dl {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  gap: 4px 16px;
  margin: 0;
}
.rating-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}
#ratings-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
@media (max-width: 600px) {
  .rating-card dl {
    grid-template-columns: minmax(0, 1fr);
  }
}
.rating-card dt {
  color: var(--text-2);
}
.rating-card h2 {
  margin-block-end: 4px;
}

/* ---------- Landing page (/) ---------- */
.site-header {
  max-width: 1080px;
  margin: auto;
  padding: 16px 24px;
  flex-wrap: wrap;
}
.brand-link {
  color: var(--text);
  text-decoration: none;
  font-size: 22px;
  font-weight: 500;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}
.site-nav a {
  color: var(--text-2);
  text-decoration: none;
}
.site-nav a:hover,
.site-footer a:hover {
  color: var(--text);
}
.site-nav a.nav-cta,
.button-link {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--raised);
  color: var(--text);
  text-decoration: none;
}
.button-link.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.button-link.primary:hover {
  background: var(--accent-hover);
}
.hero {
  padding-block: 56px 40px;
  max-width: 760px;
}
.hero h1 {
  font-size: 40px;
  line-height: 52px;
  margin-block-end: 16px;
}
.hero-lead {
  font-size: 18px;
  line-height: 30px;
  color: var(--text-2);
  margin-block-end: 28px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.feature-grid article {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 20px 24px;
}
.feature-grid p {
  color: var(--text-2);
}
.site-footer {
  max-width: 1080px;
  margin: auto;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  border-top: 1px solid var(--hairline);
}
.site-footer nav {
  display: flex;
  gap: 20px;
}
.site-footer a {
  color: var(--text-2);
  text-decoration: none;
}
@media (max-width: 700px) {
  .hero {
    padding-block: 32px 24px;
  }
  .hero h1 {
    font-size: 30px;
    line-height: 40px;
  }
  .feature-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Dashboard login screen (/dashboard before sign-in) ---------- */
/* Until a key is accepted only the brand, the notice and the sign-in card are shown. */
body.signed-out main > section:not(.notice):not(.login-area) {
  display: none;
}
body.signed-out #reload,
body.signed-out #sign-out {
  display: none;
}
body.signed-out .login-area {
  max-width: 440px;
  margin: 48px auto;
  padding: 32px;
}
.login-intro {
  display: none;
}
body.signed-out .login-intro {
  display: block;
}
body.signed-out #login {
  display: grid;
  gap: 12px;
}
body.signed-out #login input,
body.signed-out #login button {
  width: 100%;
  margin: 0;
}
.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
header:has(.header-actions) {
  flex-wrap: wrap;
}
.header-actions button,
.header-actions select {
  margin: 0;
}
.back-home {
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
}
