/* WAF Contract Rate Consolidator — dashboard visual identity.
   Dense, data-forward, low-decoration. Matches the internal ops dashboard
   palette; system fonts only, mono reserved for log/file-identifier text. */

:root {
  --navy: #1F3864;
  --blue: #2E5FA3;
  --blue-2: #3f74c0;
  --pale: #eef3fb;
  --pale-2: #d6e4f0;
  --ink: #1a2233;
  --ink-soft: #5b6c86;
  --muted: #8892a6;
  --line: #e3e8f0;
  --line-2: #eef1f6;
  --bg: #f5f7fb;
  --card: #ffffff;
  --good: #1f9d61;
  --warn: #c47f17;
  --danger: #b03b3b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20,40,80,.05), 0 6px 20px rgba(20,40,80,.06);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* supplementary tokens (not part of the given palette, needed for detail work) */
  --radius-sm: 8px;
  --pale-good: #e1f5eb;
  --pale-warn: #faf0dd;
  --pale-danger: #f8e8e8;
  --pale-muted: #eef0f4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: var(--blue); }

::selection { background: var(--pale-2); }

/* --- top bar --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(120deg, var(--navy), var(--blue));
  box-shadow: 0 2px 10px rgba(20,40,80,.18);
}
.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar-title {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-right: 12px;
}
.topbar-sub {
  color: rgba(255,255,255,.72);
  font-size: 13px;
}
.topbar-action {
  color: rgba(255,255,255,.88);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  white-space: nowrap;
}
.topbar-action:hover { background: rgba(255,255,255,.12); color: #fff; }

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

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

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.panel-title {
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.page-note {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}

/* --- form fields --- */

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field-input:focus-visible,
.field-input:focus {
  outline: none;
  border-color: var(--blue-2);
  box-shadow: 0 0 0 3px rgba(63,116,192,.16);
}
.field-input::placeholder { color: var(--muted); }

/* --- dropzone + file list --- */

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 22px 18px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .12s ease, background .12s ease;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--blue-2);
  background: var(--pale);
}
.dropzone:focus-visible {
  outline: none;
  border-color: var(--blue-2);
  box-shadow: 0 0 0 3px rgba(63,116,192,.16);
}
.dropzone-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}
.dropzone-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
}
.dropzone input[type="file"] { display: none; }

.file-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--pale);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.file-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.file-chip button {
  border: none;
  background: none;
  color: var(--blue);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}
.file-chip button:hover { text-decoration: underline; }

details.advanced { margin-top: 18px; }
details.advanced > summary {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
details.advanced .field-row { margin-top: 16px; margin-bottom: 0; }

/* --- buttons --- */

.actions { margin-top: 24px; display: flex; justify-content: center; }

.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 28px;
  cursor: pointer;
  transition: background .12s ease, transform .06s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(63,116,192,.28);
}

.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue); }
.btn-primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }

.btn-success { background: var(--good); color: #fff; display: inline-block; text-decoration: none; }
.btn-success:hover { background: #187f4e; color: #fff; }

.btn-secondary {
  background: none;
  color: var(--blue);
  padding: 11px 4px;
}
.btn-secondary:hover { text-decoration: underline; }

/* --- results --- */

#results { display: none; }
#results.visible { display: block; }

.status-line {
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.spinner {
  width: 13px; height: 13px;
  border: 2px solid var(--line);
  border-top-color: var(--blue-2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: spin 1.4s linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.banner-danger {
  background: var(--pale-danger);
  border-color: #eecccc;
  color: var(--danger);
}
.banner-title {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

.confirm-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 520px) {
  .confirm-row { grid-template-columns: 1fr; }
}
.confirm-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  background: var(--card);
}
.confirm-carrier {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
  margin: 0 0 6px;
}
.confirm-filename {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  word-break: break-word;
  margin: 0 0 10px;
  min-height: 28px;
}

/* --- status badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-good    { background: var(--pale-good);   color: var(--good); }
.badge-warn    { background: var(--pale-warn);   color: var(--warn); }
.badge-info    { background: var(--pale);        color: var(--blue); }
.badge-danger  { background: var(--pale-danger); color: var(--danger); }
.badge-muted   { background: var(--pale-muted);  color: var(--muted); }

/* --- log panel (genuinely log-like content — mono is appropriate here) --- */

.log-panel {
  background: var(--navy);
  color: #dce6f5;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  line-height: 1.55;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.download-row {
  margin-top: 4px;
  display: flex;
  justify-content: center;
}

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

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 28px;
}
.login-card .eyebrow { margin-bottom: 4px; }
.login-card .panel-title { font-size: 19px; margin-bottom: 22px; }
.login-card .btn-primary { width: 100%; margin-top: 4px; }
