:root {
  --canvas: #f5f7f9;
  --surface: #ffffff;
  --surface-alt: #f8fafb;
  --ink: #132f3f;
  --ink-soft: #466171;
  --muted: #748793;
  --navy: #082f43;
  --navy-2: #0d4559;
  --teal: #0f8c7c;
  --teal-dark: #087265;
  --teal-soft: #e8f7f3;
  --cyan: #32bfd0;
  --blue-soft: #ebf4fb;
  --line: #dce6eb;
  --line-strong: #c8d6de;
  --danger: #b83b48;
  --danger-soft: #fff0f1;
  --warn: #8e6118;
  --warn-soft: #fff7e6;
  --success: #087064;
  --success-soft: #e8f7f3;
  --shadow-sm: 0 4px 14px rgba(8, 47, 67, .055);
  --shadow: 0 14px 38px rgba(8, 47, 67, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-page { background: var(--canvas); }

.topbar {
  height: 70px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
}
.topbar-inner {
  height: 100%;
  max-width: 1800px;
  margin: auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
}
.topbar-context {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  margin-left: auto;
  font-size: 12px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #21b68f;
  box-shadow: 0 0 0 5px rgba(33, 182, 143, .12);
}
.mobile-brand { display: none; align-items: center; gap: 9px; }
.userbox { display: flex; align-items: center; gap: 10px; min-width: 155px; }
.userbox strong { display: block; font-size: 13px; line-height: 1.45; }
.userbox small { display: block; color: var(--muted); font-size: 11px; }
.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--navy-2));
  font-size: 16px;
  font-weight: 900;
}

.app-shell {
  max-width: 1800px;
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  direction: rtl;
}
.sidebar {
  min-width: 0;
  height: calc(100vh - 70px);
  position: sticky;
  top: 70px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 18px 18px;
  background: var(--navy);
  color: #fff;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 7px; }
.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--navy);
  background: linear-gradient(135deg, #aaf2d9 0%, #49d0dc 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4), 0 9px 20px rgba(39, 202, 192, .2);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -.5px;
}
.brand-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.brand-mark.large { width: 64px; height: 64px; border-radius: 21px; font-size: 22px; }
.brand h1 { margin: 0; font-size: 15px; line-height: 1.5; }
.brand small { color: #a9c1cb; font-size: 11px; }
.nav { display: grid; gap: 6px; }
.nav a {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 13px;
  color: #c9dae1;
  border: 1px solid transparent;
  transition: .18s ease;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(31, 174, 157, .28), rgba(50, 191, 208, .12));
  border-color: rgba(110, 226, 211, .16);
  box-shadow: inset -3px 0 0 #5bd9c6;
}
.nav-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  color: #8de4d4;
  font-size: 16px;
  font-weight: 900;
}
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.sidebar-foot form { margin: 0; }
.version-pill { color: #90adb9; font-size: 11px; padding: 0 10px; }
.logout {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .045);
  color: #c7d8df;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: right;
}
.logout:hover { background: rgba(255, 255, 255, .09); color: #fff; }

.content { min-width: 0; direction: rtl; }
.content-inner { max-width: 1460px; margin: auto; padding: 28px 30px 70px; }
.page-head, .section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head { margin: 0 0 20px; }
.section-head { align-items: center; margin-bottom: 16px; }
.page-head h2 { margin: 2px 0 0; color: var(--navy); font-size: 27px; line-height: 1.45; letter-spacing: -.5px; }
.page-head p, .section-head p { margin: 3px 0 0; color: var(--muted); }
.section-head h3 { margin: 0; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .15px;
}
.eyebrow.light { color: #a9f0e0; }

.dashboard-hero {
  min-height: 155px;
  position: relative;
  overflow: hidden;
  margin: 0 0 18px;
  padding: 27px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 24px;
  color: #fff;
  background: radial-gradient(circle at 10% 20%, rgba(67, 220, 202, .32), transparent 24%), linear-gradient(120deg, #073349 0%, #075f66 100%);
  box-shadow: 0 18px 42px rgba(8, 47, 67, .16);
}
.dashboard-hero::after {
  content: "";
  width: 230px;
  height: 230px;
  position: absolute;
  left: -55px;
  bottom: -150px;
  border: 34px solid rgba(255, 255, 255, .07);
  border-radius: 50%;
}
.dashboard-hero h2 { margin: 5px 0 2px; font-size: 27px; }
.dashboard-hero p { margin: 0; color: #d2e8eb; }
.hero-date { position: relative; z-index: 1; min-width: 205px; padding: 13px 16px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.07); border-radius: 15px; }
.hero-date small, .hero-date strong { display: block; }
.hero-date small { color: #add1d4; }
.hero-date strong { font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card, .kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card { padding: 20px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; color: var(--navy); font-size: 17px; }
.kpi {
  min-height: 124px;
  position: relative;
  overflow: hidden;
  padding: 17px 18px;
}
.kpi::after {
  content: "";
  width: 70px;
  height: 70px;
  position: absolute;
  left: -22px;
  bottom: -28px;
  border-radius: 50%;
  background: rgba(15, 140, 124, .055);
}
.kpi.accent { border-color: #bfe5dc; background: linear-gradient(145deg, #fff, #f1fbf8); }
.kpi.critical { border-color: #efcbd0; background: linear-gradient(145deg, #fff, #fff4f5); }
.kpi.warning { border-color: #efd9ab; background: linear-gradient(145deg, #fff, #fff9ed); }
.kpi strong { display: block; color: var(--navy); font-size: 29px; line-height: 1.45; font-weight: 900; }
.kpi small { color: var(--muted); }
.kpi-icon { width: 28px; height: 28px; display: grid; place-items: center; float: left; border-radius: 9px; color: var(--teal); background: var(--teal-soft); font-size: 15px; font-weight: 900; }
.big-number { color: var(--teal-dark); font-size: 44px; line-height: 1.2; font-weight: 900; }
.readiness-list { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--line); }
.readiness-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 13px; background: #fff; }
.readiness-list span { color: var(--ink-soft); }
.readiness-list strong { color: var(--navy); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.table-wrap.compact table { min-width: 420px; }
table { width: 100%; border-collapse: collapse; background: #fff; min-width: 780px; }
th, td { padding: 11px 12px; text-align: right; border-bottom: 1px solid #e9eff2; vertical-align: middle; }
th { background: #f2f7f8; color: #365361; font-size: 11px; font-weight: 900; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .14s ease; }
tbody tr:hover td { background: #fbfdfd; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fields-3 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; }
.fields .wide { grid-column: 1 / -1; }
label { display: block; color: #294a5a; font-weight: 800; font-size: 12px; }
input, select, textarea {
  width: 100%;
  min-height: 43px;
  margin-top: 5px;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: 11px;
  padding: 9px 11px;
  outline: 0;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(15, 140, 124, .1); }
input[type="file"] { padding: 7px; }
input[type="checkbox"] { width: 18px; min-height: 18px; margin-left: 6px; vertical-align: middle; }
textarea { min-height: 94px; resize: vertical; }

.btn {
  min-height: 40px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--navy);
  border-radius: 11px;
  padding: 8px 14px;
  font-weight: 900;
  font-size: 12px;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(8,47,67,.09); }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--teal), #0aa18c); border-color: var(--teal); }
.btn.navy { color: #fff; background: var(--navy); border-color: var(--navy); }
.btn.danger { color: var(--danger); border-color: #edc8cd; background: #fffafa; }
.btn.small { min-height: 32px; padding: 5px 9px; font-size: 11px; }
.btn:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions select, .actions input { width: auto; min-width: 130px; margin: 0; }
.align-end { align-self: end; padding-bottom: 1px; }

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 10px;
  line-height: 1.5;
  font-weight: 900;
  white-space: nowrap;
  background: var(--blue-soft);
  color: #275f81;
  border: 1px solid rgba(39, 95, 129, .09);
}
.tag.good { background: var(--success-soft); color: var(--success); border-color: #c7ebe3; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: #efdcaf; }
.tag.danger { background: var(--danger-soft); color: var(--danger); border-color: #f2ccd1; }
.tag.gray { background: #eff3f5; color: #667782; border-color: #e1e8eb; }
.notice {
  border-radius: 14px;
  padding: 12px 15px;
  margin: 0 0 16px;
  border: 1px solid #cbe8e1;
  background: var(--success-soft);
  color: #075f56;
  box-shadow: var(--shadow-sm);
}
.notice.info { border-color: #cfe2ed; background: #eef7fb; color: #235a74; }
.notice.warn { border-color: #eddaa8; background: var(--warn-soft); color: #795112; }
.notice.danger { border-color: #efc7cc; background: var(--danger-soft); color: var(--danger); }
.muted { color: var(--muted); }
.code { direction: ltr; unicode-bidi: embed; display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong-link { color: var(--teal-dark); font-weight: 900; }
.strong-link:hover { text-decoration: underline; }
.cell-sub { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.date-cell { white-space: nowrap; font-size: 11px; }
.user-chip { display: inline-flex; padding: 3px 8px; border-radius: 8px; background: #f0f4f6; font-family: ui-monospace, monospace; font-size: 11px; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: radial-gradient(circle at 15% 15%, rgba(78, 208, 197, .18), transparent 28%), radial-gradient(circle at 90% 85%, rgba(50, 191, 208, .12), transparent 27%), #edf2f4;
}
.login-shell {
  width: min(940px, 100%);
  min-height: 540px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  border-radius: 28px;
  background: #fff;
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 34px 100px rgba(8, 47, 67, .18);
}
.login-visual {
  padding: 54px 48px;
  color: #fff;
  background: radial-gradient(circle at 10% 20%, rgba(77, 218, 197, .27), transparent 29%), linear-gradient(145deg, #073147, #075e64);
  position: relative;
  overflow: hidden;
}
.login-visual::after { content: ""; width: 260px; height: 260px; position: absolute; left: -100px; bottom: -120px; border: 44px solid rgba(255,255,255,.06); border-radius: 50%; }
.login-visual .eyebrow { margin-top: 30px; }
.login-visual h1 { margin: 12px 0; font-size: 35px; line-height: 1.55; letter-spacing: -.8px; }
.login-visual > p { color: #c8e0e4; max-width: 380px; }
.login-points { display: grid; gap: 10px; margin-top: 42px; color: #d7ebec; font-size: 12px; }
.login-points span::before { content: "✓"; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 8px; border-radius: 50%; color: #97f0db; background: rgba(255,255,255,.08); }
.login-card { align-self: center; padding: 48px 44px; }
.login-card h2 { margin: 3px 0 0; color: var(--navy); font-size: 27px; }
.login-card > p { margin: 4px 0; color: var(--muted); }
.login-card form { display: grid; gap: 13px; margin-top: 24px; }
.login-card .btn { width: 100%; min-height: 46px; margin-top: 4px; }
.login-foot { margin-top: 20px !important; text-align: center; font-size: 11px; }

.order-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(110px, .7fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 9px 0;
  background: var(--surface-alt);
}
.inline-details { min-width: 120px; }
.inline-details summary { cursor: pointer; list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.mini-form { min-width: 260px; display: grid; gap: 8px; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.mapping-form { min-width: 330px; display: flex; gap: 7px; align-items: center; }
.mapping-form select { min-width: 230px; margin: 0; }
.variant-card { border-right: 4px solid #75cdbf; }
.variant-card h4 { margin: 18px 0 8px; color: var(--ink-soft); font-size: 13px; }
.compact-card { margin-bottom: 0; }
.check-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.check-option { display: inline-flex; align-items: center; gap: 4px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-alt); }
.check-option input { margin: 0; }
.safety-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-right: 4px solid var(--teal); }
.safety-card h3 { margin-bottom: 4px; }
.blocker-card { border-right: 4px solid var(--danger); }
.check-list, .step-list { margin: 8px 0 0; padding-right: 22px; }
.check-list li, .step-list li { margin: 4px 0; }
.danger-list { color: #85323b; }
.technical-details { margin-top: 5px; }
.technical-details summary { width: fit-content; cursor: pointer; color: var(--muted); font-size: 10px; }
.technical-details pre { max-width: 430px; max-height: 180px; overflow: auto; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-word; padding: 10px; border-radius: 9px; background: #f3f6f7; color: #49606c; font-size: 10px; }
.audit-description { font-size: 12px; color: #294b5b; }
.empty { text-align: center; color: var(--muted); padding: 38px 18px; }
.danger-row td { background: #fff8f8; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 225px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .content-inner { padding-inline: 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .topbar { height: 62px; }
  .topbar-inner { padding: 0 14px; justify-content: space-between; }
  .mobile-brand { display: flex; }
  .topbar-context { display: none; }
  .app-shell { min-height: calc(100vh - 62px); display: block; }
  .sidebar { height: auto; position: sticky; top: 62px; z-index: 40; display: block; padding: 8px 10px; overflow: visible; border-top: 1px solid rgba(255,255,255,.05); box-shadow: 0 8px 20px rgba(8,47,67,.13); }
  .sidebar > .brand, .version-pill { display: none; }
  .nav { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; min-height: 39px; padding: 6px 10px; border-radius: 10px; }
  .nav a.active { box-shadow: inset 0 -3px 0 #5bd9c6; }
  .nav-icon { width: 23px; height: 23px; font-size: 13px; }
  .sidebar-foot { display: none; }
  .content-inner { padding: 18px 14px 48px; }
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; max-width: 500px; }
  .login-visual { display: none; }
}
@media (max-width: 620px) {
  .topbar-inner { gap: 10px; }
  .userbox { min-width: 0; }
  .userbox > div:last-child { display: none; }
  .content-inner { padding-inline: 10px; }
  .dashboard-hero { min-height: 145px; padding: 22px 20px; border-radius: 19px; }
  .dashboard-hero h2 { font-size: 22px; }
  .hero-date { display: none; }
  .page-head h2 { font-size: 22px; }
  .kpis, .kpis-3, .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .kpi { min-height: 110px; padding: 14px; }
  .kpi strong { font-size: 23px; }
  .card { padding: 15px; border-radius: 15px; }
  .fields, .fields-3 { grid-template-columns: 1fr; }
  .fields .wide { grid-column: auto; }
  .align-end { align-self: auto; }
  .order-row { grid-template-columns: 1fr; }
  .mapping-form { min-width: 250px; display: grid; }
  .mapping-form select { min-width: 0; }
  .safety-card { align-items: flex-start; flex-direction: column; }
  .login-page { padding: 13px; }
  .login-card { padding: 32px 23px; }
}
@media (max-width: 390px) {
  .kpis, .kpis-3, .kpis-4 { grid-template-columns: 1fr; }
}
