:root{
  --navy:#16233F; --navy-deep:#0C1526; --orange:#E87A1E; --orange-soft:#FDEEE0;
  --slate:#3A4453; --paper:#F5F6F8; --panel:#FFFFFF; --line:#E3E6EC; --muted:#6B7280;
  --success:#1E8E5A; --success-soft:#E3F5EC; --danger:#C0392B; --danger-soft:#FBEAE8;
  --ink:#101826;
  --radius:12px;
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body { font-family: 'Inter', -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: var(--paper); color: var(--ink); margin: 0; font-size: 14px; }
h1 { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 700; margin: 0; }

/* ============ Multicolor "Silentpinch" wordmark ============ */
.brand-word { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 20px; letter-spacing: 0.2px; }
.brand-word.small { font-size: 16px; }
.bs1 { color: #4285F4; } .bs2 { color: #EA4335; } .bs3 { color: #FBBC05; } .bs4 { color: #34A853; }

/* ============ Shell: sidebar + main (logged-in pages) ============ */
.shell { min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--navy), var(--navy-deep));
  color: #fff; padding: 22px 16px;
  position: fixed; left: 0; top: 0; width: 240px; height: 100vh; overflow-y: auto; z-index: 50;
}
.side-brand { padding: 0 8px 20px; }
.side-brand .side-sub { font-size: 10.5px; color: #8B98B5; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 3px; }
.side-section { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: #6B7A9C; margin: 18px 12px 8px; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: #C3CBDE; text-decoration: none; margin-bottom: 2px; }
.side-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.side-item.active { background: var(--orange); color: #fff; font-weight: 600; }
.side-icon { width: 16px; text-align: center; flex-shrink: 0; opacity: 0.9; font-size: 12.5px; }

/* main content sits to the right of the fixed sidebar and scrolls normally */
.shell > main { margin-left: 240px; min-height: 100vh; }

.mobile-topbar { display: none; }
@media (max-width: 900px) {
  .sidebar { width: 250px; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .shell > main { margin-left: 0; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(10,15,25,.4); z-index: 40; }
  .scrim.open { display: block; }
  .mobile-topbar { display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; padding: 14px 16px; position: sticky; top: 0; z-index: 20; }
  .mobile-topbar button { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 4px; }
}

/* ============ Guest shell (login / install) ============ */
.guest-shell { min-height: 100vh; }
.guest-topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 16px 24px; }

/* ============ Content container ============ */
.content { max-width: 1100px; margin: 24px auto; padding: 0 24px 60px; }

/* ============ Cards / panels ============ */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; }

/* ============ Forms ============ */
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.02em; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-row label { display: inline; text-transform: none; font-size: 13px; font-weight: 400; color: var(--ink); margin: 0; }
.checkbox-row input { width: auto; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #FDFDFD;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
textarea { resize: vertical; }

/* ============ Buttons ============ */
button, .btn { background: #fff; border: 1px solid var(--line); padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600; text-decoration: none; color: var(--ink); display: inline-block; transition: background .12s ease; }
button:hover, .btn:hover { border-color: var(--navy); }
button:active, .btn:active { transform: scale(0.98); }
button.primary, .btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
button.primary:hover, .btn.primary:hover { background: #D0700F; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.whatsapp { border-color: #25D366; color: #128C4A; font-size: 12px; padding: 3px 10px; margin-top: 4px; display: inline-flex; align-items: center; gap: 5px; }
.btn.whatsapp svg { flex-shrink: 0; }
.btn.whatsapp:hover { background: #25D366; color: #fff; }

/* ============ Tables ============ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 8px; border-bottom: 1px solid var(--line); }
td { padding: 11px 8px; border-bottom: 1px solid #ECEFF2; }
.table-wrap { overflow-x: auto; max-width: 100%; }

/* Fixed-size, dual-scrolling candidates box */
.table-wrap.fixed-scroll { height: 500px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap.fixed-scroll table { min-width: 980px; }
.table-wrap.fixed-scroll th { position: sticky; top: 0; background: #FAFBFC; z-index: 1; white-space: nowrap; }
.table-wrap.fixed-scroll td { white-space: nowrap; }
.table-wrap.fixed-scroll td.lang-cell { white-space: normal; min-width: 220px; }

/* "+N more" chip for candidates with more than 2 language pairs */
.lang-more { cursor: pointer; background: #EEF0F3; color: var(--muted); border: 1px dashed var(--line); }
.lang-more:hover { background: var(--orange-soft); color: #A5540E; border-color: #F4D3AE; }

/* Below 760px: the fixed-scroll table becomes stacked cards instead of a
   sideways-scrolling table — each <td>'s data-label attribute becomes its
   visible label. */
@media (max-width: 760px) {
  .table-wrap.fixed-scroll { height: auto; }
  .table-wrap.fixed-scroll table, .table-wrap.fixed-scroll thead, .table-wrap.fixed-scroll tbody,
  .table-wrap.fixed-scroll th, .table-wrap.fixed-scroll td, .table-wrap.fixed-scroll tr { display: block; }
  .table-wrap.fixed-scroll table { min-width: 0; }
  .table-wrap.fixed-scroll thead tr { position: absolute; top: -9999px; left: -9999px; }
  .table-wrap.fixed-scroll tr { border: 1px solid var(--line); border-radius: 10px; margin: 10px; padding: 6px 4px; }
  .table-wrap.fixed-scroll td { border: none; position: relative; padding: 8px 10px 8px 42%; white-space: normal; min-height: 20px; }
  .table-wrap.fixed-scroll td[data-label]:before {
    content: attr(data-label); position: absolute; left: 10px; top: 8px; width: 38%;
    font-weight: 600; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em;
  }
}

/* ============ Language tag (the "route chip") ============ */
.lang-tag {
  display: inline-flex; align-items: center; gap: 4px; background: var(--orange-soft); color: #A5540E;
  border: 1px solid #F4D3AE; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  margin: 2px 4px 2px 0; font-family: 'JetBrains Mono', monospace;
}

/* ============ Repeatable language-pair rows (add/edit candidate) ============ */
.lang-pair-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 10px; }
@media (max-width: 560px) { .lang-pair-row { grid-template-columns: 1fr; } }
.lang-pair-row .remove-btn { padding: 8px 12px; border-color: var(--danger); color: var(--danger); height: 38px; }
.lang-pair-row .remove-btn:hover { background: var(--danger); color: #fff; }
.add-pair-btn { margin-top: 12px; background: none; border: 1px dashed var(--orange); color: #A5540E; }
.add-pair-btn:hover { background: var(--orange-soft); border-color: var(--orange); }

.bulk-lang-row { grid-template-columns: 1fr 160px auto; }
@media (max-width: 560px) { .bulk-lang-row { grid-template-columns: 1fr; } }

/* ============ Filters ============ */
.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 160px; }

/* ============ Badges / pills ============ */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.gray { background: #EEF0F3; color: var(--muted); }

.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.msg.success { background: var(--success-soft); color: var(--success); }
.msg.error { background: var(--danger-soft); color: var(--danger); }

/* ============ Metrics (KPI strip) ============ */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 760px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; }
.metric::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--orange); }
.metric .num { font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 600; color: var(--navy); }
.metric .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: stretch; }
.layout > div, .layout > aside { min-width: 0; }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .lang-aside { height: auto; }
  .lang-list-scroll { max-height: 320px; }
}

/* "Candidates by language" box: same fixed height as the candidates table,
   its own internal scrollbar, and a filter input pinned above the list. */
.lang-aside { display: flex; flex-direction: column; height: 500px; padding: 0; overflow: hidden; }
.lang-aside-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.lang-aside-head p { margin: 0; }
.lang-aside-head input { margin-top: 10px; }
.lang-list-scroll { flex: 1; overflow-y: auto; padding: 8px 20px 16px; }

.lang-panel-item-wrap { display: block; text-decoration: none; color: inherit; border-radius: 6px; padding: 2px 6px; margin: 0 -6px; }
.lang-panel-item-wrap:hover { background: var(--paper); }
.lang-panel-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #ECEFF2; font-size: 13px; }
.lang-panel-item-wrap:last-child .lang-panel-item { border-bottom: none; }
.lang-bar-track { background: var(--line); border-radius: 6px; height: 5px; width: 100%; margin: 2px 0 4px; overflow: hidden; }
.lang-bar-fill { background: var(--orange); height: 100%; border-radius: 6px; }

.streak-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--orange-soft); color: #A5540E; font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 700; }

.recipient-box { max-height: 240px; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; max-width: 100%; }
.recipient-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 4px 0; }
.recipient-row input { width: auto; flex-shrink: 0; margin-top: 2px; }
.recipient-row span { min-width: 0; overflow-wrap: break-word; word-break: break-word; }
.recipient-row.muted { color: var(--muted); }

.password-wrap { position: relative; }
.password-wrap input[type=password], .password-wrap input[type=text] { padding-right: 38px; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 4px; color: var(--muted); cursor: pointer; display: flex; align-items: center; }
.password-toggle:hover { background: none; color: var(--ink); }
.login-box { max-width: 360px; margin: 80px auto 0; }

/* Faded, tiled logo watermark behind every public page (login, install, CV upload) */
.guest-shell { position: relative; }
.guest-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url('/assets/logo.png');
  background-repeat: repeat;
  background-size: 30vw 30vw;
  background-position: center;
  opacity: 0.06;
  z-index: 0;
  pointer-events: none;
}
.guest-shell .content { position: relative; z-index: 1; }

@media (max-width: 640px) {
  .form-row-2 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .filters { flex-direction: column; }
  .filters input, .filters select { width: 100%; min-width: 0; }
  .content { padding: 0 16px 40px; }
  .card { padding: 16px; }
}
