:root {
  --ink: #231f20; --slate: #585a5b; --teal: #44c0b2; --teal-ink: #1d7a70; --teal-soft: #e3f5f2;
  --bg: #f4f3f0; --card: #fff; --line: #e4e1dc; --muted: #6b6764; --danger: #b3261e; --warn: #9a6700;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--teal-ink); }
h1, h2, h3 { margin: 0; }
code { background: var(--bg); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
[dir='rtl'] { font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif; }

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: rgba(255, 255, 255, .78); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 14px; }
.side-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 8px 18px; color: var(--teal); font: 500 13px/1 'Oswald', sans-serif; letter-spacing: .14em; text-transform: uppercase; }
.side-logo img { height: 46px; width: auto; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-group { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .38); padding: 18px 10px 6px; }
.side-link { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 8px; color: inherit; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: start; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.on { background: rgba(68, 192, 178, .16); color: #fff; }
.side-link.on svg { color: var(--teal); }
.side-link span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--teal); color: var(--ink); border-radius: 999px; font-size: 11.5px; padding: 1px 8px; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.side-foot form { margin: 0; }

.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 26px 36px 8px; }
.top h1 { font: 500 26px/1.2 'Oswald', sans-serif; letter-spacing: .01em; }
.burger { display: none; background: var(--ink); color: #fff; border: 0; border-radius: 8px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }
.content { padding: 16px 36px 60px; max-width: 1280px; }
.flash { margin: 14px 36px 0; padding: 12px 16px; border-radius: 10px; font-weight: 500; max-width: 1208px; word-break: break-word; }
.flash-ok { background: var(--teal-soft); color: #0f5149; }
.flash-warn { background: #fff4d6; color: #6b4a00; }
.flash-error { background: #fde8e6; color: #8a1d14; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .burger { display: block; }
  .top, .content { padding-inline: 16px; }
  .flash { margin-inline: 16px; }
}

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 17px; font-weight: 600; }
.panel h3 { font-size: 14px; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.muted, .hint { color: var(--muted); }
.hint { margin: 0 0 16px; max-width: 80ch; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; transition: border-color .15s; }
.stat:hover { border-color: var(--teal); }
.stat b { font: 500 34px/1 'Oswald', sans-serif; }
.stat span { color: var(--muted); }
.notes { display: grid; gap: 8px; margin-bottom: 20px; }
.note { margin: 0; background: #fff4d6; color: #5c4100; padding: 12px 16px; border-radius: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 500 14px/1 'Inter', sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #000; }
.btn-danger { color: var(--danger); border-color: #f1c4bf; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { min-height: 34px; font-size: 13px; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; margin-top: 10px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.tabs a { padding: 7px 12px; border-radius: 7px; text-decoration: none; color: var(--muted); text-transform: capitalize; font-weight: 500; }
.tabs a small { color: #a29e99; margin-inline-start: 3px; }
.tabs a.on { background: var(--ink); color: #fff; }
.tabs a.on small { color: rgba(255, 255, 255, .6); }
.search { flex: 1; min-width: 200px; }
.search input { width: 100%; }

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.panel .tablewrap { border: 0; border-radius: 0; margin: 0 -24px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl a { color: var(--ink); text-decoration: none; }
.tbl a:hover { color: var(--teal-ink); text-decoration: underline; }
.tbl small { color: var(--muted); }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: #faf9f7; }
.is-off td { opacity: .55; }
.td-ico { width: 44px; color: var(--teal-ink); }
.td-img img { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.td-actions { white-space: nowrap; text-align: end; }
.td-actions a { color: var(--teal-ink); }
.th-order, .td-order { width: 74px; }
.inline { display: inline; margin: 0; }
.td-order button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.td-order button:disabled { opacity: .3; cursor: default; }
.toggle { min-width: 46px; height: 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.toggle.on { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-ink); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; background: var(--bg); color: var(--muted); }
.pill-new { background: #e6effc; color: #1d4f9c; }
.pill-contacted, .pill-shortlisted { background: #fff4d6; color: #6b4a00; }
.pill-quoted, .pill-interview { background: #efe6fb; color: #5b2ea6; }
.pill-won, .pill-hired { background: var(--teal-soft); color: #0f5149; }
.pill-lost, .pill-rejected { background: #f3f1ee; color: #7a7570; }

.detail { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .detail { grid-template-columns: 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 0; margin: 0; }
.dl dt, .dl dd { padding: 9px 0; border-bottom: 1px solid var(--line); margin: 0; }
.dl dt { color: var(--muted); }
.msg { background: var(--bg); border-radius: 10px; padding: 14px 16px; white-space: normal; }
.msg p { margin: 0 0 8px; }
.notes-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.notes-list li { background: var(--bg); border-radius: 10px; padding: 10px 14px; }
.notes-list p { margin: 0; }
.note-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.fld > span, .fld legend { font-weight: 600; font-size: 13.5px; padding: 0; }
.fld legend { margin-bottom: 8px; }
.req { color: var(--danger); font-style: normal; }
.help { color: var(--muted); font-size: 12.5px; }
.lang-tag { font-style: normal; font-size: 10.5px; font-weight: 700; background: var(--bg); color: var(--muted); border-radius: 4px; padding: 1px 5px; margin-inline-start: 6px; vertical-align: 1px; }
input:not([type='checkbox']):not([type='radio']):not([type='file']), select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font: inherit;
}
textarea { resize: vertical; line-height: 1.55; }
textarea.rich { font-size: 14.5px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(68, 192, 178, .2); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--teal-ink); }
.edit-form { display: flex; flex-direction: column; gap: 20px; max-width: 1100px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .pair { grid-template-columns: 1fr; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; align-items: start; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 20px 0 16px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { max-width: 300px; }
.danger-zone { margin-top: 8px; }
.form-error { background: #fde8e6; color: #8a1d14; border-radius: 9px; padding: 11px 14px; margin: 0; font-weight: 500; }

.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick label { cursor: pointer; }
.icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); color: var(--slate); }
.icon-pick input:checked + span { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-ink); }
.icon-pick input:focus-visible + span { outline: 2px solid var(--teal); }
.img-current { display: flex; align-items: center; gap: 14px; margin: 4px 0 8px; }
.img-current img { width: 160px; height: 100px; object-fit: contain; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 8px; border: 1px solid var(--line); }
.qr { width: 180px; margin: 4px 0; }
.qr svg { width: 100%; height: auto; }

/* sign-in */
body.auth { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px 80px; background: #141112; color: #fff; overflow: hidden; }
.auth-scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.auth-scene::after { content: ''; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.auth-glow { position: absolute; border-radius: 50%; filter: blur(90px); }
.auth-glow-1 { width: 720px; height: 720px; top: -260px; right: -200px; background: radial-gradient(circle, rgba(68, 192, 178, .5), transparent 65%); animation: auth-drift 14s ease-in-out infinite alternate; }
.auth-glow-2 { width: 600px; height: 600px; bottom: -240px; left: -200px; background: radial-gradient(circle, rgba(68, 192, 178, .22), transparent 65%); animation: auth-drift 18s ease-in-out infinite alternate-reverse; }
@keyframes auth-drift { to { transform: translate(-80px, 60px) scale(1.15); } }
.auth-grid { position: absolute; inset: auto -30% 0; height: 60%; background-image: linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px); background-size: 70px 70px; transform: perspective(520px) rotateX(64deg); transform-origin: 50% 100%; mask-image: linear-gradient(to top, #000 0%, transparent 80%); -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 80%); animation: auth-grid 5s linear infinite; }
@keyframes auth-grid { to { background-position: 0 70px; } }
.auth-word { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); white-space: nowrap; font: 600 clamp(80px, 16vw, 260px)/1 'Oswald', sans-serif; text-transform: uppercase; color: transparent; -webkit-text-stroke: 1.2px rgba(255, 255, 255, .07); }
.auth-road { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46%;  overflow: visible; }
.auth-asphalt { fill: none; stroke: rgba(255, 255, 255, .05); stroke-width: 70; stroke-linecap: round; }
.auth-lane { fill: none; stroke: rgba(255, 255, 255, .3); stroke-width: 2; stroke-dasharray: 24 20; animation: auth-lane 2s linear infinite; }
@keyframes auth-lane { to { stroke-dashoffset: -88; } }
.auth-car { fill: #44c0b2; filter: drop-shadow(0 0 14px rgba(68, 192, 178, 1)); }
.auth-card {
  position: relative; z-index: 1; width: min(420px, 100%); padding: 40px 36px 34px; border-radius: 28px;
  background: rgba(30, 26, 27, .55); border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .03) inset, 0 0 120px -40px rgba(68, 192, 178, .5);
  animation: auth-in .9s cubic-bezier(.2, .7, .1, 1) both;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.auth-card img { height: 76px; width: auto; margin: 0 auto 10px; display: block; }
.auth-tag { text-align: center; margin: 0 0 26px; font: 600 11px/1 'Inter', sans-serif; letter-spacing: .26em; text-transform: uppercase; color: #44c0b2; }
.auth-card h1 { font: 500 24px/1.2 'Oswald', sans-serif; text-align: center; margin-bottom: 22px; color: #fff; }
.auth-card .muted { text-align: center; margin: -10px 0 18px; color: rgba(255, 255, 255, .6); }
.auth-card .fld > span { color: rgba(255, 255, 255, .75); }
body.auth .auth-card input:not([type='checkbox']):not([type='radio']):not([type='file']) { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: #fff; min-height: 50px; border-radius: 12px; padding: 12px 16px; }
body.auth .auth-card input:not([type='checkbox']):focus { background: rgba(255, 255, 255, .09); border-color: #44c0b2; box-shadow: 0 0 0 4px rgba(68, 192, 178, .2); }
.auth-card input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 40px #2a2526 inset; caret-color: #fff; }
.auth-card .btn-primary { min-height: 52px; border-radius: 999px; background: #44c0b2; border-color: #44c0b2; color: #141112; font-weight: 600; font-size: 15px; margin-top: 6px; box-shadow: 0 14px 34px -12px rgba(68, 192, 178, .8); transition: transform .2s, box-shadow .2s, background .2s; }
.auth-card .btn-primary:hover { background: #6fe0d3; transform: translateY(-2px); box-shadow: 0 18px 40px -12px rgba(68, 192, 178, 1); }
.auth-card .form-error { background: rgba(179, 38, 30, .18); color: #ffb4ab; border: 1px solid rgba(255, 120, 110, .25); }
.auth-card .linkbtn { display: block; margin: 14px auto 0; color: rgba(255, 255, 255, .55); }
.auth-foot { position: fixed; z-index: 1; bottom: 18px; margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, .35); }
@media (prefers-reduced-motion: reduce) { .auth-glow, .auth-grid, .auth-lane, .auth-card { animation: none; } }
input[dir='rtl'], textarea[dir='rtl'] { font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif; }
