:root {
  --paper: #F2F4F6;
  --rail: #E4E8ED;
  --surface: #FFFFFF;
  --subtle: #F6F8FA;
  --ink: #121926;
  --text: #2A3344;
  --muted: #5C6674;
  --hairline: #DCE1E8;
  --line-strong: #C3CAD4;
  --control: #C7CED6;
  --primary: #1E4C78;
  --primary-hover: #163A5C;
  --tint: #E3EDF6;
  --danger: #B42318;
  --danger-tint: #FBEDEB;
  --success: #2E7D4F;
  --success-tint: #EAF4EE;
  --warning: #A15C07;
  --warning-tint: #FBF1E3;
  --info: #3D6A93;
  --stitch: #B7C1CD;
  --ring: rgba(30, 76, 120, .16);
  --line: var(--hairline);

  --rail-w: 244px;
  --top-h: 58px;
  --r-panel: 8px;
  --r-control: 6px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;

  --fs: 16px;
  --fs-title: 22px;
  --fs-stat: 26px;
  --fs-panel: 15px;
  --fs-nav: 15px;
  --fs-btn: 15px;
  --fs-table: 15px;
  --fs-label: 13.5px;
  --fs-small: 13px;
  --fs-tiny: 12px;

  --bs-body-font-family: var(--font);
  --bs-body-font-size: 16px;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--hairline);
  --bs-link-color-rgb: 30, 76, 120;
}

[data-theme="dark"] {
  --paper: #12161D;
  --rail: #171C24;
  --surface: #1C222B;
  --subtle: #202731;
  --ink: #E6EAF0;
  --text: #CBD2DC;
  --muted: #98A2B0;
  --hairline: #2A313C;
  --line-strong: #39424F;
  --control: #3A4350;
  --primary: #3F74A8;
  --primary-hover: #4C83B9;
  --tint: #1F2D3D;
  --danger: #E26A5E;
  --danger-tint: #3A1E1C;
  --success: #5DB285;
  --success-tint: #183025;
  --warning: #D49A45;
  --warning-tint: #33270F;
  --info: #7FA6CC;
  --stitch: #46505E;
  --ring: rgba(111, 160, 210, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  min-height: 100%;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
body { margin: 0; }
button, input, select, textarea { font-family: inherit; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 600; }
h2, .h5 { font-size: 18px; line-height: 1.4; }
.text-muted { color: var(--muted) !important; }
.text-danger { color: var(--danger) !important; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- shell ---------- */

.app-shell { min-height: 100vh; display: flex; }

.app-rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--rail);
  border-inline-end: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 0 0 28px;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  margin: 0 10px 4px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  overflow: hidden;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-text { min-width: 0; }
.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-tiny);
  font-weight: 500;
}

.app-nav { padding: 8px 10px 16px; }
.nav-group {
  margin: 6px 0;
  border: 0;
}
.nav-group summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  margin-bottom: 2px;
  list-style: none;
  cursor: pointer;
  font-size: 14pt;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
  border-radius: var(--r-control);
}
.nav-group:has(a.active) summary { color: var(--ink); }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::marker { content: ""; }
.nav-group summary:hover { color: var(--ink); background: rgba(23, 32, 54, .04); }
[data-theme="dark"] .nav-group summary:hover { background: rgba(255, 255, 255, .04); }
.nav-group summary i {
  font-size: 12px;
  transition: transform .15s ease;
}
.nav-group[open] summary i { transform: rotate(180deg); }
.nav-group a { padding-inline-start: 22px; }
.app-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  margin-bottom: 1px;
  border-radius: var(--r-control);
  color: var(--text);
  font-size: var(--fs-nav);
  font-weight: 500;
  text-decoration: none;
}
.app-nav a i { font-size: 16px; color: var(--muted); width: 18px; text-align: center; }
.app-nav a:hover { background: rgba(23, 32, 54, .05); color: var(--ink); }
[data-theme="dark"] .app-nav a:hover { background: rgba(255, 255, 255, .05); }
.app-nav a.active {
  background: var(--tint);
  color: var(--primary);
  font-weight: 600;
  border-radius: 0 var(--r-control) var(--r-control) 0;
}
[dir="rtl"] .app-nav a.active { border-radius: var(--r-control) 0 0 var(--r-control); }
.app-nav a.active i { color: var(--primary); }
.app-nav a.active::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--primary);
}

.rail-backdrop { display: none; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-top {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--control);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font-size: 20px;
  padding: 0;
}

.top-search { position: relative; flex: 1; max-width: 560px; margin: 0; }
.top-search i {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}
.top-search .form-control {
  height: 38px;
  min-height: 38px;
  padding-inline-start: 36px;
  font-size: 14.5px;
  background: var(--subtle);
}
.top-search .form-control:focus { background: var(--surface); }

.top-right {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
}
.top-right form { margin: 0; }
.icon-btn {
  height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}
.icon-btn i { font-size: 16px; }
.icon-btn:hover { background: var(--subtle); color: var(--ink); border-color: var(--hairline); }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.25;
  padding-inline: 2px 4px;
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
}
.user-chip span { display: flex; flex-direction: column; }
.user-chip small { color: var(--muted); font-size: var(--fs-tiny); font-weight: 400; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-control);
  background: var(--tint);
  color: var(--primary);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.branch-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--surface);
  min-width: 0;
}
.branch-switch i { color: var(--muted); font-size: 15px; flex-shrink: 0; }
.branch-switch select {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  height: 34px;
  max-width: 170px;
  padding: 0 4px;
  cursor: pointer;
}
.branch-switch select:focus { outline: none; }

.check-grid {
  display: grid;
  gap: 6px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--subtle);
  font-size: 15px;
  cursor: pointer;
}
.check-item:hover { border-color: var(--line-strong); background: var(--surface); }
.check-item small { color: var(--muted); font-size: var(--fs-tiny); margin-inline-start: 4px; }

.app-page { padding: 22px 32px 56px; width: 100%; max-width: none; flex: 1; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: var(--fs-title);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.3;
}
.page-sub { margin: 3px 0 0; color: var(--muted); font-size: var(--fs-small); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-actions form { margin: 0; }

/* ---------- panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-panel);
  overflow-x: auto;
}
form.panel { display: block; }
.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-panel);
  font-weight: 600;
  color: var(--ink);
}
.panel-h .count {
  font-size: var(--fs-tiny);
  font-weight: 500;
  color: var(--muted);
  background: var(--subtle);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 8px;
}
.panel-h a { font-size: var(--fs-small); font-weight: 500; }
.panel > .panel-h + .panel-h,
.panel > .table + .panel-h,
.panel > .panel-b + .panel-h { border-top: 1px solid var(--hairline); }
.panel-b { padding: 18px 20px; }
.panel-b h6 {
  font-size: var(--fs-panel);
  font-weight: 600;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}
.empty {
  padding: 36px 20px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}
.empty a { font-weight: 600; margin-inline-start: 4px; }

.panel dl:not(.row) dt { font-size: var(--fs-small); font-weight: 500; color: var(--muted); }
.panel dl:not(.row) dd { margin-bottom: 10px; color: var(--ink); font-size: 15px; }
.panel dl.row dt { font-weight: 500; color: var(--muted); font-size: var(--fs-small); }
.panel dl.row dd { color: var(--ink); font-size: 15px; }

/* ---------- stat strip ---------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-panel);
  margin-bottom: 16px;
  overflow: hidden;
}
.stat-cell {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
  padding: 16px 18px 18px;
  border-inline-start: 1px solid var(--hairline);
}
.stat-cell:first-child { border-inline-start: 0; }
.stat-cell .n {
  font-size: var(--fs-stat);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.stat-cell .l { font-size: var(--fs-small); color: var(--muted); font-weight: 500; }
.stat-cell.alert .n { color: var(--danger); }
.stat-cell.alert .l::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--danger);
  margin-inline-end: 6px;
  vertical-align: 1px;
}

/* ---------- filters ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 12px 16px;
  margin: 0;
  background: var(--subtle);
  border-bottom: 1px solid var(--hairline);
}
.filter-bar > div { display: flex; flex-direction: column; }
.filter-bar label {
  font-size: var(--fs-tiny);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.filter-bar .form-control { min-width: 220px; }
.filter-bar .form-select { min-width: 150px; }
.filter-bar .form-control,
.filter-bar .form-select,
.filter-bar .btn { height: 38px; min-height: 38px; font-size: 14.5px; }
.filter-bar .form-control, .filter-bar .form-select { background-color: var(--surface); }
.filter-bar .form-select { background-color: var(--surface); }

/* ---------- tables ---------- */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-hover-bg: var(--subtle);
  --bs-table-border-color: var(--hairline);
  font-size: var(--fs-table);
  margin: 0;
  color: var(--text);
}
.table > :not(caption) > * > * {
  background: transparent;
  color: inherit;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.table > :not(caption) > * > *:first-child { padding-inline-start: 16px; }
.table > :not(caption) > * > *:last-child { padding-inline-end: 16px; }
.table > :not(:first-child) { border-top: 0; }
.table thead th {
  background: var(--subtle);
  font-size: var(--fs-tiny);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline) !important;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr:hover > * { background: var(--subtle); }
.table td.text-muted { padding-top: 20px; padding-bottom: 20px; }
.table .name { color: var(--ink); font-weight: 600; }
a.name:hover { color: var(--primary); }
.table .sub, .sub { display: block; font-size: var(--fs-tiny); color: var(--muted); font-weight: 400; margin-top: 1px; }
.panel-b .table > :not(caption) > * > *:first-child { padding-inline-start: 0; }
.panel-b .table > :not(caption) > * > *:last-child { padding-inline-end: 0; }
.panel-b .table thead th { background: transparent; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.row-acts { display: flex; justify-content: flex-end; gap: 4px; }
.ibtn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-control);
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 15px;
}
.ibtn:hover { color: var(--ink); background: var(--subtle); border-color: var(--hairline); text-decoration: none; }
.ibtn.danger:hover { color: var(--danger); background: var(--danger-tint); border-color: transparent; }

/* ---------- status ---------- */

.st {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.st i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--muted);
  flex-shrink: 0;
}
.st.ok i { background: var(--success); }
.st.warn i { background: var(--warning); }
.st.bad i { background: var(--danger); }
.st.info i { background: var(--info); }

/* ---------- sewn label (dress / booking codes) ---------- */

.tag {
  position: relative;
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  padding: 2px 9px 2px 11px;
  font-size: var(--fs-tiny);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--primary);
  border-radius: 2px 4px 4px 2px;
  white-space: nowrap;
  vertical-align: middle;
}
.tag::after {
  content: "";
  position: absolute;
  inset: 2px 2px 2px 3px;
  border: 1px dashed var(--stitch);
  border-radius: 2px;
  pointer-events: none;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-control);
  font-size: var(--fs-btn);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
}
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  color: #fff !important;
}
.btn-light, .btn-outline-secondary {
  background: var(--surface);
  border: 1px solid var(--control);
  color: var(--ink);
}
.btn-light:hover, .btn-outline-secondary:hover, .btn-light:active {
  background: var(--subtle) !important;
  border-color: var(--line-strong) !important;
  color: var(--ink) !important;
}
.btn-danger {
  background: var(--danger);
  border: 1px solid var(--danger);
  color: #fff;
}
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--ring); outline: none; }

/* ---------- forms ---------- */

.form-label {
  display: block;
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.form-label .req { color: var(--danger); margin-inline-start: 2px; }
.form-text { font-size: var(--fs-small); color: var(--muted); margin-top: 4px; }

.form-control, .form-select {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 15px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--control);
  border-radius: var(--r-control);
  box-shadow: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.form-select { padding-inline-end: 11px; padding-inline-start: 2.2rem; background-position: left 11px center; }
textarea.form-control { min-height: 76px; line-height: 1.6; }
[dir="rtl"] input[type="number"].form-control,
[dir="rtl"] input[type="date"].form-control { text-align: right; }
.form-control::placeholder { color: #8A93A0; opacity: 1; }
.form-control:hover, .form-select:hover { border-color: var(--line-strong); }
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
  background-color: var(--surface);
  color: var(--ink);
}
[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2398A2B0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

.form-control.is-invalid, .form-select.is-invalid, .input-validation-error {
  border-color: var(--danger) !important;
  background-image: none !important;
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .15); }
.field-validation-error, .atp-field-error {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-small);
  color: var(--danger);
}
.validation-summary-valid { display: none !important; }
.validation-summary-errors {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 14px;
}
.validation-summary-errors ul {
  margin: 0;
  padding: 10px 14px;
  list-style: none;
  background: var(--danger-tint);
  border: 1px solid rgba(180, 35, 24, .25);
  border-radius: var(--r-control);
}

.form-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  margin: 20px -20px -18px;
  background: var(--subtle);
  border-top: 1px solid var(--hairline);
  border-radius: 0 0 var(--r-panel) var(--r-panel);
}

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-control);
  background: var(--subtle);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.file-btn input { display: none; }
.file-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--tint); }
.file-note { font-size: var(--fs-small); color: var(--muted); margin-inline-start: 10px; }

/* ---------- flash ---------- */

.flash {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid;
  border-radius: var(--r-control);
  margin-bottom: 16px;
  font-size: 14.5px;
  font-weight: 500;
}
.flash-ok { background: var(--success-tint); border-color: rgba(46, 125, 79, .3); color: var(--success); }
.flash-err { background: var(--danger-tint); border-color: rgba(180, 35, 24, .3); color: var(--danger); }

/* ---------- pager ---------- */

.pager {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid var(--hairline);
}
.pager a, .pager span {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--control);
  border-radius: var(--r-control);
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.pager a:hover { background: var(--subtle); color: var(--ink); }
.pager .on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ---------- layout helpers ---------- */

.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.quick-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
}
.quick-links a:nth-child(odd) { border-inline-end: 1px solid var(--hairline); }
.quick-links a:nth-last-child(-n+2) { border-bottom: 0; }
.quick-links a i { color: var(--primary); font-size: 16px; }
.quick-links a:hover { background: var(--subtle); color: var(--primary); }

/* ---------- dress catalog ---------- */

.dress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 16px;
  padding: 16px;
}
.dress-grid > p,
.dress-grid > .empty { grid-column: 1 / -1; }
.dress-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-panel);
  color: inherit;
  overflow: hidden;
  text-decoration: none !important;
  transition: border-color .12s ease;
}
.dress-card:hover { border-color: var(--line-strong); color: inherit; }
.dress-card:hover .name { color: var(--primary); }
.dress-frame {
  position: relative;
  aspect-ratio: 3 / 4;
  margin: 8px 8px 0;
  background: var(--subtle);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  overflow: hidden;
}
.dress-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dress-ph {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #9AA3AF;
  font-size: var(--fs-small);
}
.dress-ph i { font-size: 26px; }
.dress-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.dress-card .name { font-weight: 600; color: var(--ink); font-size: 15px; margin-top: 6px; }
.dress-card .foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
}
.dress-card .price { font-weight: 600; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }

.dress-hero {
  width: 148px;
  height: 196px;
  object-fit: cover;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--subtle);
  flex-shrink: 0;
}

.thumb-row { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb-row > img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--hairline);
  border-radius: 4px;
}
.thumb { width: 88px; position: relative; }
.thumb img { width: 88px; height: 88px; object-fit: cover; border: 1px solid var(--hairline); border-radius: 4px; }
.thumb .main-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  padding: 0 6px;
  border-radius: 3px;
}

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--surface);
}
.login-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 48px 44px;
  background: var(--primary);
  color: #fff;
  min-height: 100vh;
}
.login-side .brand-mark {
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  background: #fff;
  border-color: rgba(255, 255, 255, .2);
}
.login-side h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0;
  color: #fff;
  line-height: 1.3;
}
.login-side p {
  margin: 8px 0 0;
  font-size: 16px;
  color: rgba(255, 255, 255, .78);
  font-weight: 400;
  max-width: 28ch;
}
.login-side-foot {
  margin: 0 !important;
  font-size: 14px !important;
  color: rgba(255, 255, 255, .62) !important;
  max-width: 36ch;
}
.login-body {
  position: relative;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--surface);
  min-height: 100vh;
}
.login-theme {
  position: absolute;
  top: 20px;
  inset-inline-end: 20px;
}
.login-panel { width: 100%; max-width: 400px; margin-inline: auto; }
.login-body h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}
.login-lead {
  margin: 0 0 22px;
  font-size: 15px;
  color: var(--muted);
}
.login-body .btn-primary { width: 100%; height: 42px; font-size: 16px; }
.login-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  color: var(--text);
  margin: 4px 0 18px;
  cursor: pointer;
}
.login-check input { margin: 0; flex-shrink: 0; }

/* ---------- calendar ---------- */

.fc { direction: rtl; }
.fc .fc-toolbar-title { font-size: 18px; font-family: var(--font); font-weight: 600; color: var(--ink); }
.fc .fc-button-primary {
  background: var(--surface) !important;
  border: 1px solid var(--control) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
}
.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid { border-color: var(--hairline); }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--text); }
.fc .fc-daygrid-day.fc-day-today { background: var(--tint); }

/* ---------- responsive ---------- */

@media (max-width: 1200px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-cell { border-bottom: 1px solid var(--hairline); }
  .stat-cell:nth-child(3n+1) { border-inline-start: 0; }
}
@media (max-width: 960px) {
  .app-rail {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    height: 100vh;
    width: 260px;
    background: var(--rail);
    transform: translateX(110%);
    transition: transform .2s ease;
    z-index: 60;
  }
  .app-rail.open { transform: none; box-shadow: 0 0 0 1px var(--hairline), 0 8px 24px rgba(23, 32, 54, .12); }
  .rail-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(23, 32, 54, .32);
  }
  .menu-btn { display: inline-grid; }
  .app-top {
    height: auto;
    min-height: var(--top-h);
    flex-wrap: wrap;
    padding: 8px 14px;
    gap: 8px;
  }
  .app-page { padding: 16px 14px 36px; }
  .user-chip span { display: none; }
  .branch-switch select { max-width: 96px; }
  .top-search { order: 5; flex: 1 1 100%; max-width: none; }
}
@media (max-width: 640px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cell { padding: 12px 14px; }
  .stat-cell:nth-child(3n+1) { border-inline-start: 1px solid var(--hairline); }
  .stat-cell:nth-child(odd) { border-inline-start: 0; }
  .stat-cell:last-child:nth-child(odd) { grid-column: 1 / -1; border-bottom: 0; }
  .stat-cell .n { font-size: 22px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 20px; }
  .top-right .logout-text { display: none; }
  .filter-bar > div { flex: 1 1 140px; }
  .filter-bar .form-control, .filter-bar .form-select { min-width: 0; width: 100%; }
  .dress-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
  .quick-links { grid-template-columns: 1fr; }
  .quick-links a:nth-child(odd) { border-inline-end: 0; }
  .quick-links a:nth-last-child(2) { border-bottom: 1px solid var(--hairline); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { min-height: 0; padding: 28px 22px 22px; }
  .login-body { min-height: 0; padding: 52px 22px 36px; }
}

@media print {
  .app-rail, .app-top, .page-actions, .no-print, .rail-backdrop { display: none !important; }
  .app-page { padding: 0; }
  .panel { border: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
