/* Patent Data Verification — interface styles.
   Design language taken from ProsecutionIQ: navy and brass on parchment, serif
   display type, status as badges rather than plain text. Structural tokens vary
   per theme; the semantic status tokens deliberately do not, so a warning means
   the same thing whichever theme is on. */

:root {
  color-scheme: light;
  --ink: #1a2332;
  --ink-2: #3d4a5c;
  --ink-3: #6b7787;
  --line: #e2e0d9;
  --line-2: #d0cdc2;
  --surface: #f7f5ef;
  --card: #ffffff;
  --brass: #a67c3d;
  --brass-hi: #c19652;
  --brass-soft: #f2ead9;
  --navy: #243447;
  --navy-2: #2e4157;
  --shadow: 0 1px 2px rgba(26, 35, 50, 0.06), 0 4px 16px rgba(26, 35, 50, 0.06);
  --shadow-lg: 0 8px 40px rgba(26, 35, 50, 0.14);

  --ok: #3f7d5c;   --ok-soft: #e6f0ea;
  --warn: #b0742a; --warn-soft: #f7ecdb;
  --err: #a8433a;  --err-soft: #f6e4e2;

  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 236px;
}

:root[data-theme="midnight"] {
  color-scheme: dark;
  --ink: #eef1f5;
  --ink-2: #b7c1cd;
  --ink-3: #7c8998;
  --line: #2a3441;
  --line-2: #3a4553;
  --surface: #10151b;
  --card: #1a222c;
  --brass: #d1a355;
  --brass-hi: #e2b876;
  --brass-soft: #33291a;
  --navy: #0b0f14;
  --navy-2: #171f28;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  zoom: 90%;
}

h1, h2, h3, h4 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}
h4 { font-size: 15px; color: var(--ink-2); }
p { margin: 0 0 0.75em; }
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-hi); }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.muted { color: var(--ink-3); }
code { font-family: "IBM Plex Mono", monospace; font-size: .88em;
       background: var(--surface); padding: 1px 5px; border-radius: 4px; }

.eyebrow {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brass);
}

/* ------------------------------------------------------------------- shell */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--navy); color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
}
.sidebar .brand {
  padding: 22px 22px 18px;
  display: flex; align-items: center; gap: 11px;
  font-family: "Fraunces", Georgia, serif; font-size: 18px; font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}
.sidebar .brand:hover { color: #fff; }
.sidebar .glyph {
  width: 30px; height: 30px;
  border: 1.5px solid var(--brass-hi); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brass-hi); font-size: 15px; flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: 16px 12px; margin: 0; list-style: none;
               display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px; font-weight: 500; transition: 0.12s;
}
.sidebar-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar-link.active { background: var(--brass); color: #fff; }
.sidebar-link .ico { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sidebar .userbox { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08);
                    font-size: 13px; }
.sidebar .userbox .uname { color: #fff; font-weight: 600; }
.sidebar .userbox .urole { color: rgba(255,255,255,.45); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }

.app-main { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh;
            display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 34px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar-glyph {
  width: 34px; height: 34px; flex-shrink: 0; margin-right: 14px;
  border-radius: 8px; background: var(--brass-soft); color: var(--brass);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.app-content { padding: 34px; flex: 1; max-width: 1100px; width: 100%; min-width: 0; }
@media (max-width: 1440px) { .app-content { max-width: none; } }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .app-main { margin-left: 0; }
  .app-content, .topbar { padding-left: 18px; padding-right: 18px; }
}

/* ----------------------------------------------------------------- section */

.review-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  margin-bottom: 20px;
}
.review-section > h2:first-child,
.review-section > h3:first-child { margin-top: 0; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between;
                gap: 16px; margin-bottom: 14px; }
.section-head h2 { margin: 0; }

.dash-hero {
  background: linear-gradient(135deg, var(--navy), #1a2332);
  border-radius: var(--radius);
  padding: 32px 38px; color: #fff; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.dash-hero .eyebrow { color: var(--brass-hi); }
.dash-hero h2 { font-size: 28px; margin: 10px 0 8px; }
.dash-hero p { color: rgba(255, 255, 255, 0.72); max-width: 560px; margin: 0; }
.dash-hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px;
  border: 1px solid rgba(193, 150, 82, 0.14); border-radius: 50%;
}

/* ----------------------------------------------------------------- buttons */

.btn, button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy); color: #fff; border: none;
  padding: 11px 22px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  transition: 0.15s; white-space: nowrap; cursor: pointer;
}
.btn:hover, button[type="submit"]:hover { background: var(--navy-2); color: #fff; }
.btn.brass { background: var(--brass); }
.btn.brass:hover { background: var(--brass-hi); }
.btn.ghost { background: transparent; color: var(--ink-2);
             border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--card); border-color: var(--ink-3); color: var(--ink); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link-button {
  background: none; border: none; color: var(--brass); cursor: pointer;
  padding: 4px 0; font: inherit; font-size: 14px; font-weight: 600;
}
.link-button:hover { color: var(--brass-hi); }

.danger-button {
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600;
  transition: 0.15s; cursor: pointer;
}
.danger-button:hover, .danger-button:focus-visible {
  background: var(--err-soft); border-color: var(--err); color: var(--err);
}

/* ------------------------------------------------------------------ inputs */

input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--card); transition: 0.15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-soft);
}
label { display: block; font-size: 12.5px; font-weight: 600;
        color: var(--ink-2); margin-bottom: 6px; }
.field small { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
select {
  appearance: none; padding-right: 38px; cursor: pointer;
  background-repeat: no-repeat; background-position: right 13px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7' fill='none'%3E%3Cpath d='M1 1L5.5 5.5L10 1' stroke='%236b7787' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
           gap: 16px; margin: 18px 0; }

/* -------------------------------------------------------------- drop zone */

.upload-card {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--card);
  padding: 26px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; transition: 0.15s; cursor: pointer;
}
.upload-card.dropzone { border-color: var(--brass); background: var(--brass-soft); }
.upload-card.drag-active, .upload-card:hover {
  border-color: var(--brass); border-style: solid; background: var(--brass-soft);
}
.upload-card.ready { border-style: solid; border-color: var(--brass);
                     box-shadow: var(--shadow); background: var(--card); }
.upload-card-title { font-weight: 600; font-size: 14px; }
.upload-card-title::before { content: "\2193  "; color: var(--brass); }
.upload-card-placeholder { font-size: 13px; color: var(--ink-3); margin: 0; }
.upload-card-file {
  display: flex; flex-direction: column; gap: 4px; width: 100%;
  font-size: 13px; background: var(--surface);
  border-radius: var(--radius-sm); padding: 8px 10px; text-align: left;
}
.upload-card-file-name { font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-card-file-size { color: var(--ink-3); font-size: 12px; }

/* ------------------------------------------------------------- step rail */

.step-rail { display: flex; align-items: flex-start; list-style: none;
             margin: 0 0 26px; padding: 0; }
.step-rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  flex: 1; position: relative; text-align: center;
}
.step-rail-item:not(:first-child)::before {
  content: ""; position: absolute; top: 15px; right: 50%;
  width: 100%; height: 2px; background: var(--line-2); z-index: 0;
}
.step-rail-item.step-rail-done:not(:first-child)::before { background: var(--brass); }
.step-rail-marker {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--card); border: 2px solid var(--line-2); color: var(--ink-3);
  position: relative; z-index: 1; flex-shrink: 0;
}
.step-rail-active .step-rail-marker { border-color: var(--brass);
  background: var(--brass); color: #fff; }
.step-rail-done .step-rail-marker { border-color: var(--brass);
  background: var(--card); color: var(--brass); }
.step-rail-label { font-size: 12.5px; font-weight: 600; color: var(--ink-3);
                   max-width: 150px; }
.step-rail-active .step-rail-label { color: var(--ink); }
.step-rail-done .step-rail-label { color: var(--ink-2); }

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

.status-badge {
  display: inline-flex; align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  padding: 3px 10px; border-radius: 20px; line-height: 1.6;
}
.status-badge-success { background: var(--ok-soft); color: var(--ok); }
.status-badge-warning { background: var(--warn-soft); color: var(--warn); }
.status-badge-error   { background: var(--err-soft); color: var(--err); }
.status-badge-neutral { background: var(--surface); color: var(--ink-3);
                        border: 1px solid var(--line-2); }

/* ------------------------------------------------------------ stat tiles */

.stat-tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px; margin: 16px 0 20px;
}
.stat-tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 18px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--line-2);
}
.stat-tile-value {
  font-family: "Fraunces", Georgia, serif;
  font-size: 28px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-tile-label { font-size: 12px; font-weight: 600; color: var(--ink-3);
                   text-transform: uppercase; letter-spacing: 0.04em; }
.stat-tile-success { border-top-color: var(--ok); }
.stat-tile-success .stat-tile-value { color: var(--ok); }
.stat-tile-warning { border-top-color: var(--warn); }
.stat-tile-warning .stat-tile-value { color: var(--warn); }
.stat-tile-error { border-top-color: var(--err); }
.stat-tile-error .stat-tile-value { color: var(--err); }

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

.progress-status { font-size: 13.5px; color: var(--ink-2); margin: 0; }
.progress-count { font-family: "IBM Plex Mono", monospace; font-size: 12.5px;
                  color: var(--ink-3); }
.progress-line { display: flex; align-items: baseline; justify-content: space-between;
                 gap: 16px; margin-bottom: 10px; }
.progress-track { height: 6px; border-radius: 20px; background: var(--surface);
                  border: 1px solid var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--brass);
                 border-radius: 20px; transition: width .4s ease; }

.log-panel { margin-top: 20px; }
.log-panel summary { cursor: pointer; font-size: 13px; font-weight: 600;
                     color: var(--ink-2); }
.log-panel pre {
  margin: 12px 0 0; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: "IBM Plex Mono", monospace; font-size: 12px; line-height: 1.7;
  color: var(--ink-3); max-height: 280px; overflow: auto; white-space: pre-wrap;
}

/* ---------------------------------------------------------------- tables */

table {
  width: 100%; border-collapse: collapse; margin-bottom: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
th, td { text-align: left; padding: 10px 16px;
         border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: var(--surface); font-weight: 600; color: var(--ink-2);
     font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface); }
.empty { padding: 30px 20px; text-align: center; color: var(--ink-3);
         font-size: 13.5px; }

/* ---------------------------------------------------------------- alerts */

div[role="alert"] {
  background: var(--err-soft); border: 1px solid var(--err);
  border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px;
  color: var(--ink-2); font-size: 13.5px;
}
.notice {
  background: var(--brass-soft); border: 1px solid var(--brass-hi);
  border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 13.5px;
}
.notice .label { display: block; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass);
  margin-bottom: 2px; }
.notice a { font-family: "IBM Plex Mono", monospace; font-size: 13px;
            word-break: break-all; }

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

.login-wrap { min-height: 100vh; display: grid;
              grid-template-columns: 1.1fr 1fr; }
.login-hero {
  background: linear-gradient(135deg, var(--navy), #1a2332);
  color: #fff; padding: 56px 54px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.login-hero::after {
  content: ""; position: absolute; right: -80px; bottom: -80px;
  width: 300px; height: 300px;
  border: 1px solid rgba(193, 150, 82, 0.14); border-radius: 50%;
}
.brandmark { display: flex; align-items: center; gap: 12px;
  font-family: "Fraunces", Georgia, serif; font-size: 22px; font-weight: 600;
  margin-bottom: 40px; }
.brandmark .glyph {
  width: 34px; height: 34px;
  border: 1.5px solid var(--brass-hi); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brass-hi); font-size: 17px; flex-shrink: 0;
}
.login-hero h1 { font-size: 40px; line-height: 1.1; margin-bottom: 16px; }
.login-hero p { color: rgba(255,255,255,.72); max-width: 420px; }
.login-foot { margin-top: auto; padding-top: 40px;
  color: rgba(255,255,255,.4); font-size: 12.5px; }
.login-panel { display: flex; align-items: center; justify-content: center;
               padding: 40px; background: var(--surface); }
.login-form { width: min(360px, 100%); }
.login-form h2 { font-size: 24px; }
.login-form .btn { width: 100%; margin-top: 16px; }
.login-form input { font-family: "IBM Plex Mono", monospace; }
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 40px 28px; }
  .login-hero h1 { font-size: 30px; }
}
