/* ==========================================================================
   Legal Information System — Design Tokens & Components
   Palette: institutional navy + cool-parchment background + seal gold.
   Signature element: the "clearance seal" — a stamped ring badge marking
   an employee record CLEARED, echoing an actual office clearance stamp.
   Records with open cases get a corner flag instead of a seal.
   ========================================================================== */

:root {
  --navy-900: #14213A;
  --navy-700: #1C2D4A;
  --navy-500: #34496E;
  --slate-600: #47566B;
  --slate-400: #7A8898;
  --bg: #F1F4F7;
  --surface: #FFFFFF;
  --border: #D7DEE6;
  --gold-700: #8C6D22;
  --gold-500: #A9842A;
  --gold-100: #F2E9D2;
  --red-700: #7E2E27;
  --red-500: #A23B33;
  --red-100: #F5E1DE;
  --green-700: #235339;
  --green-500: #2F6F4E;
  --green-100: #DEEBE2;

  --font-display: "Source Serif 4", "Georgia", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", monospace;

  --radius: 6px;
  --shadow-card: 0 1px 2px rgba(20, 33, 58, 0.06), 0 1px 8px rgba(20, 33, 58, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--navy-900);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  color: var(--navy-900);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 .4em;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }

a { color: var(--navy-500); }
a:hover { color: var(--navy-900); }

.mono { font-family: var(--font-mono); font-size: .9em; letter-spacing: .01em; }

.top-bar {
  background: var(--navy-900);
  color: #EDEFF2;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  border-bottom: 3px solid var(--gold-500);
}

.top-bar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: .01em;
  color: #F4F6F8;
  text-decoration: none;
}

.brand .seal-mark {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--gold-500);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .8rem;
  color: var(--gold-500);
}

.top-bar nav a {
  color: #C9D0DA;
  text-decoration: none;
  margin-left: 20px;
  font-size: .9rem;
}
.top-bar nav a:hover { color: #fff; }

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.flash {
  background: var(--green-100);
  border: 1px solid var(--green-500);
  color: var(--green-700);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .92rem;
}

.errors {
  background: var(--red-100);
  border: 1px solid var(--red-500);
  color: var(--red-700);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .92rem;
}
.errors ul { margin: 4px 0 0; padding-left: 18px; }

.search-hero {
  background: var(--navy-900);
  border-radius: 10px;
  padding: 40px 36px;
  margin-bottom: 28px;
  color: #EDEFF2;
  position: relative;
  overflow: hidden;
}
.search-hero::after {
  content: "";
  position: absolute;
  right: -60px; top: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 3px solid rgba(169,132,42,0.35);
}
.search-hero h1 {
  color: #fff;
  font-size: 1.6rem;
  margin-bottom: 6px;
}
.search-hero p {
  color: #B9C2CE;
  margin: 0 0 20px;
  font-size: .92rem;
}
.search-form {
  display: flex;
  gap: 10px;
  max-width: 520px;
  position: relative;
  z-index: 1;
}
.search-form input[type=text] {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-family: var(--font-body);
  margin-bottom: 0;
}
.search-form button {
  background: var(--gold-500);
  color: var(--navy-900);
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  font-size: .95rem;
}
.search-form button:hover { background: var(--gold-700); color: #fff; }

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

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
th {
  color: var(--slate-600);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFC; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.badge-cleared { background: var(--green-100); color: var(--green-700); }
.badge-open { background: var(--red-100); color: var(--red-700); }
.badge-neutral { background: #ECEFF3; color: var(--slate-600); }

.seal {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2.5px solid var(--gold-500);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-700);
  font-family: var(--font-display);
  font-size: 1.4rem;
  flex-shrink: 0;
  position: relative;
}
.seal::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--gold-500);
  border-radius: 50%;
  opacity: .5;
}

.flag {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2.5px solid var(--red-500);
  display: flex; align-items: center; justify-content: center;
  color: var(--red-700);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}

.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn-primary { background: var(--navy-700); color: #fff; }
.btn-primary:hover { background: var(--navy-900); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--navy-700); }
.btn-outline:hover { border-color: var(--navy-500); }
.btn-danger { background: transparent; border-color: var(--red-500); color: var(--red-700); }
.btn-danger:hover { background: var(--red-500); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }

label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 5px;
}
input[type=text], input[type=password], input[type=date], input[type=file], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .92rem;
  margin-bottom: 16px;
  background: #fff;
}
textarea { resize: vertical; min-height: 80px; }

/* Consistent focus ring instead of each browser's default outline */
input[type=text]:focus, input[type=password]:focus, input[type=date]:focus,
input[type=file]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(52, 73, 110, 0.15);
}

/* Neutralize Chrome/Edge's blue-yellow autofill highlight so autofilled
   fields match the rest of the form instead of standing out */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: var(--navy-900);
  transition: background-color 5000s ease-in-out 0s;
}

.field-error { color: var(--red-700); font-size: .8rem; margin-top: -12px; margin-bottom: 14px; }

.doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.doc-row:last-child { border-bottom: none; }
.doc-type {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--slate-600);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--slate-400);
}

.meta {
  color: var(--slate-400);
  font-size: .82rem;
}

/* --- Auth pages (login/register) — split panel --- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.auth-card {
  display: flex;
  width: 100%;
  max-width: 880px;
  min-height: 520px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(20,33,58,0.08), 0 12px 32px rgba(20,33,58,0.10);
  background: var(--surface);
}

.auth-panel-brand {
  flex: 1 1 42%;
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--navy-500) 100%);
  color: #EDEFF2;
  padding: 44px 38px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-panel-brand::before {
  content: "";
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  border: 2px solid rgba(169,132,42,0.35);
  right: -120px; top: -100px;
}
.auth-panel-brand::after {
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 2px solid rgba(169,132,42,0.22);
  left: -90px; bottom: -80px;
}

.auth-seal {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2.5px solid var(--gold-500);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--gold-500);
  position: relative;
  z-index: 1;
  background: rgba(20,33,58,0.4);
}
.auth-seal::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--gold-500);
  border-radius: 50%;
  opacity: .5;
}

.auth-panel-brand h2 {
  color: #fff;
  font-size: 1.5rem;
  margin: 20px 0 8px;
  position: relative;
  z-index: 1;
}
.auth-panel-brand p {
  color: #B9C2CE;
  font-size: .92rem;
  line-height: 1.6;
  position: relative;
  z-index: 1;
  max-width: 30ch;
}
.auth-office-tag {
  position: relative;
  z-index: 1;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold-500);
  font-weight: 600;
}

.auth-panel-form {
  flex: 1 1 58%;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-panel-form h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.auth-panel-form .auth-subtitle {
  color: var(--slate-600);
  font-size: .9rem;
  margin-bottom: 26px;
}

.auth-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: .88rem;
}
.auth-remember-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--slate-600);
  margin-bottom: 0;
}
.auth-remember-row input[type=checkbox] {
  width: auto;
  margin: 0;
}

.btn-block { width: 100%; text-align: center; padding: 11px 18px; }

@media (max-width: 720px) {
  .auth-card { flex-direction: column; min-height: 0; }
  .auth-panel-brand { padding: 32px; }
}

.auth-seal img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  padding: 4px;
}