/* ============================================================
   Google Fonts
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700&family=Jost:wght@300;400;500;600&display=swap');

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  --primary:        #1B3A6E;
  --primary-dark:   #0F2347;
  --primary-mid:    #2C5F8A;
  --primary-light:  #EAF0F8;
  --accent:         #B8932A;
  --accent-light:   rgba(184,147,42,.13);
  --sidebar-width:  240px;
  --radius:         7px;
  --radius-lg:      14px;
  --shadow:         0 1px 3px rgba(15,35,71,.07), 0 4px 18px rgba(15,35,71,.07);
  --shadow-lg:      0 8px 40px rgba(15,35,71,.18);
  --text:           #111927;
  --text-muted:     #64748b;
  --border:         #dde4ee;
  --bg:             #F4F7FB;
  --white:          #ffffff;
  --danger:         #b91c1c;
  --success:        #166534;
  --warn:           #92400e;
  --font-display:   'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-ui:        'Jost', system-ui, sans-serif;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--primary-dark);
  background-image:
    radial-gradient(ellipse 80% 60% at 15% 55%, rgba(44,95,138,.45) 0%, transparent 65%),
    radial-gradient(ellipse 50% 50% at 85% 15%, rgba(184,147,42,.14) 0%, transparent 55%),
    linear-gradient(150deg, #152340 0%, #070e1d 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 64px, rgba(255,255,255,.024) 64px, rgba(255,255,255,.024) 65px),
    repeating-linear-gradient(90deg, transparent, transparent 64px, rgba(255,255,255,.024) 64px, rgba(255,255,255,.024) 65px);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  border: 1px solid rgba(184,147,42,.1);
  top: -160px;
  right: -160px;
  pointer-events: none;
}

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--white);
  border-radius: 18px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.06);
  animation: cardIn .55s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo img {
  height: 60px;
  object-fit: contain;
  margin-bottom: 14px;
}
.login-logo h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: .02em;
  line-height: 1.2;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 6px;
}

.login-logo::after {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  background: var(--accent);
  margin: 14px auto 0;
  border-radius: 2px;
}

.login-footer {
  color: rgba(255,255,255,.35);
  font-size: 11px;
  letter-spacing: .06em;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 7px;
  color: var(--text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfd;
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary-mid);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(44,95,138,.12);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.error-msg {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: var(--danger);
  padding: 10px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: background .15s, box-shadow .15s, transform .1s;
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,.08) 0%, transparent 100%);
  pointer-events: none;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(15,35,71,.28);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary:where(form *) { width: 100%; margin-top: 6px; }

.login-card .btn-primary {
  background: var(--accent);
  color: #fff;
}
.login-card .btn-primary:hover {
  background: #9e7c22;
  box-shadow: 0 4px 18px rgba(184,147,42,.35);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  background: var(--white);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover {
  background: var(--bg);
  border-color: #c5cdd8;
}

.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,.22);
  color: rgba(255,255,255,.7);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  letter-spacing: .04em;
  transition: background .15s, color .15s;
}
.btn-logout:hover {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.95);
}

.link { color: var(--primary-mid); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================
   Dashboard Layout
   ============================================================ */
.dashboard-page {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #152340 0%, #0b1830 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 2px 0 24px rgba(0,0,0,.22);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(184,147,42,.2);
}
.sidebar-logo img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}
.sidebar-logo span {
  color: var(--white);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.2;
  white-space: normal;
  overflow: hidden;
}

.sidebar-logo::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 6px;
  color: rgba(255,255,255,.58);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  transition: background .15s, color .15s, border-color .15s;
  border-left: 2px solid transparent;
  position: relative;
}
.nav-item svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  opacity: .85;
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
  border-left-color: rgba(184,147,42,.4);
}
.nav-item.active {
  background: rgba(255,255,255,.1);
  color: var(--white);
  border-left-color: var(--accent);
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-email {
  color: rgba(255,255,255,.38);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: .02em;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 36px 36px 48px;
  min-height: 100vh;
}

/* ============================================================
   Tab sections
   ============================================================ */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp .3s cubic-bezier(.16,1,.3,1) both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tab-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1.5px solid var(--border);
}
.tab-header h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: .01em;
  line-height: 1;
}
.tab-header .btn-primary { margin-left: auto; align-self: center; }
.tab-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  align-self: center;
}

/* ============================================================
   Cards & Upload
   ============================================================ */
.upload-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.upload-card > p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.65;
}

.upload-zone {
  border: 2px dashed #cdd6e2;
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 16px;
  background: #fafbfd;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary-mid);
  background: var(--primary-light);
}
.upload-zone svg {
  width: 34px;
  height: 34px;
  stroke: #a0aec0;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 10px;
}
.upload-zone p { color: var(--text-muted); font-size: 13px; }

.file-name {
  background: var(--primary-light);
  border: 1.5px solid rgba(44,95,138,.3);
  color: var(--primary);
  border-radius: var(--radius);
  padding: 8px 13px;
  font-size: 13px;
  margin-bottom: 16px;
  font-weight: 500;
}

/* ============================================================
   Results Area
   ============================================================ */
.results-area {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1.5px solid var(--border);
  background: #fafbfd;
}
.results-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  color: var(--primary-dark);
  letter-spacing: .01em;
}
.results-content {
  padding: 24px;
  max-height: 600px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.75;
}

.results-content h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 20px 0 10px;
  color: var(--primary);
}
.results-content h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
}
.results-content table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.results-content th {
  background: #f5f7fa;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.results-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.results-content ul, .results-content ol { padding-left: 20px; margin: 8px 0; }
.results-content li { margin-bottom: 4px; }
.results-content strong { font-weight: 600; }
.results-content p { margin-bottom: 8px; }

/* ============================================================
   Client Grid
   ============================================================ */
.search-bar {
  margin-bottom: 22px;
}
.search-bar input {
  width: 100%;
  max-width: 380px;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: 40px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 14px center no-repeat;
  outline: none;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.search-bar input:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(44,95,138,.12);
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.client-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  border: 1.5px solid var(--border);
  position: relative;
  overflow: hidden;
}
.client-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .2s cubic-bezier(.16,1,.3,1);
  border-radius: 3px 0 0 3px;
}
.client-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: #c5cdd8;
}
.client-card:hover::before { transform: scaleY(1); }

.client-card-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--primary-dark);
  letter-spacing: .01em;
}
.client-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.client-card-docs {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 44px;
  height: 44px;
  stroke: #c5cdd8;
  fill: none;
  stroke-width: 1.5;
  margin-bottom: 16px;
}
.empty-state p { font-size: 14px; }

/* ============================================================
   History
   ============================================================ */
.history-section { margin-top: 10px; }
.history-section h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 14px;
  color: var(--text-muted);
}

.history-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
  border: 1px solid var(--border);
}
.history-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateX(3px);
}
.history-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.history-item-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--primary-mid);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.history-item-info { flex: 1; min-width: 0; }
.history-item-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.history-item-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: .04em;
}
.status-success          { background: #dcfce7; color: var(--success); }
.status-pass             { background: #dcfce7; color: var(--success); }
.status-completed        { background: #dcfce7; color: var(--success); }
.status-error            { background: #fef2f2; color: var(--danger); }
.status-pending          { background: #fef9c3; color: var(--warn); }
.status-needs_correction { background: #fff7ed; color: var(--warn); }

/* ============================================================
   Calendar
   ============================================================ */
.calendar-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-top: 20px;
  border: 1px solid var(--border);
  max-width: 460px;
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.calendar-header h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: .01em;
}
.calendar-header button {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 14px;
  color: var(--text-muted);
  transition: background .15s, border-color .15s, color .15s;
}
.calendar-header button:hover {
  background: var(--bg);
  border-color: #a0aec0;
  color: var(--text);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day-header {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 5px 0 6px;
}
.cal-day {
  height: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 12px;
  cursor: default;
  padding: 2px;
  transition: background .12s, color .12s;
}
.cal-day.has-mail {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}
.cal-day.has-mail:hover { background: var(--primary); color: var(--white); }
.cal-day.today {
  border: 2px solid var(--accent);
  color: var(--primary-dark);
  font-weight: 600;
}
.cal-day.other-month { color: #d1d8e4; }
.cal-day-count {
  font-size: 9px;
  line-height: 1;
  opacity: .8;
}

/* ============================================================
   Modal
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7,14,29,.6);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: cardIn .35s cubic-bezier(.16,1,.3,1) both;
}
.modal-header {
  display: flex;
  align-items: center;
  padding: 22px 26px;
  border-bottom: 1.5px solid var(--border);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  flex: 1;
  color: var(--primary-dark);
  letter-spacing: .01em;
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-card form {
  padding: 24px 26px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* ============================================================
   Loading spinner
   ============================================================ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Link panel (post-scan client linking)
   ============================================================ */
.link-panel {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  animation: fadeUp .25s ease both;
}
.link-panel-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--border);
}
.link-panel-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
}
.link-panel-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.link-person-list { display: flex; flex-direction: column; gap: 10px; }
.link-person-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.link-person-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}
.link-person-fullname { font-size: 13px; font-weight: 600; }
.link-person-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--border);
  padding: 2px 6px;
  border-radius: 20px;
}
.link-person-status {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.link-match-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
}
.link-match-badge--exact { background: #dcfce7; color: var(--success); }
.link-match-name { font-size: 13px; color: var(--text); }

.link-fuzzy-header { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; width: 100%; }
.link-fuzzy-footer { display: flex; gap: 8px; margin-top: 8px; width: 100%; }
.link-candidates   { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.link-candidate {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.link-candidate-name { font-weight: 600; flex: 1; }
.link-candidate-meta { color: var(--text-muted); font-size: 11px; }

.link-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
  border: none;
  white-space: nowrap;
}
.link-btn--confirm { background: var(--primary); color: #fff; }
.link-btn--confirm:hover { background: var(--primary-dark); }
.link-btn--new  { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(184,147,42,.3); }
.link-btn--new:hover { background: rgba(184,147,42,.22); }
.link-btn--skip { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.link-btn--skip:hover { background: var(--border); }

.link-no-match      { font-size: 12px; color: var(--text-muted); font-style: italic; }
.link-status-ok     { font-size: 12px; font-weight: 600; color: var(--success); }
.link-status-skipped{ font-size: 12px; color: var(--text-muted); font-style: italic; }
.link-status-error  { font-size: 12px; color: var(--danger); }

.spinner-sm {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(44,95,138,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}

/* client-card A-number chip */
.client-card-anum {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-muted);
  display: inline-block;
  margin-top: 2px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo::before { display: none; }
  .sidebar-logo span,
  .nav-item span,
  .user-email { display: none; }
  .main-content { margin-left: 60px; padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .calendar-section { max-width: 100%; }
}

/* ============================================================
   Demo Banner
   ============================================================ */
#demoBanner {
  position: sticky;
  top: 0;
  z-index: 200;
  background: linear-gradient(90deg, #1B4F72 0%, #154360 100%);
  color: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .03em;
  padding: 9px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
#demoBanner .demo-badge {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
