/* path: /home/bruhatag/d.vltechlabs.com/app/static/css/app.css */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #dfe3e8;
  --border-strong: #c4cad2;
  --ink: #1b1f24;
  --ink-mute: #697280;
  --accent: #1f4ed8;
  --accent-dark: #1739a8;
  --accent-soft: #eef2ff;
  --ok: #0f7a40;
  --ok-soft: #e7f5ec;
  --warn: #9a6100;
  --warn-soft: #fdf3dd;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-mute); }
.inline { display: inline; }

/* ==========================================================
   TOP BAR + GROUPED NAV
   ========================================================== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-inner {
  max-width: 1340px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px; letter-spacing: .5px;
}
.brand-mark-lg { width: 44px; height: 44px; font-size: 16px; margin: 0 auto .75rem; }
.brand-text { font-weight: 600; font-size: 14px; }

.topnav {
  display: flex; align-items: center; gap: 2px;
  margin-left: 4px; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap;
}
.topnav > a, .navgroup-btn {
  padding: 7px 10px; border-radius: var(--radius);
  color: var(--ink-mute); font-weight: 500; font-size: 13.5px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
}
.topnav > a:hover, .navgroup-btn:hover {
  background: var(--bg); color: var(--ink); text-decoration: none;
}
.topnav > a.active, .navgroup-btn.active {
  background: var(--accent-soft); color: var(--accent);
}
.caret { font-size: 9px; opacity: .6; }

.navgroup { position: relative; flex: 0 0 auto; }
.navgroup-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 210px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 28px rgba(16,24,40,.14);
  padding: 5px;
}
.navgroup.open .navgroup-menu { display: block; }
.navgroup-menu-right { left: auto; right: 0; }
.navgroup-menu a, .navgroup-signout {
  display: block; width: 100%; text-align: left;
  padding: 8px 11px; border-radius: 6px; font-size: 13.5px;
  color: var(--ink); background: none; border: none; cursor: pointer;
  font-family: inherit;
}
.navgroup-menu a:hover, .navgroup-signout:hover {
  background: var(--bg); text-decoration: none;
}
.navgroup-menu a.active { background: var(--accent-soft); color: var(--accent); }
.navgroup-signout { color: var(--danger); font-weight: 600; }

.topbar-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto; flex: 0 0 auto;
}
.usermenu-btn { font-weight: 600; color: var(--ink); }
.usermenu-head {
  padding: 9px 11px 10px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px; display: flex; flex-direction: column; gap: 3px;
}
.usermenu-head .muted { font-size: 11.5px; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { display: block; font-size: 11px; color: var(--ink-mute); }

.nav-toggle {
  display: none; background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--ink-mute); padding: 4px 8px;
}

/* ==========================================================
   LAYOUT
   ========================================================== */
.page { max-width: 1340px; margin: 0 auto; padding: 22px 20px 60px; }
.footer {
  max-width: 1340px; margin: 0 auto; padding: 14px 20px 26px;
  font-size: 12px; color: var(--ink-mute);
}
.footer-sep { margin: 0 6px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: -2px 0 14px; gap: 12px; flex-wrap: wrap;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ==========================================================
   FORMS
   ========================================================== */
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ink-mute); margin-bottom: 5px;
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=time],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 78, 216, .13);
}
textarea { min-height: 96px; resize: vertical; }
select[multiple] { padding: 4px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 13px; }
.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--ink); border-color: var(--border-strong);
}
.btn:hover { text-decoration: none; background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink-mute); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ==========================================================
   TABLES
   ========================================================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
  padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  background: #fafbfc; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; color: var(--ink-mute);
  white-space: nowrap;
}
table.data tbody tr:hover { background: #fafbfc; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.mono, .mono { font-family: var(--mono); font-size: 12px; }

/* ==========================================================
   BADGES + FLASH
   ========================================================== */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-mute { background: #eef0f3; color: var(--ink-mute); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

.flash-stack { margin-bottom: 16px; display: grid; gap: 8px; }
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); font-size: 13px;
}
.flash-success { background: var(--ok-soft); border-color: #bfe3cd; color: var(--ok); }
.flash-danger  { background: var(--danger-soft); border-color: #f2c3bf; color: var(--danger); }
.flash-warning { background: var(--warn-soft); border-color: #eeddb2; color: var(--warn); }
.flash-info    { background: var(--accent-soft); border-color: #c9d5fb; color: var(--accent); }
.flash-close {
  background: none; border: none; font-size: 18px; line-height: 1;
  cursor: pointer; color: inherit; opacity: .6;
}
.flash-close:hover { opacity: 1; }

/* ==========================================================
   AUTH + ERRORS
   ========================================================== */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 30px 26px;
}
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-head h1 { font-size: 1.25rem; }
.auth-foot { margin: 16px 0 0; font-size: 12px; text-align: center; }

.error-wrap { text-align: center; padding: 70px 20px; }
.error-code {
  font-size: 56px; font-weight: 800; color: var(--border-strong); line-height: 1;
}
.error-wrap h1 { margin: 10px 0 6px; }
.error-wrap .btn { margin-top: 18px; }

/* ==========================================================
   PUNCH WIDGET
   ========================================================== */
.punch-widget { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.punch-dot { width: 8px; height: 8px; border-radius: 50%; background: #c4cad2; }
.punch-dot.live { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.punch-timer { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ==========================================================
   EDITOR WITH TAG SIDEBAR
   ========================================================== */
.tpl-layout {
  display: grid; grid-template-columns: minmax(0,1fr) 280px;
  gap: 16px; align-items: start;
}
.tpl-main { min-width: 0; }
.tpl-side .card { max-height: calc(100vh - 100px); overflow-y: auto; }
.tag-group { margin-bottom: 14px; }
.tag-group-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--ink-mute); margin-bottom: 6px;
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.tag-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-chip {
  font-family: var(--mono); font-size: 11px; padding: 3px 7px;
  border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--surface); color: var(--accent); cursor: pointer;
  line-height: 1.5;
}
.tag-chip:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ==========================================================
   DOCUMENT SECTION LIST
   ========================================================== */
.sec-list { display: flex; flex-direction: column; gap: 8px; }
.sec-row {
  display: grid; grid-template-columns: 34px minmax(0,1fr) auto;
  gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fcfcfd;
}
.sec-order {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.sec-body { min-width: 0; }
.sec-excerpt {
  font-size: 12px; color: var(--ink-mute); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sec-actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* ==========================================================
   STARTER STRUCTURE PICKER
   ========================================================== */
.starter-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.starter-card {
  display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  padding: 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.starter-card:hover { border-color: var(--border-strong); }
.starter-card:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft);
}
.starter-card input { width: auto; margin-bottom: 4px; }
.starter-name { font-weight: 600; font-size: 13.5px; }
.starter-hint { font-size: 11.5px; color: var(--ink-mute); line-height: 1.4; }
.starter-count {
  font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 2px;
}

/* ==========================================================
   A4 PDF PREVIEW MODAL
   ========================================================== */
.pdf-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(16, 24, 40, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.pdf-modal[hidden] { display: none; }
.pdf-modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 18px 60px rgba(16, 24, 40, .3);
  width: min(860px, 100%);
  height: min(94vh, calc(min(860px, 90vw) * 1.414 + 52px));
  display: flex; flex-direction: column; overflow: hidden;
}
.pdf-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: #fafbfc; flex: 0 0 auto;
}
.pdf-modal iframe {
  flex: 1 1 auto; width: 100%; border: none; background: #525659;
}

/* ==========================================================
   UTILITY
   ========================================================== */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label {
  font-size: 11.5px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .4px;
}
.row { display: flex; gap: 10px; align-items: center; }
.row-end { justify-content: flex-end; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-mute); }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 1150px) {
  .topnav > a, .navgroup-btn { padding: 7px 8px; font-size: 13px; }
  .brand-text { display: none; }
}

@media (max-width: 1000px) {
  .tpl-layout { grid-template-columns: 1fr; }
  .tpl-side .card { position: static !important; max-height: none; }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 16px; }
  .topnav {
    display: none; order: 3; width: 100%; flex-wrap: wrap;
    padding: 8px 0 4px; border-top: 1px solid var(--border); margin: 6px 0 0;
  }
  .topnav.open { display: flex; }
  .navgroup { width: 100%; }
  .navgroup-menu {
    position: static; box-shadow: none; min-width: 0;
    border: none; padding: 0 0 0 12px;
  }
  .navgroup-menu-right { right: auto; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .pdf-modal { padding: 0; }
  .pdf-modal-box { height: 100vh; border-radius: 0; }
  .sec-row { grid-template-columns: 34px 1fr; }
  .sec-actions { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- inline lookup modal ---------- */
.lk-modal {
  position: fixed; inset: 0; z-index: 210;
  background: rgba(16, 24, 40, .55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lk-modal[hidden] { display: none; }
.lk-box {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 18px 60px rgba(16, 24, 40, .3);
  width: min(460px, 100%); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.lk-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  background: #fafbfc; flex: 0 0 auto;
}
.lk-body { padding: 16px; overflow-y: auto; flex: 1 1 auto; }
.lk-foot {
  display: flex; gap: 10px; padding: 13px 16px;
  border-top: 1px solid var(--border); background: #fafbfc; flex: 0 0 auto;
}

/* ---------- salary band readout ---------- */
.band-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 7px; padding: 8px 11px;
  background: var(--accent-soft); border: 1px solid #c9d5fb;
  border-radius: var(--radius);
}
.band-box[hidden] { display: none; }
.band-code {
  font-weight: 700; font-size: 12px; color: var(--accent);
  background: #fff; padding: 2px 8px; border-radius: 99px;
}
.band-range { font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- country chips ---------- */
.country-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border: 1px solid var(--border);
  border-radius: 99px; background: var(--surface);
  font-size: 12.5px; color: var(--ink);
}
.country-chip:hover {
  border-color: var(--accent); text-decoration: none;
  background: var(--accent-soft);
}
.country-chip.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.cc-count {
  font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--ink-mute);
  padding: 0 6px; border-radius: 99px; font-size: 11px;
}
.country-chip.active .cc-count { background: rgba(255,255,255,.22); color: #fff; }
.cc-fresh { font-size: 10.5px; color: var(--warn); font-weight: 600; }
.country-chip.active .cc-fresh { color: #ffe08a; }