@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #070b1a;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #7c3aed;
  --primary-2: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fc;
  --card: rgba(255, 255, 255, 0.78);
  --card-strong: rgba(255, 255, 255, 0.94);
  --border: rgba(30, 41, 59, 0.11);
  --text: #172033;
  --muted: #64748b;
  --primary: #6d28d9;
  --primary-2: #0891b2;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 24px 65px rgba(51, 65, 85, 0.13);
}

* {
  box-sizing: border-box;
}

/* Component display rules must never override native hidden state. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Vazirmatn", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body, .app-bg, .sidebar, .topbar, .card, input, select, table, th, td {
  transition: background-color .28s ease, border-color .28s ease, color .2s ease, box-shadow .28s ease;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 10%, rgba(124, 58, 237, 0.35), transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.25), transparent 30%),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.18), transparent 35%),
    linear-gradient(135deg, #050816 0%, #08111f 45%, #020617 100%);
}

.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent);
}

.sidebar {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  width: 290px;
  padding: 22px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.sidebar-backdrop { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  padding: 7px;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(37,99,169,.16);
  box-shadow: 0 14px 34px rgba(37,99,169,.2);
}

.brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }

.brand .brand-logo {
  width: 82px;
  height: 58px;
  flex: 0 0 82px;
  padding: 4px;
  border-radius: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.menu {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.menu-item {
  text-decoration: none;
  color: var(--text);
  padding: 14px 16px;
  border-radius: 18px;
  background: transparent;
  border: 1px solid transparent;
  transition: 0.25s ease;
  font-weight: 600;
}

.menu-item:hover,
.menu-item.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.28), rgba(6, 182, 212, 0.16));
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateX(-4px);
}

.menu-item.danger {
  color: #fecaca;
}

.main {
  margin-right: 338px;
  min-height: 100vh;
  padding: 24px 24px 24px 40px;
}

.topbar {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(22px);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 18px 24px;
  box-shadow: var(--shadow);
}

.topbar h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hamburger {
  display: none;
  background: var(--card);
  color: white;
  border: 1px solid var(--border);
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-size: 22px;
  cursor: pointer;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0,0,0,.1);
  cursor: pointer;
  font: inherit;
  transition: transform .2s ease, background .25s ease, border-color .25s ease;
}

.theme-toggle:hover { transform: translateY(-2px) rotate(-4deg); border-color: rgba(6,182,212,.45); }
.theme-toggle:focus-visible { outline: 3px solid rgba(6,182,212,.25); outline-offset: 3px; }
.theme-icon { grid-area: 1 / 1; font-size: 23px; line-height: 1; transition: transform .3s ease, opacity .2s ease; }
.theme-icon.sun { opacity: 0; transform: rotate(-70deg) scale(.5); }
.theme-icon.moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="light"] .theme-icon.sun { opacity: 1; transform: rotate(0) scale(1); color: #d97706; }
[data-theme="light"] .theme-icon.moon { opacity: 0; transform: rotate(70deg) scale(.5); }
.login-theme-toggle { position: fixed; top: 24px; left: 24px; z-index: 30; }

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 8px 20px rgba(6,182,212,.2);
  line-height: 1;
  font-weight: 800;
}

.content {
  margin-top: 24px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(6,182,212,0.08), transparent);
  opacity: 0.8;
  pointer-events: none;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-title {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 800;
}

.form {
  display: grid;
  gap: 18px;
}

.form-group {
  display: grid;
  gap: 8px;
}

.field-help { color: var(--muted); font-size: 12px; line-height: 1.8; }
.job-combobox { position: relative; min-width: 0; }
.job-combobox-control { position: relative; }
.job-combobox-control input[type="search"] { padding-left: 44px; }
.job-combobox-control input[type="search"]::-webkit-search-cancel-button { display: none; }
.job-combobox-clear { position: absolute; left: 10px; top: 50%; width: 30px; height: 30px; transform: translateY(-50%); border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 20px; cursor: pointer; }
.job-combobox-clear:hover { color: var(--text); background: rgba(255,255,255,.08); }
.job-combobox-list { position: absolute; top: calc(100% + 7px); right: 0; left: 0; z-index: 40; max-height: 280px; overflow-y: auto; padding: 7px; border: 1px solid var(--border); border-radius: 16px; background: #0f172a; box-shadow: 0 22px 55px rgba(0,0,0,.42); }
.job-combobox-option { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 0; border-radius: 11px; color: #e2e8f0; background: transparent; font: inherit; text-align: right; cursor: pointer; }
.job-combobox-option:hover, .job-combobox-option:focus { outline: none; color: white; background: rgba(6,182,212,.13); }
.job-combobox-option span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-combobox-option small { flex: 0 0 auto; color: #94a3b8; font-size: 11px; }
.job-combobox-empty { margin: 0; padding: 14px; color: var(--muted); text-align: center; font-size: 13px; }
.advanced-filters[open] { overflow: visible; }
.conditional-field { padding: 14px; border-radius: 18px; background: rgba(6,182,212,.07); border: 1px solid rgba(6,182,212,.18); }
.conditional-field[hidden] { display: none; }

label {
  color: #dbeafe;
  font-size: 14px;
  font-weight: 700;
}

input:not([type="radio"]):not([type="hidden"]),
select {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.55);
  color: white;
  outline: none;
  font-family: inherit;
  transition: 0.25s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-left: 50px;
  cursor: pointer;
  color-scheme: dark;
  background-color: rgba(2, 6, 23, 0.72);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2367e8f9' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
  background-size: 18px;
}

select:hover {
  border-color: rgba(148, 163, 184, .45);
  background-color: rgba(2, 6, 23, .86);
}

select option {
  color: #f8fafc;
  background: #0f172a;
  padding: 12px;
}

input[type="file"] {
  min-height: 62px;
  padding: 7px;
  color: var(--muted);
  cursor: pointer;
  background: rgba(2, 6, 23, .42);
}

input[type="file"]::file-selector-button {
  min-height: 46px;
  margin-left: 12px;
  padding: 10px 18px;
  border: 1px solid rgba(6, 182, 212, .32);
  border-radius: 13px;
  color: #e0f2fe;
  background: linear-gradient(135deg, rgba(124, 58, 237, .7), rgba(6, 182, 212, .45));
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: .2s ease;
}

input[type="file"]:hover::file-selector-button {
  border-color: rgba(103, 232, 249, .65);
  filter: brightness(1.12);
}

.file-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.file-picker {
  min-height: 92px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px dashed rgba(6,182,212,.42);
  border-radius: 18px;
  background: rgba(2,6,23,.28);
  cursor: pointer;
  transition: .2s ease;
}

.file-picker:hover { border-color: #22d3ee; background: rgba(6,182,212,.08); transform: translateY(-1px); }
.file-native:focus-visible + .file-picker { outline: 3px solid rgba(6,182,212,.2); outline-offset: 3px; }
.file-picker-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: white; font-size: 24px; background: linear-gradient(135deg,var(--primary),var(--primary-2)); }
.file-picker-copy { min-width: 0; display: grid; gap: 4px; }
.file-picker-copy strong { color: var(--text); }
.file-picker-copy small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }
.file-picker-action { padding: 10px 14px; border-radius: 12px; color: #cffafe; background: rgba(6,182,212,.13); border: 1px solid rgba(6,182,212,.24); white-space: nowrap; }
.has-file .file-picker { border-style: solid; border-color: rgba(16,185,129,.45); }
.has-file .file-picker-icon { background: linear-gradient(135deg,#059669,#06b6d4); }

.upload-guide { margin-top: 20px; }
.upload-guide .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.guide-format { direction: ltr; padding: 7px 12px; border-radius: 999px; color: #a5f3fc; background: rgba(6,182,212,.12); border: 1px solid rgba(6,182,212,.24); font-weight: 800; }
.guide-sections { display: grid; gap: 12px; margin-top: 20px; }
.guide-category { border: 1px solid var(--border); border-radius: 18px; background: rgba(2,6,23,.24); overflow: hidden; }
.guide-category summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; cursor: pointer; list-style: none; user-select: none; }
.guide-category summary::-webkit-details-marker { display: none; }
.guide-category summary > span:first-child { display: flex; align-items: center; gap: 10px; }
.guide-category summary strong { color: var(--text); }
.guide-category summary small { color: var(--muted); font-weight: 600; }
.guide-chevron { color: #67e8f9; font-size: 20px; transition: transform .2s ease; }
.guide-category[open] .guide-chevron { transform: rotate(180deg); }
.guide-body { padding: 0 18px 18px; border-top: 1px solid rgba(255,255,255,.07); }
.guide-note { color: var(--muted); line-height: 1.9; font-size: 13px; }
.guide-note strong { color: var(--text); }
.column-list { counter-reset: guide-column; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; margin: 14px 0 0; padding: 0; list-style: none; }
.column-list li { counter-increment: guide-column; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 13px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.07); font-size: 12px; }
.column-list li::before { content: counter(guide-column); width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 8px; color: #cffafe; background: rgba(6,182,212,.16); font-size: 11px; font-weight: 900; }
.column-list li span { min-width: 0; overflow-wrap: anywhere; }

.no-job-groups { color: var(--muted); text-align: center; }

.job-management-grid { grid-template-columns: minmax(260px, .7fr) minmax(0, 2fr); align-items: start; }
.job-add-card { position: sticky; top: 24px; }
.job-list-heading { display: grid; grid-template-columns: minmax(0,1fr) minmax(220px,340px); align-items: end; gap: 18px; }
.managed-job-list { display: grid; gap: 10px; margin-top: 18px; max-height: 680px; overflow: auto; padding: 2px; }
.managed-job-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.08); }
.managed-job-item.inactive { opacity: .66; }
.managed-job-item.inactive:hover { opacity: 1; }
.managed-job-meta { min-width: 0; display: flex; align-items: center; gap: 10px; }
.managed-job-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.managed-job-meta small { color: var(--muted); white-space: nowrap; }
.managed-job-actions { display: flex; align-items: center; gap: 8px; }
.managed-job-actions form { margin: 0; }
.inline-edit { position: relative; }
.inline-edit summary { list-style: none; }
.inline-edit summary::-webkit-details-marker { display: none; }
.inline-edit[open] > form { display: flex; gap: 8px; position: absolute; z-index: 10; left: 0; top: calc(100% + 8px); width: min(420px,80vw); padding: 10px; border-radius: 16px; background: rgba(15,23,42,.98); border: 1px solid var(--border); box-shadow: var(--shadow); }
.inline-edit form input { min-width: 0; }
.inline-edit form .btn { flex: 0 0 auto; }

input:not([type="radio"]):not([type="hidden"]):focus,
select:focus {
  border-color: rgba(6, 182, 212, 0.75);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.14);
}

input::placeholder {
  color: #64748b;
}

.btn {
  border: 0;
  border-radius: 18px;
  padding: 14px 20px;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: 0.25s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 18px 40px rgba(124, 58, 237, 0.32);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 60px rgba(124, 58, 237, 0.44);
}

.btn-danger {
  color: white;
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.btn-activate { color: white; background: linear-gradient(135deg, #059669, #06b6d4); }
.inactive-row td { opacity: .68; }
.inactive-row:hover td { opacity: 1; }
.status-inactive { color: #fecaca; background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.28); }

.btn-soft {
  color: white;
  background: var(--card-strong);
  border: 1px solid var(--border);
}

.btn-soft:hover {
  border-color: rgba(103, 232, 249, .38);
  background: rgba(255,255,255,.18);
  transform: translateY(-1px);
}

.table-wrap {
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  background: rgba(15, 23, 42, 0.45);
}

th,
td {
  padding: 16px;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

th {
  color: #bae6fd;
  font-size: 13px;
  background: rgba(255,255,255,0.06);
}

td {
  color: #e2e8f0;
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.18);
  color: #86efac;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.role-admin { color: #fde68a; background: rgba(245, 158, 11, .16); border-color: rgba(245, 158, 11, .3); }
.role-operator { color: #bae6fd; background: rgba(6, 182, 212, .16); border-color: rgba(6, 182, 212, .3); }
.role-data-manager { color: #ddd6fe; background: rgba(124, 58, 237, .16); border-color: rgba(124, 58, 237, .3); }

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-card {
  min-height: 150px;
}

.stat-value {
  font-size: 34px;
  font-weight: 900;
  margin: 12px 0 4px;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
}

.login-hero {
  text-align: center;
  margin-bottom: 24px;
}

.login-hero .brand-logo {
  margin: 0 auto 16px;
  width: 104px;
  height: 74px;
  padding: 5px;
  border-radius: 20px;
}

.login-hero h1 {
  margin: 0;
  font-size: 30px;
}

.login-hero p {
  color: var(--muted);
}

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(120%);
    transition: 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-right: 0;
    padding: 16px;
  }

  .hamburger {
    display: block;
  }

  .topbar {
    height: auto;
    gap: 14px;
  }

  .grid-2,
  .grid-3,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .sidebar { top: 12px; right: 12px; bottom: 12px; width: min(290px, calc(100vw - 24px)); }
  .topbar h2 { font-size: 20px; }
}
.error-box {
  margin-bottom: 16px;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.28);
  padding: 12px 14px;
  border-radius: 16px;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff;
  box-shadow: 0 0 0 1000px rgba(2, 6, 23, 0.72) inset !important;
  border: 1px solid rgba(6, 182, 212, 0.75);
  transition: background-color 9999s ease-in-out 0s;
}
.error-box {
  margin-bottom: 16px;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.28);
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 700;
}
.success-box {
  margin-bottom: 16px;
  color: #bbf7d0;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.28);
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 700;
}
.stats-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:24px;
}

.user-preview{
  display:flex;
  align-items:center;
  gap:18px;
}

.avatar.large{
  width:72px;
  height:72px;
  font-size:28px;
}

.form-hint,
.section-heading p,
.result-card-head p {
  color: var(--muted);
  line-height: 1.9;
  margin: 8px 0 0;
}

.form-hint { font-size: 13px; }

.filter-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.form-actions,
.results-heading,
.result-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions { justify-content: flex-start; }
.category-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 18px 0; padding: 6px; border: 1px solid var(--border); border-radius: 18px; background: rgba(2, 6, 23, .35); }
.category-tab { padding: 12px 16px; text-align: center; text-decoration: none; color: var(--muted); border-radius: 13px; font-weight: 800; transition: .2s ease; }
.category-tab:hover { color: var(--text); background: rgba(255,255,255,.05); }
.category-tab.active { color: white; background: linear-gradient(135deg, rgba(124,58,237,.72), rgba(6,182,212,.45)); box-shadow: 0 10px 24px rgba(0,0,0,.2); }
.advanced-filters { border: 1px solid var(--border); border-radius: 18px; background: rgba(2, 6, 23, .25); overflow: hidden; }
.advanced-filters summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; color: #dbeafe; font-weight: 800; list-style: none; user-select: none; }
.advanced-filters summary::-webkit-details-marker { display: none; }
.advanced-filters summary:hover { background: rgba(255,255,255,.05); }
.advanced-state { color: #67e8f9; font-size: 13px; font-weight: 600; }
.advanced-filters .hide-label { display: none; }
.advanced-filters[open] .show-label { display: none; }
.advanced-filters[open] .hide-label { display: inline; }
.advanced-filters .chevron { display: inline-block; transition: transform .2s ease; }
.advanced-filters[open] .chevron { transform: rotate(180deg); }
.advanced-content { display: grid; gap: 16px; padding: 4px 16px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.filter-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 16px; border-radius: 16px; background: rgba(2, 6, 23, .35); }
.filter-toolbar > span { color: var(--muted); font-size: 13px; }
.radio-option { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.radio-option input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--primary-2); cursor: pointer; }
.results-heading { margin: 28px 4px 16px; }
.results-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.results-heading h3, .result-card-head h3 { margin: 0; }
.result-grid { display: grid; gap: 18px; }
.result-card { padding: 22px; }
.result-card::before { opacity: .45; }
.detail-grid { margin-top: 20px; }

.detail-item {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(2, 6, 23, .36);
  border: 1px solid rgba(255,255,255,.08);
}

.detail-item span,
.address-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-item strong { display: block; overflow-wrap: anywhere; font-size: 14px; }
.address-row { margin-top: 14px; padding: 14px 16px; border-right: 3px solid var(--primary-2); background: rgba(6,182,212,.07); border-radius: 14px; }
.address-row p { margin: 0; line-height: 1.9; }
.map-btn { margin-top: 14px; width: fit-content; }
.empty-state { color: #fecaca; text-align: center; }
.audit-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.audit-filters { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)) auto auto; align-items: end; gap: 12px; margin: 20px 0; }
.audit-table table { min-width: 900px; }
.audit-time { white-space: nowrap; direction: rtl; }
.audit-note { display: block; margin-top: 4px; color: var(--muted); }
.audit-action { display: inline-flex; white-space: nowrap; }
.audit-details { min-width: 180px; }
.audit-details span { display: block; width: fit-content; margin: 3px 0; padding: 5px 8px; border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.06); font-size: 11px; }
.audit-details b { color: var(--text); font-weight: 700; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pagination span { color: var(--muted); font-size: 13px; }

/* Light theme */
[data-theme="light"] .app-bg {
  background:
    radial-gradient(circle at 15% 8%, rgba(124, 58, 237, .15), transparent 32%),
    radial-gradient(circle at 85% 18%, rgba(6, 182, 212, .16), transparent 30%),
    radial-gradient(circle at 50% 95%, rgba(16, 185, 129, .1), transparent 34%),
    linear-gradient(145deg, #faf7ff 0%, #f4f9ff 46%, #eefcfb 100%);
}

[data-theme="light"] .app-bg::after {
  background-image: linear-gradient(rgba(51,65,85,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(51,65,85,.035) 1px, transparent 1px);
}

[data-theme="light"] .sidebar,
[data-theme="light"] .topbar { background: rgba(255,255,255,.76); }
[data-theme="light"] .card { background: rgba(255,255,255,.72); }
[data-theme="light"] .card::before { background: linear-gradient(135deg, rgba(124,58,237,.09), rgba(6,182,212,.055), transparent 60%); }
[data-theme="light"] .menu-item:hover,
[data-theme="light"] .menu-item.active { background: linear-gradient(135deg, rgba(109,40,217,.13), rgba(8,145,178,.1)); border-color: rgba(109,40,217,.14); }
[data-theme="light"] .menu-item.danger { color: #b91c1c; }
[data-theme="light"] label { color: #334155; }
[data-theme="light"] input:not([type="radio"]):not([type="hidden"]),
[data-theme="light"] select { color: #172033; background-color: rgba(255,255,255,.86); border-color: rgba(51,65,85,.16); box-shadow: 0 7px 22px rgba(51,65,85,.045); }
[data-theme="light"] input:not([type="radio"]):not([type="hidden"]):hover,
[data-theme="light"] select:hover { border-color: rgba(8,145,178,.36); background-color: #fff; }
[data-theme="light"] input::placeholder { color: #94a3b8; }
[data-theme="light"] select option { color: #172033; background: #fff; }
[data-theme="light"] input[type="file"] { color: #64748b; background: rgba(248,250,252,.9); }
[data-theme="light"] input[type="file"]::file-selector-button { color: #fff; }
[data-theme="light"] .btn-soft { color: #334155; background: rgba(255,255,255,.72); border-color: rgba(51,65,85,.14); }
[data-theme="light"] .btn-soft:hover { background: #fff; border-color: rgba(8,145,178,.3); }
[data-theme="light"] .table-wrap { border-color: rgba(51,65,85,.12); box-shadow: 0 10px 32px rgba(51,65,85,.06); }
[data-theme="light"] table { background: rgba(255,255,255,.58); }
[data-theme="light"] th { color: #475569; background: rgba(241,245,249,.92); }
[data-theme="light"] td { color: #334155; border-bottom-color: rgba(51,65,85,.08); }
[data-theme="light"] tbody tr:hover td { background: rgba(239,246,255,.7); }
[data-theme="light"] .advanced-filters,
[data-theme="light"] .category-tabs,
[data-theme="light"] .filter-toolbar { background: rgba(248,250,252,.74); border-color: rgba(51,65,85,.11); }
[data-theme="light"] .advanced-filters summary { color: #334155; }
[data-theme="light"] .advanced-filters summary:hover { background: rgba(226,232,240,.48); }
[data-theme="light"] .advanced-content { border-top-color: rgba(51,65,85,.08); }
[data-theme="light"] .category-tab { color: #64748b; }
[data-theme="light"] .category-tab:hover { color: #334155; background: rgba(226,232,240,.55); }
[data-theme="light"] .category-tab.active { color: #fff; }
[data-theme="light"] .detail-item { color: #334155; background: rgba(248,250,252,.8); border-color: rgba(51,65,85,.09); }
[data-theme="light"] .address-row { background: rgba(8,145,178,.065); }
[data-theme="light"] .success-box { color: #065f46; background: rgba(16,185,129,.1); border-color: rgba(5,150,105,.2); }
[data-theme="light"] .error-box { color: #991b1b; background: rgba(239,68,68,.08); border-color: rgba(220,38,38,.18); }
[data-theme="light"] .empty-state { color: #991b1b; }
[data-theme="light"] .user-chip { background: rgba(255,255,255,.65); }
[data-theme="light"] .hamburger { color: #334155; background: rgba(255,255,255,.78); }
[data-theme="light"] input:-webkit-autofill,
[data-theme="light"] input:-webkit-autofill:hover,
[data-theme="light"] input:-webkit-autofill:focus { -webkit-text-fill-color: #172033 !important; box-shadow: 0 0 0 1000px #fff inset !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (max-width: 1200px) {
  .filter-grid, .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .stats-grid { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 620px) {
  .filter-grid, .detail-grid { grid-template-columns: 1fr; }
  .topbar .user-chip { display: none; }
  .card { padding: 18px; border-radius: 22px; }
  .main { padding: 10px; }
  .topbar { padding: 14px; border-radius: 20px; }
  .form-actions .btn { flex: 1 1 100%; }
  .category-tabs { margin: 14px 0; }
  input:not([type="radio"]):not([type="hidden"]), select { font-size: 16px; }
  input[type="file"] { font-size: 13px; }
}

/* Final light-theme layer: intentionally last so every component is coherent. */
html[data-theme="light"] body {
  background: #f5f7fb;
  color: #172033;
}

html[data-theme="light"] .app-bg {
  background:
    radial-gradient(circle at 8% 5%, rgba(124,58,237,.09), transparent 26%),
    radial-gradient(circle at 92% 12%, rgba(6,182,212,.11), transparent 28%),
    linear-gradient(145deg, #fbfbfe 0%, #f3f7fc 52%, #f1faf9 100%) !important;
}

html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar {
  color: #172033;
  background: rgba(255,255,255,.92) !important;
  border-color: #e3e8f1;
  box-shadow: 0 18px 50px rgba(51,65,85,.09);
}

html[data-theme="light"] .card {
  color: #172033;
  background: rgba(255,255,255,.9) !important;
  border-color: #e2e8f0;
  box-shadow: 0 18px 50px rgba(51,65,85,.085);
}

html[data-theme="light"] .card::before {
  background: linear-gradient(135deg, rgba(109,40,217,.035), rgba(8,145,178,.025), transparent 48%) !important;
  opacity: 1;
}

html[data-theme="light"] .topbar h2,
html[data-theme="light"] .card-title,
html[data-theme="light"] .brand h1,
html[data-theme="light"] .result-card-head h3 { color: #172033; }

html[data-theme="light"] .topbar p,
html[data-theme="light"] .brand span,
html[data-theme="light"] .form-hint,
html[data-theme="light"] .section-heading p,
html[data-theme="light"] .result-card-head p { color: #64748b; }

html[data-theme="light"] .menu-item { color: #475569; }
html[data-theme="light"] .menu-item:hover { color: #312e81; }
html[data-theme="light"] .menu-item.active { color: #312e81; background: linear-gradient(135deg,#ede9fe,#e0f2fe) !important; border-color: #d8d4fa; }
html[data-theme="light"] .menu-item.danger { color: #b91c1c; }
html[data-theme="light"] .user-chip,
html[data-theme="light"] .theme-toggle { color: #334155; background: #f8fafc !important; border-color: #e2e8f0; }
html[data-theme="light"] .avatar {
  color: #fff !important;
  background: linear-gradient(145deg, #6d28d9 5%, #2563eb 52%, #0891b2 100%);
  border-color: rgba(255,255,255,.9);
  box-shadow: 0 0 0 3px rgba(109,40,217,.08), 0 8px 18px rgba(37,99,235,.22);
  text-shadow: 0 1px 2px rgba(15,23,42,.28);
}

html[data-theme="light"] input:not([type="radio"]):not([type="hidden"]):not(.file-native),
html[data-theme="light"] select {
  color: #172033 !important;
  background-color: #f8fafc !important;
  border-color: #dbe3ed !important;
  box-shadow: none !important;
  -webkit-text-fill-color: #172033 !important;
}

html[data-theme="light"] input:not([type="radio"]):not([type="hidden"]):focus,
html[data-theme="light"] select:focus { background-color: #fff !important; border-color: #0891b2 !important; box-shadow: 0 0 0 4px rgba(8,145,178,.11) !important; }
html[data-theme="light"] select option { color: #172033 !important; background: #fff !important; }

html[data-theme="light"] .file-picker {
  color: #334155;
  background: #f8fafc !important;
  border-color: #cbd5e1;
}
html[data-theme="light"] .file-picker:hover { background: #f0fdfa !important; border-color: #0891b2; }
html[data-theme="light"] .file-picker-action { color: #0e7490; background: #ecfeff; border-color: #bae6fd; }
html[data-theme="light"] .conditional-field { background: #ecfeff; border-color: #bae6fd; }

html[data-theme="light"] .advanced-filters,
html[data-theme="light"] .filter-toolbar,
html[data-theme="light"] .category-tabs,
html[data-theme="light"] .detail-item { background: #f8fafc !important; border-color: #e2e8f0; }
html[data-theme="light"] .advanced-filters summary,
html[data-theme="light"] .detail-item strong { color: #334155; }
html[data-theme="light"] table { background: #fff !important; }
html[data-theme="light"] th { color: #475569; background: #f1f5f9 !important; }
html[data-theme="light"] td { color: #334155; }
html[data-theme="light"] .btn-primary { box-shadow: 0 12px 28px rgba(109,40,217,.19); }

html[data-theme="light"] .badge {
  color: #065f46 !important;
  background: #d1fae5 !important;
  border-color: #6ee7b7 !important;
  box-shadow: inset 0 0 0 1px rgba(6,95,70,.035);
}

html[data-theme="light"] .badge.role-admin {
  color: #854d0e !important;
  background: #fef3c7 !important;
  border-color: #facc15 !important;
}

html[data-theme="light"] .badge.role-operator {
  color: #155e75 !important;
  background: #cffafe !important;
  border-color: #67e8f9 !important;
}

html[data-theme="light"] .badge.role-data-manager {
  color: #5b21b6 !important;
  background: #ede9fe !important;
  border-color: #c4b5fd !important;
}

html[data-theme="light"] .badge.status-inactive {
  color: #991b1b !important;
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
}

html[data-theme="light"] .inactive-row td { background: #f8fafc; color: #64748b; }
html[data-theme="light"] .guide-format { color: #0e7490; background: #ecfeff; border-color: #a5f3fc; }
html[data-theme="light"] .guide-category { background: #f8fafc; border-color: #e2e8f0; }
html[data-theme="light"] .guide-category summary strong,
html[data-theme="light"] .guide-note strong { color: #334155; }
html[data-theme="light"] .guide-body { border-top-color: #e2e8f0; }
html[data-theme="light"] .column-list li { color: #334155; background: #fff; border-color: #e2e8f0; }
html[data-theme="light"] .column-list li::before { color: #0e7490; background: #cffafe; }
html[data-theme="light"] .managed-job-item { background: #f8fafc; border-color: #e2e8f0; }
html[data-theme="light"] .inline-edit[open] > form { background: #fff; border-color: #e2e8f0; }
html[data-theme="light"] .job-combobox-list { background: #fff; border-color: #dbe3ed; box-shadow: 0 20px 45px rgba(51,65,85,.18); }
html[data-theme="light"] .job-combobox-option { color: #334155; }
html[data-theme="light"] .job-combobox-option:hover,
html[data-theme="light"] .job-combobox-option:focus { color: #164e63; background: #ecfeff; }
html[data-theme="light"] .job-combobox-clear:hover { color: #334155; background: #e2e8f0; }
html[data-theme="light"] .audit-details span { color: #475569; background: #f1f5f9; }
html[data-theme="light"] .audit-details b { color: #334155; }

@media (max-width: 920px) {
  .column-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .job-management-grid { grid-template-columns: 1fr; }
  .job-add-card { position: static; }
}

@media (max-width: 620px) {
  .file-picker { grid-template-columns: 44px minmax(0, 1fr); }
  .file-picker-action { grid-column: 1 / -1; text-align: center; }
  .upload-guide .section-heading { display: grid; }
  .guide-format { width: fit-content; }
  .column-list { grid-template-columns: 1fr; }
  .job-list-heading { grid-template-columns: 1fr; }
  .managed-job-item { align-items: flex-start; flex-direction: column; }
  .managed-job-actions { width: 100%; }
  .managed-job-actions > * { flex: 1; }
  .managed-job-actions .btn { width: 100%; }
}

/* Responsive layout layer */
@media (max-width: 1380px) and (min-width: 1081px) {
  .sidebar { width: 250px; padding: 18px; }
  .main { margin-right: 290px; padding-left: 24px; }
  .brand { gap: 10px; }
  .brand .brand-logo { width: 68px; flex-basis: 68px; }
  .brand h1 { font-size: 18px; }
  .menu-item { padding: 12px 13px; font-size: 14px; }
  .column-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  body.sidebar-open { overflow: hidden; }

  .sidebar {
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: min(310px, calc(100vw - 40px));
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 18px;
    border-radius: 24px;
    transform: translateX(calc(100% + 28px));
    visibility: hidden;
    transition: transform .28s ease, visibility .28s ease;
    z-index: 60;
  }

  .sidebar.open { transform: translateX(0); visibility: visible; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    padding: 0;
    border: 0;
    background: rgba(2, 6, 23, .62);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
  }
  body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; pointer-events: auto; }

  .main { margin-right: 0; padding: 18px; }
  .hamburger { display: grid; place-items: center; flex: 0 0 46px; color: var(--text); }
  .topbar { position: relative; height: auto; min-height: 82px; padding: 15px 18px; gap: 14px; }
  .topbar > div:nth-child(2) { min-width: 0; flex: 1; }
  .topbar h2, .topbar p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid-2, .grid-3, .stats-grid, .job-management-grid { grid-template-columns: 1fr; }
  .job-add-card { position: static; }
  .column-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .main { padding: 10px; }
  .content { margin-top: 12px; }
  .topbar { min-height: 70px; padding: 10px 12px; border-radius: 20px; }
  .topbar h2 { font-size: clamp(17px, 5vw, 20px); }
  .topbar p { display: none; }
  .topbar-actions { gap: 7px; }
  .topbar .user-chip { display: none; }
  .theme-toggle, .hamburger { width: 42px; height: 42px; flex-basis: 42px; border-radius: 13px; }
  .theme-icon { font-size: 20px; }

  .card { padding: 16px; border-radius: 20px; }
  .card-title { margin-bottom: 14px; font-size: 19px; }
  .grid { gap: 12px; }
  .form { gap: 14px; }
  .filter-grid, .detail-grid, .column-list { grid-template-columns: 1fr; }
  input:not([type="radio"]):not([type="hidden"]), select { min-height: 50px; padding-block: 12px; font-size: 16px; border-radius: 15px; }
  .btn { min-height: 46px; padding: 11px 15px; border-radius: 15px; }

  .file-picker { min-height: 0; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .file-picker-icon { width: 42px; height: 42px; border-radius: 12px; }
  .file-picker-copy small { white-space: normal; overflow-wrap: anywhere; }
  .file-picker-action { grid-column: 1 / -1; padding: 9px 12px; text-align: center; }

  .upload-guide .section-heading, .job-list-heading { grid-template-columns: 1fr; }
  .upload-guide .section-heading { display: grid; }
  .guide-category summary { padding: 14px; }
  .guide-category summary > span:first-child { min-width: 0; flex-wrap: wrap; }
  .guide-body { padding: 0 14px 14px; }
  .column-list li { min-height: 46px; }

  .category-tabs { border-radius: 15px; }
  .category-tab { padding: 10px 8px; }
  .advanced-filters summary { padding: 13px; }
  .advanced-content { padding: 4px 12px 12px; }
  .filter-toolbar { align-items: flex-start; flex-direction: column; gap: 10px; padding: 12px; }
  .form-actions, .results-heading { align-items: stretch; flex-direction: column; }
  .form-actions .btn {
    width: 100%;
    flex: none;
    min-height: 48px;
  }
  .results-heading form, .results-heading form .btn, .map-btn { width: 100%; }
  .search-panel .section-heading p { margin-top: 6px; font-size: 13px; line-height: 1.8; }
  .search-panel .category-tabs { margin: 14px 0; }
  .search-panel > .form { gap: 13px; }
  .result-card { padding: 16px; }
  .result-card-head { align-items: flex-start; }

  .managed-job-item { align-items: stretch; flex-direction: column; }
  .managed-job-list { max-height: none; overflow: visible; gap: 9px; }
  .managed-job-item { gap: 11px; padding: 12px; border-radius: 15px; }
  .managed-job-meta {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 5px 10px;
  }
  .managed-job-meta .badge { grid-row: 1 / span 2; align-self: start; }
  .managed-job-meta strong { width: auto; white-space: normal; overflow-wrap: anywhere; }
  .managed-job-meta small { grid-column: 2; }
  .managed-job-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .managed-job-actions > *, .managed-job-actions .btn { width: 100%; }
  .managed-job-actions .btn { min-height: 42px; padding: 8px 10px; border-radius: 13px; font-size: 13px; }
  .inline-edit[open] > form { position: fixed; inset: auto 10px 10px; width: auto; flex-direction: column; z-index: 80; }

  .table-wrap { margin-inline: -4px; border-radius: 16px; scrollbar-width: thin; }
  table { min-width: 720px; }
  th, td { padding: 12px; white-space: nowrap; }
  td .btn { min-height: 40px; padding: 8px 11px; }
  .audit-filters { grid-template-columns: 1fr 1fr; }
  .audit-filters .form-group { grid-column: 1 / -1; }
  .audit-filters .btn { width: 100%; }
}

@media (max-width: 390px) {
  .main { padding: 7px; }
  .topbar { padding: 9px; }
  .card { padding: 14px; }
  .sidebar { right: 7px; top: 7px; bottom: 7px; width: calc(100vw - 14px); max-height: calc(100dvh - 14px); }
  .search-panel { padding: 14px; }
  .search-panel .card-title { font-size: 18px; }
  .search-panel .category-tab { font-size: 14px; }
}
