/* ═══════════════════════════════════════════════════════
   OptiSizer — Application Stylesheet
   ═══════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --white:    #ffffff;
  --bg:       #f0f5fb;
  --surface:  #f4f8fc;
  --border:   #dce8f2;
  --border-s: #b8d0e8;
  --accent:   #1a7db5;
  --accent-d: #1466a0;
  --accent-l: #e8f3fb;
  --teal:     #2aa68a;
  --teal-l:   #e6f6f2;
  --green:    #4dc17a;
  --text:     #1a2533;
  --text-mid: #3d5166;
  --muted:    #7a93aa;
  --danger:   #d63b4f;
  --danger-l: #fdeef0;
  --warn:     #e58a00;
  --warn-l:   #fff8ec;
  --radius:   12px;
  --font:     'Inter', -apple-system, sans-serif;
  --mono:     'DM Mono', monospace;
  --nav-h:    60px;
  --shadow:   0 1px 3px rgba(20,60,100,0.07), 0 4px 16px rgba(20,60,100,0.08);
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── NAV ──────────────────────────────────────────────── */
.nav {
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(20,60,100,0.04);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  height: 100%; padding: 0 24px;
  display: flex; align-items: center; gap: 8px;
}
.nav-brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 16px; letter-spacing: -0.3px;
  margin-right: 16px;
}
.nav-brand svg { height: 26px; width: auto; display: block; }
.nav-links { display: flex; gap: 2px; }
.nav-link {
  padding: 6px 14px; border-radius: 8px;
  text-decoration: none; color: var(--muted);
  font-size: 14px; font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--accent); background: var(--accent-l); }
.nav-user {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
}
.nav-user-name { font-size: 14px; color: var(--text-mid); font-weight: 500; }
.nav-badge {
  background: var(--accent-l); color: var(--accent);
  border-radius: 6px; padding: 2px 8px;
  font-size: 11px; font-weight: 600;
}
.nav-logout {
  font-size: 13px; color: var(--muted); text-decoration: none;
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.nav-logout:hover { color: var(--danger); border-color: rgba(214,59,79,0.3); }

/* ── NOTIFICATIONS ────────────────────────────────────── */
.notif-wrap { position: relative; }
.notif-bell {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent;
  background: none; color: var(--text-mid); cursor: pointer; transition: all 0.15s;
}
.notif-bell svg { width: 18px; height: 18px; }
.notif-bell:hover { background: var(--surface); border-color: var(--border); color: var(--accent); }
.notif-count {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px;
  padding: 0 3px; border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 320px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 200; overflow: hidden;
}
.notif-dropdown-title {
  padding: 10px 14px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border);
}
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text);
  transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface); }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--muted); }
.notif-item.notif-success .notif-dot { background: #2aa68a; }
.notif-item.notif-error   .notif-dot { background: var(--danger); }
.notif-item.notif-info    .notif-dot { background: var(--accent); }
.notif-msg { flex: 1; font-size: 13px; line-height: 1.4; }
.notif-item.notif-unread .notif-msg { font-weight: 600; }
.notif-time { font-size: 11px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* ── FLASH ────────────────────────────────────────────── */
.flash-wrap {
  position: fixed; top: calc(var(--nav-h) + 12px); right: 16px;
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  max-width: 380px;
}
.flash {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } }
.flash-success { background: var(--teal-l); color: #1d7a63; border: 1px solid rgba(42,166,138,0.25); }
.flash-error   { background: var(--danger-l); color: var(--danger); border: 1px solid rgba(214,59,79,0.25); }
.flash-info    { background: var(--accent-l); color: var(--accent); border: 1px solid rgba(26,125,181,0.25); }
.flash-warning { background: var(--warn-l); color: var(--warn); border: 1px solid rgba(229,138,0,0.25); }
.flash button  { background:none; border:none; cursor:pointer; opacity:0.6; font-size:13px; flex-shrink:0; padding:0; }

/* ── SURVEY POPUP ─────────────────────────────────────── */
.survey-popup {
  position: fixed; bottom: 20px; right: 20px; z-index: 150;
  width: 300px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 16px; animation: slideIn 0.3s ease;
}
.survey-popup-close {
  position: absolute; top: 10px; right: 10px; background: none; border: none;
  cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; padding: 4px;
}
.survey-popup-title {
  font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 6px; padding-right: 20px;
}
.survey-popup-body { font-size: 13px; color: var(--text-mid); line-height: 1.5; margin-bottom: 14px; }
.survey-popup .btn { width: 100%; }

/* ── MAIN CONTENT ─────────────────────────────────────── */
.main-content { padding: 32px 0 64px; }

/* ── PAGE WRAP ────────────────────────────────────────── */
.page-wrap         { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.page-wrap-narrow  { max-width: 740px; margin: 0 auto; padding: 0 24px; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px;
}
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 4px; }
.page-sub   { font-size: 14px; color: var(--muted); }
.back-link  { font-size: 13px; color: var(--muted); text-decoration: none; display: block; margin-bottom: 6px; }
.back-link:hover { color: var(--accent); }

/* ── CARD ─────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.card.p-0 { padding: 0; overflow: hidden; }
.card.mb-4 { margin-bottom: 20px; }
.card.card-error {
  background: var(--danger-l);
  border-color: rgba(214,59,79,0.2);
}
.card.card-error h3 { color: var(--danger); margin-bottom: 8px; }
.card.card-error p  { color: #a02038; }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 9px;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; outline: none; text-decoration: none;
  transition: all 0.18s ease; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-d); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(26,125,181,0.28); }
.btn-ghost   { background: transparent; color: var(--text-mid); border: 1px solid var(--border-s); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-full    { width: 100%; }
.btn-sm      { padding: 6px 14px; font-size: 13px; border-radius: 7px; }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid rgba(214,59,79,0.3); }
.btn-danger-ghost:hover { background: var(--danger-l); }
.btn.loading .btn-label { display: none; }
.btn.loading .spinner   { display: block; }

/* ── SPINNER ──────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
}
.spinner-lg {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── FORMS ────────────────────────────────────────────── */
.field { margin-bottom: 20px; }
.field label {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 7px; font-family: var(--mono);
}
.field-link { font-weight: 500; text-decoration: none; color: var(--accent); text-transform: none; letter-spacing: 0; }
input[type="text"], input[type="email"], input[type="number"], input[type="password"] {
  width: 100%; padding: 12px 15px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 9px; font-family: var(--font); font-size: 15px; color: var(--text);
  outline: none; transition: border-color 0.18s, box-shadow 0.18s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,125,181,0.1); background: var(--white); }
input::placeholder { color: var(--muted); }
input[readonly] { opacity: 0.7; cursor: default; }
.field-hint  { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field-check { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.field-check label { font-size: 14px; color: var(--text-mid); text-transform: none; letter-spacing: 0; font-weight: 400; margin-bottom: 0; }
.field-check input { width: auto; }
.input-suffix-wrap { position: relative; }
.input-suffix-wrap input { padding-right: 60px; }
.input-suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 12.5px; color: var(--muted); pointer-events: none; }
.field-inline { display: flex; gap: 10px; }
.field-inline input { flex: 1; }

/* ── MODEL OPTIONS ────────────────────────────────────── */
.model-options { display: flex; gap: 10px; }
.model-option { flex: 1; cursor: pointer; }
.model-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.model-option-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px; border: 1.5px solid var(--border);
  border-radius: 10px; background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.model-option input[type="radio"]:checked + .model-option-card {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.model-option-card:hover { border-color: var(--accent); }
.model-option-title { font-size: 14px; font-weight: 600; color: var(--text); }
.model-option-desc  { font-size: 12px; color: var(--muted); }

/* ── AUTH PAGES ───────────────────────────────────────── */
body.auth-page { background: linear-gradient(135deg, #a8cce8 0%, #b8d8f2 30%, #c8e4f0 60%, #b8e8d8 100%); }
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--white); border-radius: 18px;
  padding: 44px 40px; box-shadow: 0 8px 40px rgba(20,60,100,0.18);
  border: 1px solid rgba(255,255,255,0.8);
}
.auth-logo { display: flex; align-items: center; margin-bottom: 32px; }
.auth-logo svg { height: 38px; width: auto; }
.auth-title { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 6px; }
.auth-sub   { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.auth-form  { display: flex; flex-direction: column; gap: 0; }
.auth-footer { font-size: 14px; color: var(--muted); text-align: center; margin-top: 24px; }
.auth-footer a { color: var(--accent); text-decoration: none; font-weight: 500; }
.invite-banner {
  background: var(--teal-l); border: 1px solid rgba(42,166,138,0.3);
  border-radius: 9px; padding: 12px 16px;
  font-size: 14px; color: #1d7a63; font-weight: 500; margin-bottom: 20px;
}

/* ── STEP FORM ────────────────────────────────────────── */
.steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 36px; padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.step { display: flex; align-items: center; gap: 8px; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.3s;
}
.step span { font-size: 13px; font-weight: 500; color: var(--muted); transition: color 0.3s; }
.step.active .step-num  { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.active span       { color: var(--text); }
.step.done .step-num    { background: var(--teal); border-color: var(--teal); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 8px; }
.step-pane { display: none; }
.step-pane.active { display: block; animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } }
.step-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.step-desc  { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.step-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ── UPLOAD ZONE ──────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-s); border-radius: 12px;
  padding: 40px 20px; text-align: center; cursor: pointer;
  position: relative; background: var(--surface);
  transition: all 0.25s ease;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-l); }
.upload-zone input[type="file"] { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; }
.upload-icon-wrap {
  width: 48px; height: 48px; background: var(--white);
  border: 1px solid var(--border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; box-shadow: 0 2px 6px rgba(20,60,100,0.07);
}
.upload-icon-wrap svg { width: 22px; height: 22px; color: var(--accent); }
.upload-title { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.upload-sub   { font-size: 12px; color: var(--muted); }
.file-list    { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.file-item    { display:flex; align-items:center; gap:9px; background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:9px 12px; }
.file-dot     { width:7px; height:7px; border-radius:50%; background:var(--teal); flex-shrink:0; }
.file-name    { flex:1; font-size:12px; font-family:var(--mono); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-size    { font-size:11px; color:var(--muted); font-family:var(--mono); }

/* ── CONFIRM SUMMARY ──────────────────────────────────── */
.confirm-summary { background:var(--surface); border:1px solid var(--border); border-radius:10px; overflow:hidden; margin-bottom:8px; }
.summary-row { display:flex; justify-content:space-between; padding:13px 18px; border-bottom:1px solid var(--border); font-size:14px; }
.summary-row:last-child { border-bottom:none; }
.summary-label { color:var(--muted); }
.summary-value { font-weight:600; }

/* ── JOBS TABLE ───────────────────────────────────────── */
.jobs-table-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); }
.jobs-table, .admin-table {
  width: 100%; border-collapse: collapse; background: var(--white);
  font-size: 14px;
}
.jobs-table th, .admin-table th {
  background: var(--surface); padding: 11px 16px;
  text-align: left; font-size: 11.5px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
}
.jobs-table td, .admin-table td {
  padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.jobs-table tr:last-child td, .admin-table tr:last-child td { border-bottom: none; }
.jobs-table tr:hover td, .admin-table tr:hover td { background: #fafcff; }
.row-inactive td { opacity: 0.55; }

/* ── BADGES ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; }
.badge-lg { padding: 6px 14px; font-size: 13px; }
.badge-queued   { background: var(--warn-l);    color: var(--warn);   }
.badge-started  { background: var(--accent-l);  color: var(--accent); }
.badge-finished { background: var(--teal-l);    color: var(--teal);   }
.badge-failed   { background: var(--danger-l);  color: var(--danger); }
.badge-admin    { background: #f0eaff; color: #7c3aed; margin-left: 6px; }

/* ── STATUS PAGE ──────────────────────────────────────── */
.status-header {
  display: flex; align-items: center; gap: 18px; margin-bottom: 24px;
}
.status-icon-wrap {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-l); border: 1px solid rgba(26,125,181,0.2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.status-icon-wrap svg   { width: 22px; height: 22px; color: var(--accent); }
.status-icon-done       { background: var(--teal-l); border-color: rgba(42,166,138,0.2); }
.status-icon-done svg   { color: var(--teal); }
.status-icon-failed     { background: var(--danger-l); border-color: rgba(214,59,79,0.2); }
.status-icon-failed svg { color: var(--danger); }
.status-label { font-size: 17px; font-weight: 600; }
.status-time  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.detail-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.detail-item  { background: var(--surface); padding: 13px 16px; }
.detail-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; font-family: var(--mono); display: block; }
.detail-value { font-size: 14px; font-weight: 600; }
.poll-notice  { display:flex; align-items:center; gap:9px; margin-top:18px; font-size:13px; color:var(--muted); }
.poll-dot     { width:8px; height:8px; border-radius:50%; background:var(--accent); animation:blink 1.4s ease-in-out infinite; flex-shrink:0; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; font-family: var(--mono); }
.results-grid  { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 20px; }
.result-file   { display:flex; align-items:center; gap:12px; background:var(--white); padding:13px 16px; }
.result-icon   { width:38px; height:38px; border-radius:9px; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; flex-shrink:0; }
.result-icon-img { background:var(--accent-l); color:var(--accent); }
.result-icon-img svg { width:18px; height:18px; }
.result-icon-csv { background:var(--teal-l); color:var(--teal); font-family:var(--mono); }
.result-name   { flex:1; font-size:13px; font-family:var(--mono); }
.results-actions { display:flex; gap:10px; flex-wrap:wrap; padding-top: 4px; }

/* ── ADMIN ────────────────────────────────────────────── */
.admin-section { margin-bottom: 32px; }
.header-stats  { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.stat-pill     { background:var(--white); border:1px solid var(--border); border-radius:99px; padding:6px 14px; font-size:13px; color:var(--text-mid); }
.stat-pill-warn { border-color:rgba(229,138,0,0.3); background:var(--warn-l); color:var(--warn); }
.stat-n        { font-weight:700; }
.invite-form   { margin-bottom: 0; }
.pending-invites { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.sub-section-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; }
.invite-row    { display:flex; align-items:center; gap:12px; padding:9px 0; border-bottom:1px solid var(--border); font-size:14px; }
.invite-row:last-child { border-bottom:none; }
.invite-email  { flex:1; font-family:var(--mono); font-size:13px; }
.invite-date   { font-size:13px; }
.action-row    { display:flex; gap:6px; flex-wrap:wrap; }
.section-title-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.section-link  { font-size:13px; color:var(--accent); text-decoration:none; }

/* ── EMPTY STATE ──────────────────────────────────────── */
.empty-state { text-align:center; padding:64px 24px; }
.empty-icon  { font-size:48px; margin-bottom:16px; }
.empty-state h2 { font-size:20px; font-weight:700; margin-bottom:8px; }
.empty-state p  { color:var(--muted); margin-bottom:24px; }

/* ── UTILS ────────────────────────────────────────────── */
.mono   { font-family: var(--mono); font-size: 0.875em; }
.muted  { color: var(--muted); }
.hidden { display: none !important; }
.mt-3   { margin-top: 16px; }
.mb-4   { margin-bottom: 20px; }
.job-id-cell { max-width: 120px; }
.file-count  { font-size: 13px; }

/* ── IMAGE GALLERY (dashboard) ────────────────────────── */
.job-row-expandable { cursor: pointer; }
.job-row-expandable:hover td { background: var(--accent-l) !important; }
/* Flex lives on an inner div, NOT the <td>, to keep table column widths stable */
.job-id-flex { display: flex; align-items: center; gap: 6px; }

.gallery-chevron {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0;
  color: var(--muted); transition: transform 0.22s ease;
}
.gallery-chevron svg { width: 14px; height: 14px; }
.job-row.expanded .gallery-chevron { transform: rotate(180deg); color: var(--accent); }

.gallery-row { display: none; }
.gallery-row.open { display: table-row; }
.gallery-row > td {
  padding: 0 !important;
  border-bottom: 2px solid var(--accent-l);
  background: var(--surface);
}

.gallery-wrap { padding: 20px 20px 24px; }

.gallery-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.gallery-title {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono);
}
.gallery-count {
  background: var(--accent-l); color: var(--accent);
  font-size: 11px; font-weight: 600; border-radius: 99px;
  padding: 2px 9px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.gallery-item {
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--border);
  background: var(--white);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.gallery-item:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(26,125,181,0.15);
  transform: translateY(-2px);
}

.gallery-img-wrap {
  width: 100%; aspect-ratio: 1;
  background: var(--surface);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.gallery-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: transform 0.25s ease;
}
.gallery-item:hover .gallery-img-wrap img { transform: scale(1.04); }

.gallery-label {
  padding: 0 10px 8px;
  font-size: 11px; font-family: var(--mono); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}

.gallery-loading {
  font-size: 13px; color: var(--muted); padding: 8px 0;
  grid-column: 1 / -1;
}

/* PDF thumbnail inside gallery card */
.gallery-pdf-embed {
  width: 100%; height: 100%;
  pointer-events: none; /* let the card's onclick fire, not the embed */
  border: none;
}
/* Transparent click-catcher so the embed doesn't swallow mouse events */
.gallery-pdf-overlay {
  position: absolute; inset: 0;
  cursor: pointer;
}
.gallery-img-wrap { position: relative; }

/* ── LIGHTBOX ─────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 20, 35, 0.85);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 24px;
}
.lightbox.open { opacity: 1; pointer-events: all; }

.lightbox-inner {
  position: relative;
  max-width: min(90vw, 900px); max-height: 90vh;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.lightbox-inner img {
  max-width: 100%; max-height: calc(90vh - 60px);
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  object-fit: contain; display: block;
}
#lightbox-pdf {
  width: min(85vw, 860px); height: calc(90vh - 60px);
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  background: #fff;
}

#lightbox-name {
  font-size: 12px; font-family: var(--mono);
  color: rgba(255,255,255,0.6);
}

.lightbox-close {
  position: absolute; top: -14px; right: -14px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s; color: #fff;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }
.lightbox-close svg { width: 14px; height: 14px; }

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-links  { display: none; }
  .nav-user-name { display: none; }
  .page-header { flex-direction: column; }
  .auth-card  { padding: 32px 24px; }
  .detail-grid { grid-template-columns: 1fr; }
  .jobs-table th:nth-child(2), .jobs-table td:nth-child(2),
  .jobs-table th:nth-child(3), .jobs-table td:nth-child(3) { display: none; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
