:root {
  color-scheme: light;
  --ink: var(--sameem-text);
  --muted: var(--sameem-text-muted);
  --paper: var(--sameem-bg-canvas);
  --surface: var(--sameem-surface);
  --surface-soft: var(--sameem-bg-subtle);
  --line: var(--sameem-border);
  --primary: var(--sameem-emerald);
  --primary-dark: var(--sameem-navy);
  --primary-light: var(--sameem-bg-subtle);
  --accent: var(--sameem-gold);
  --danger: var(--sameem-danger);
  --shadow: none;
  --shadow-soft: none;
  --radius: var(--sameem-radius-control);
  --font: var(--sameem-font-interface);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; max-width: 100%; overflow-x: clip; background: var(--paper); }

body {
  margin: 0;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  font-size: var(--sameem-body-size);
  line-height: var(--sameem-body-line);
}

button, input:not([type="checkbox"]), select, textarea { min-height: var(--sameem-control-min); font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:lang(en),
.sameem-latin,
.sameem-number,
.numeric-cell,
.page-number,
.summary-card strong,
.metadata-pill,
.count-badge,
.sku-text,
[dir="ltr"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
code,
pre {
  font-family: var(--sameem-font-numeric);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: var(--sameem-numeric-tracking);
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--sameem-focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  z-index: 100;
  transform: translateY(-160%);
  padding: var(--sameem-space-3) var(--sameem-space-4);
  border-radius: var(--sameem-radius-control);
  color: var(--sameem-text-inverse);
  background: var(--sameem-bg-inverse);
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.network-banner {
  position: sticky;
  inset-block-start: 0;
  z-index: 80;
  padding: var(--sameem-space-2) var(--sameem-space-5);
  color: var(--sameem-white);
  background: var(--sameem-danger-text);
  text-align: center;
  font-size: .86rem;
}

.network-dot { display: inline-block; width: 8px; height: 8px; margin-inline-end: var(--sameem-space-2); border-radius: 50%; background: var(--sameem-warning); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  flex-wrap: wrap;
  margin: 0 auto;
  padding: var(--sameem-space-5) var(--sameem-gutter-desktop);
  background: var(--sameem-surface);
}

.brand { display: flex; align-items: center; gap: var(--sameem-space-4); min-width: 0; }
.nsk-lockup { display: inline-grid; grid-template-columns: auto auto; align-items: end; gap: var(--sameem-space-2); color: var(--sameem-text-inverse); text-decoration: none; }
.nsk-wordmark { position: relative; color: var(--sameem-white); font-family: var(--sameem-font-numeric); font-size: clamp(1.9rem, 4vw, 3rem); font-weight: var(--sameem-font-bold); letter-spacing: -.07em; line-height: .78; }
.nsk-wordmark::after { content: ""; position: absolute; inset-inline-end: -5px; inset-block: -4px -7px; width: 4px; transform: skew(-11deg); background: var(--sameem-mint); }
.nsk-arabia { padding-inline-start: var(--sameem-space-1); color: var(--sameem-text-inverse); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); line-height: 1; }
.nsk-app-lockup { flex: 0 0 auto; color: var(--sameem-text); }
.nsk-app-lockup .nsk-wordmark { color: var(--sameem-navy); font-size: 2.35rem; }
.nsk-app-lockup .nsk-arabia { color: var(--sameem-text); }
.brand-divider { align-self: stretch; width: 1px; min-height: 44px; background: var(--sameem-border); }
.product-lockup { min-width: 0; }
.product-lockup p { margin: var(--sameem-space-1) 0 0; color: var(--sameem-text-muted); font-size: var(--sameem-small-size); line-height: 1.2; letter-spacing: .03em; }

.eyebrow { margin: 0 0 var(--sameem-space-1); color: var(--sameem-emerald); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); line-height: var(--sameem-small-line); }
.brand h1 { margin: 0; font-size: 1.1rem; line-height: 1.45; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.safety-pill, .metadata-pill, .count-badge, .type-badge, .integrity-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--sameem-radius-round);
  white-space: nowrap;
}

.safety-pill { padding: var(--sameem-space-2) var(--sameem-space-3); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-text); background: var(--sameem-bg-canvas); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-semibold); }
.safety-pill span { color: var(--sameem-success); font-size: .66rem; }
.icon-button {
  display: grid;
  place-items: center;
  width: var(--sameem-control-default);
  height: var(--sameem-control-default);
  border: 1px solid var(--line);
  border-radius: var(--sameem-radius-control);
  color: var(--primary);
  background: var(--sameem-surface);
  cursor: pointer;
}
.icon-button:hover { border-color: var(--primary); background: var(--surface); }

.primary-nav {
  position: sticky;
  inset-block-start: 0;
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: none;
  margin: 0 0 var(--sameem-space-6);
  padding: var(--sameem-space-1) var(--sameem-gutter-desktop);
  overflow: visible;
  border-block: 1px solid var(--sameem-border-inverse);
  background: var(--sameem-bg-inverse);
}

.nav-tab {
  position: relative;
  flex: 1 0 auto;
  min-width: 0;
  min-height: var(--sameem-control-default);
  padding: var(--sameem-space-3) var(--sameem-space-4);
  border: 0;
  color: var(--sameem-text-inverse);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  font-weight: var(--sameem-font-semibold);
}
.nav-tab::after { content: ""; position: absolute; inset-inline: var(--sameem-space-4); inset-block-end: 0; height: 3px; background: transparent; }
.nav-tab:hover { color: var(--sameem-white); background: var(--sameem-bg-inverse-raised); }
.nav-tab.is-active { color: var(--sameem-white); background: var(--sameem-action-primary); }
.nav-tab.is-active::after { background: var(--sameem-white); }

main { width: 100%; min-width: 0; max-width: none; margin: 0; padding: 0 var(--sameem-gutter-desktop) var(--sameem-space-16); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-block-end: var(--sameem-space-6);
  border: 1px solid var(--sameem-navy);
  background: var(--sameem-navy);
}

.summary-card {
  display: flex;
  align-items: center;
  gap: var(--sameem-space-4);
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: var(--sameem-space-5);
  border: 0;
  border-radius: 0;
  background: var(--sameem-surface);
  box-shadow: none;
}
.summary-card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--sameem-emerald); }
.summary-card p { margin: 0 0 4px; color: var(--muted); font-size: .83rem; }
.summary-card strong { display: block; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.2; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; text-align: end; }
.summary-card small { color: var(--muted); font-size: var(--sameem-small-size); }
.summary-icon { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border-radius: var(--sameem-radius-control); color: var(--sameem-navy); background: var(--sameem-bg-subtle); font-weight: var(--sameem-font-bold); }
.summary-content { flex: 1 1 auto; min-width: 0; }
.summary-tone-3 strong { font-size: clamp(1.1rem, 1.8vw, 1.55rem); letter-spacing: -.035em; }
.summary-tone-3 .summary-icon { color: var(--sameem-ink); background: var(--sameem-bg-subtle); font-size: .65rem; }
.summary-tone-4 .summary-icon { color: var(--sameem-danger-text); background: var(--sameem-danger-surface); }

.skeleton-card span, .skeleton-card strong, .list-skeleton, .loading-bar {
  display: block;
  border-radius: var(--sameem-radius-control);
  background: linear-gradient(100deg, var(--sameem-bg-subtle) 20%, var(--sameem-bg-canvas) 40%, var(--sameem-bg-subtle) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.25s infinite linear;
}
.skeleton-card span { width: 42%; height: 12px; margin-block-end: 13px; }
.skeleton-card strong { width: 65%; height: 27px; }
@keyframes shimmer { to { background-position-x: -200%; } }

.view-panel { display: none; min-width: 0; max-width: 100%; }
.view-panel.is-active { display: block; }
.data-layout { display: grid; grid-template-columns: minmax(235px, 285px) minmax(0, 1fr); gap: 17px; align-items: start; }

.sidebar, .workspace, .content-view {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sameem-surface);
  box-shadow: none;
}
.content-view { border-block-start: 4px solid var(--sameem-navy); }
.archive-context { margin-block-end: var(--sameem-space-3); padding: var(--sameem-space-3) var(--sameem-space-4); border-inline-start: 4px solid var(--sameem-gold); color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); }
.archive-context p { color: var(--sameem-mint); }
.archive-context strong { display: block; font-size: var(--sameem-small-size); line-height: var(--sameem-small-line); }

.sidebar { position: sticky; inset-block-start: 14px; padding: 18px 13px 13px; max-height: calc(100vh - 28px); overflow: hidden; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 5px 12px; }
.sidebar h2, .section-header h2, .table-header h2, .welcome-state h2 { margin: 0; line-height: 1.35; }
.sidebar h2 { font-size: 1.18rem; }
.count-badge { min-width: 34px; justify-content: center; padding: var(--sameem-space-1) var(--sameem-space-2); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-emerald); background: var(--sameem-bg-canvas); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--sameem-radius-control);
  color: var(--muted);
  background: var(--sameem-white);
}
.search-field:focus-within { border-color: var(--sameem-focus); box-shadow: 0 0 0 2px var(--sameem-focus); }
.search-field input { min-width: 0; width: 100%; padding: 10px 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-clear, .combobox-clear {
  display: grid;
  place-items: center;
  flex: 0 0 var(--sameem-control-min);
  width: var(--sameem-control-min);
  min-height: var(--sameem-control-min);
  padding: 0;
  border: 0;
  border-radius: var(--sameem-radius-control);
  color: var(--sameem-emerald);
  background: transparent;
  cursor: pointer;
  font-size: 1.12rem;
}
.search-clear:hover, .combobox-clear:hover { color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); }
.search-field.compact { margin: 0 2px 10px; }

.tables-list { max-height: calc(100vh - 174px); overflow-y: auto; padding-inline-end: 3px; scrollbar-color: var(--sameem-gray) transparent; }
.table-list-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  width: 100%;
  margin: 2px 0;
  padding: 10px 11px;
  border: 0;
  border-radius: var(--sameem-radius-control);
  color: var(--ink);
  background: transparent;
  text-align: start;
  cursor: pointer;
}
.table-list-button:hover { background: var(--surface-soft); }
.table-list-button.is-active { color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); box-shadow: inset -4px 0 var(--sameem-mint); }
.table-list-button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.table-list-button span { color: var(--muted); font-size: var(--sameem-small-size); font-variant-numeric: tabular-nums; }
.table-list-button small { grid-column: 1 / -1; color: var(--sameem-gray); font-size: var(--sameem-small-size); }
.list-skeleton { height: 48px; margin: 7px 3px; }
.list-skeleton.short { width: 72%; }

.workspace { min-height: 570px; overflow: hidden; }
.welcome-state { display: grid; place-items: center; min-height: 570px; padding: 45px 22px; text-align: center; }
.welcome-state p:not(.eyebrow) { max-width: 600px; margin: 10px auto 22px; color: var(--muted); }
.welcome-art { display: flex; align-items: flex-end; justify-content: center; gap: var(--sameem-space-2); width: 118px; height: 90px; margin-block-end: var(--sameem-space-5); padding: var(--sameem-space-5); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); background: var(--sameem-bg-canvas); }
.welcome-art span { width: 18px; border-radius: var(--sameem-radius-control); background: var(--sameem-emerald); }
.welcome-art span:nth-child(1) { height: 31px; opacity: .56; }
.welcome-art span:nth-child(2) { height: 51px; opacity: .78; }
.welcome-art span:nth-child(3) { height: 65px; }

.primary-button, .secondary-button, .page-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--sameem-control-default);
  padding: var(--sameem-space-2) var(--sameem-space-4);
  border-radius: var(--sameem-radius-control);
  text-decoration: none;
  cursor: pointer;
  font-weight: var(--sameem-font-semibold);
}
.primary-button { border: 1px solid var(--sameem-action-primary); color: var(--sameem-action-primary-text); background: var(--sameem-action-primary); }
.primary-button:hover { border-color: var(--sameem-emerald); color: var(--sameem-white); background: var(--sameem-emerald); }
.secondary-button, .page-button { border: 1px solid var(--sameem-navy); color: var(--sameem-navy); background: var(--sameem-white); }
.secondary-button:hover, .page-button:hover:not(:disabled) { color: var(--sameem-text-inverse); background: var(--sameem-navy); }
button:disabled, input:disabled, select:disabled { border-color: var(--sameem-border) !important; color: var(--sameem-gray) !important; background: var(--sameem-bg-subtle) !important; cursor: not-allowed !important; box-shadow: none !important; }

.table-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 23px 25px 17px; }
.title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.table-header h2 { font-size: clamp(1.25rem, 2.6vw, 1.7rem); }
.metadata-pill { padding: var(--sameem-space-1) var(--sameem-space-2); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--muted); background: var(--surface-soft); font-size: var(--sameem-small-size); }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, 210px) minmax(125px, 150px); gap: 9px; padding: 0 25px 15px; }
.select-field { position: relative; display: flex; align-items: center; gap: var(--sameem-space-2); padding: 0 var(--sameem-space-3); border: 1px solid var(--line); border-radius: var(--sameem-radius-control); color: var(--muted); background: var(--sameem-white); font-size: var(--sameem-small-size); }
.select-field:focus-within { border-color: var(--sameem-focus); box-shadow: 0 0 0 2px var(--sameem-focus); }
.select-field select { min-width: 0; flex: 1; padding: 9px 0 9px 28px; border: 0; outline: none; color: var(--ink); background: transparent; }
.select-field.has-select::after, .form-grid .has-select::after {
  content: "";
  position: absolute;
  inset-inline-end: var(--sameem-space-3);
  inset-block-end: 17px;
  width: 7px;
  height: 7px;
  border-inline-start: 2px solid var(--sameem-emerald);
  border-block-end: 2px solid var(--sameem-emerald);
  transform: rotate(45deg);
  pointer-events: none;
}
.select-field.has-select::after { inset-block-end: auto; }
select { appearance: none; cursor: pointer; }

.subtabs { display: flex; gap: 5px; padding: 0 25px; border-block-end: 1px solid var(--line); }
.subtab { padding: 10px 13px; border: 0; border-block-end: 3px solid transparent; color: var(--muted); background: transparent; cursor: pointer; font-weight: var(--sameem-font-semibold); }
.subtab.is-active { border-color: var(--primary); color: var(--primary-dark); }
.table-panel { display: none; }
.table-panel.is-active { display: block; }

.records-wrap { max-height: 520px; overflow: auto; scrollbar-color: var(--sameem-gray) transparent; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .81rem; }
th, td { max-width: 310px; padding: 10px 13px; border-block-end: 1px solid var(--sameem-border); border-inline-end: 1px solid var(--sameem-border); text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
th { position: sticky; inset-block-start: 0; z-index: 2; color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
tbody tr:nth-child(even) td { background: var(--sameem-surface); }
tbody tr:hover td { background: var(--sameem-bg-canvas); }
td.is-null { color: var(--sameem-gray); font-style: italic; }

.loading-state { padding: 25px; color: var(--muted); text-align: center; }
.loading-bar { width: min(350px, 80%); height: 7px; margin: 0 auto 10px; }
.empty-state { padding: var(--sameem-space-16) var(--sameem-space-5); border-block: 1px solid var(--sameem-border); text-align: center; }
.empty-state h3 { margin: 5px 0; }
.empty-state p { margin: 0 0 17px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 50px; height: 50px; margin: 0 auto var(--sameem-space-3); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-emerald); background: var(--sameem-bg-canvas); font-size: 1.5rem; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 20px; border-block-start: 1px solid var(--line); }
.pagination p { margin: 0; color: var(--muted); font-size: .78rem; }
.pagination > div { display: flex; align-items: center; gap: 7px; }
.page-button { min-height: 34px; padding: 5px 12px; font-size: .76rem; }
.page-number { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; font-size: .78rem; font-weight: var(--sameem-font-bold); }

#schema-content, #table-relations-content { padding: 22px 25px 28px; }
.schema-section + .schema-section { margin-block-start: 24px; }
.schema-section h3 { margin: 0 0 10px; font-size: 1rem; }
.schema-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 9px; }
.schema-card { padding: var(--sameem-space-3) var(--sameem-space-4); border: 1px solid var(--line); border-radius: var(--sameem-radius-control); background: var(--sameem-surface); }
.schema-card strong { display: block; overflow-wrap: anywhere; }
.schema-card p { margin: 3px 0 0; color: var(--muted); font-size: .7rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; margin-block-start: 8px; }
.mini-tag { padding: var(--sameem-space-1) var(--sameem-space-2); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-text); background: var(--sameem-bg-canvas); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-semibold); }

.content-view { padding: clamp(var(--sameem-space-6), 4vw, var(--sameem-space-10)); }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-block-end: 22px; }
.section-header > p { max-width: 530px; margin: 0; color: var(--muted); font-size: .86rem; }
.section-lead { max-width: 760px; margin: var(--sameem-space-2) 0 0; color: var(--muted); font-size: var(--sameem-small-size); line-height: var(--sameem-small-line); }
.section-header h2, .table-header h2, .welcome-state h2 { font-size: var(--sameem-h2-size); line-height: var(--sameem-h2-line); font-weight: var(--sameem-font-semibold); }
.relationship-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 11px; }
.relationship-card { padding: var(--sameem-space-4); border: 1px solid var(--line); border-block-start: 3px solid var(--sameem-navy); border-radius: var(--sameem-radius-control); background: var(--sameem-surface); }
.relationship-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block-end: 13px; }
.relationship-name strong { overflow-wrap: anywhere; font-size: .84rem; }
.integrity-badge { padding: var(--sameem-space-1) var(--sameem-space-2); border: 1px solid var(--sameem-success); border-radius: var(--sameem-radius-control); color: var(--sameem-emerald); background: var(--sameem-white); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.integrity-badge.is-loose { border-color: var(--sameem-warning); color: var(--sameem-ink); background: var(--sameem-bg-canvas); }
.relation-flow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 7px; }
.relation-node { min-width: 0; padding: 9px; border-radius: var(--sameem-radius-control); background: var(--surface-soft); }
.relation-node strong, .relation-node span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-node strong { font-size: .76rem; }
.relation-node span { color: var(--muted); font-size: var(--sameem-small-size); }
.relation-arrow { color: var(--accent); font-size: 1.25rem; }

.section-search { max-width: 430px; margin-block-end: 15px; }
.queries-list { display: grid; gap: 8px; }
.query-card { border: 1px solid var(--line); border-radius: var(--sameem-radius-control); background: var(--sameem-surface); overflow: hidden; }
.query-card summary { display: flex; align-items: center; gap: 10px; padding: 13px 15px; cursor: pointer; list-style: none; }
.query-card summary::-webkit-details-marker { display: none; }
.query-card summary::after { content: "+"; margin-inline-start: auto; color: var(--primary); font-size: 1.2rem; }
.query-card[open] summary::after { content: "−"; }
.query-card strong { overflow-wrap: anywhere; font-size: .85rem; }
.type-badge { padding: var(--sameem-space-1) var(--sameem-space-2); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-text); background: var(--sameem-bg-canvas); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.type-badge.is-write { border-color: var(--sameem-warning); color: var(--sameem-danger-text); background: var(--sameem-bg-canvas); }
.query-card pre { margin: 0; padding: var(--sameem-space-4); border-block-start: 1px solid var(--line); direction: ltr; color: var(--sameem-text-inverse); background: var(--sameem-navy); overflow: auto; text-align: left; font: .72rem/1.65 var(--sameem-font-latin); white-space: pre-wrap; }

.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.about-card { padding: var(--sameem-space-4); border: 1px solid var(--line); border-block-start: 3px solid var(--sameem-navy); border-radius: var(--sameem-radius-control); background: var(--sameem-surface); }
.about-card span { display: block; color: var(--muted); font-size: .72rem; }
.about-card strong { display: block; margin-block-start: 3px; overflow-wrap: anywhere; }
.notice-card { display: flex; gap: var(--sameem-space-4); margin-block-start: var(--sameem-space-4); padding: var(--sameem-space-5); border: 1px solid var(--sameem-border); border-inline-start: 4px solid var(--sameem-success); border-radius: var(--sameem-radius-control); background: var(--sameem-bg-canvas); }
.notice-card h3, .notice-card p { margin: 0; }
.notice-card p { color: var(--muted); font-size: .81rem; }
.notice-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: var(--sameem-radius-control); color: var(--sameem-white); background: var(--sameem-success); font-weight: var(--sameem-font-bold); }
code { padding: var(--sameem-space-1) var(--sameem-space-2); border-radius: var(--sameem-radius-control); direction: ltr; background: var(--sameem-bg-subtle); font: .82em var(--sameem-font-latin); }

.header-actions, .row-actions, .document-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.text-button { padding: 4px 7px; border: 0; color: var(--primary); background: transparent; cursor: pointer; font-weight: var(--sameem-font-semibold); }
.text-button:hover { text-decoration: underline; }
.dashboard-header { align-items: center; margin-block-end: 16px; }
.sync-block { display: flex; align-items: center; gap: var(--sameem-space-3); min-width: 240px; padding: var(--sameem-space-3) var(--sameem-space-4); border: 1px solid var(--sameem-border); border-inline-start: 4px solid var(--sameem-success); border-radius: var(--sameem-radius-control); background: var(--sameem-bg-canvas); }
.sync-block strong, .sync-block small { display: block; }
.sync-block strong { font-size: .78rem; }
.sync-block small { color: var(--muted); font-size: var(--sameem-small-size); }
.sync-dot { flex: 0 0 10px; width: 10px; height: 10px; border: 2px solid var(--sameem-bg-subtle); border-radius: 50%; background: var(--sameem-success); box-shadow: none; }
.action-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-block-end: var(--sameem-space-8); border: 1px solid var(--sameem-navy); background: var(--sameem-navy); }
.quick-action { display: flex; align-items: center; gap: var(--sameem-space-3); min-width: 0; min-height: 70px; padding: var(--sameem-space-3) var(--sameem-space-4); border: 0; border-radius: 0; color: var(--ink); background: var(--sameem-white); text-align: start; cursor: pointer; box-shadow: none; }
.quick-action:hover { color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); }
.quick-action:disabled { opacity: .55; cursor: wait; }
.quick-action span:not(.action-icon), .quick-action strong, .quick-action small { display: block; min-width: 0; }
.quick-action small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: var(--sameem-small-size); }
.action-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-emerald); background: var(--sameem-bg-canvas); font-size: 1.05rem; font-weight: var(--sameem-font-bold); }
.quick-action:hover .action-icon { color: var(--sameem-mint); background: var(--sameem-navy); border-color: var(--sameem-border-inverse); }
.primary-action { color: var(--sameem-action-primary-text); background: var(--sameem-action-primary); }
.primary-action:hover { color: var(--sameem-text-inverse); background: var(--sameem-emerald); }
.primary-action .action-icon { color: var(--sameem-mint); background: var(--sameem-white); }
.primary-action small { color: var(--sameem-white); }
.primary-action:hover small { color: var(--sameem-text-inverse); }
.subsection-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-block-end: 9px; }
.subsection-heading h3 { margin: 0; font-size: 1rem; }
.subsection-heading > small { color: var(--muted); }
.alert-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-block-end: var(--sameem-space-6); border: 1px solid var(--sameem-border); }
.alert-card { display: grid; gap: var(--sameem-space-1); min-height: 150px; padding: var(--sameem-space-4); border: 0; border-inline-end: 1px solid var(--sameem-border); border-block-end: 4px solid var(--sameem-warning); border-radius: 0; color: var(--ink); background: var(--sameem-surface); text-align: start; cursor: pointer; }
.alert-card:last-child { border-inline-end: 0; }
.alert-card:hover { color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); box-shadow: none; }
.alert-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.alert-card strong { color: var(--primary-dark); font-size: 1.25rem; }
.alert-card b { font-size: .78rem; }
.alert-card small { color: var(--muted); }
.alert-card:hover strong, .alert-card:hover small { color: var(--sameem-text-inverse); }
.alert-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-ink); background: var(--sameem-bg-subtle); font-size: .72rem; font-weight: var(--sameem-font-bold); }
.alert-progress { display: block; height: 4px; margin-block-start: 5px; overflow: hidden; border-radius: var(--sameem-radius-round); background: var(--sameem-bg-subtle); }
.alert-progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.alert-out { border-block-end-color: var(--sameem-danger); }
.alert-out .alert-icon { color: var(--sameem-white); background: var(--sameem-danger); }
.alert-out .alert-progress i { background: var(--sameem-danger); }
.alert-unclassified { border-block-end-color: var(--sameem-gray); }
.alert-unclassified .alert-icon { color: var(--sameem-white); background: var(--sameem-gray); }
.alert-unclassified .alert-progress i { background: var(--sameem-gray); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 13px; }
.module-card { padding: var(--sameem-space-5); border: 1px solid var(--line); border-block-start: 4px solid var(--sameem-navy); border-radius: var(--sameem-radius-control); background: var(--sameem-surface); }
.module-card h3 { margin: 0; }
.module-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 13px; }
.quick-results, .compact-list, .quick-results-list { display: grid; gap: 5px; margin-block-start: 10px; }
.quick-results-list { margin-block-start: 0; }
.results-caption { margin: 10px 2px 6px; color: var(--muted); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.quick-product, .compact-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sameem-space-4); width: 100%; padding: var(--sameem-space-3); border: 1px solid transparent; border-radius: var(--sameem-radius-control); color: var(--ink); background: var(--surface-soft); text-align: start; cursor: pointer; }
.quick-product:hover, .compact-row:hover { border-color: var(--sameem-emerald); background: var(--sameem-surface); }
.quick-product span, .compact-row span { min-width: 0; }
.quick-product strong, .quick-product small, .compact-row strong, .compact-row small { display: block; }
.quick-product small, .compact-row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: var(--sameem-small-size); }
.quick-product-facts { display: grid; flex: 0 0 auto; gap: 3px; justify-items: end; }
.quick-product b { min-width: 72px; padding: 4px 8px; border: 1px solid currentColor; border-radius: var(--sameem-radius-control); text-align: center; font-size: var(--sameem-small-size); }
.quick-product-facts small { text-align: end; }
.muted-copy, .empty-inline { color: var(--muted); font-size: .82rem; }
.compact-empty { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; }
.compact-empty p { margin: 0; }

.catalog-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(170px, 220px) minmax(180px, 260px); gap: 9px; margin-block-end: 12px; }
.split-layout { display: grid; grid-template-columns: minmax(210px, 260px) minmax(0, 1fr); gap: 12px; }
.family-panel, .list-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--sameem-radius-control); background: var(--sameem-surface); overflow: hidden; }
.family-panel { padding: 14px; }
.family-list { display: grid; gap: 3px; max-height: 560px; overflow-y: auto; }
.family-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: calc(100% - var(--family-depth, 0) * 12px); margin-inline-start: calc(var(--family-depth, 0) * 12px); padding: 8px 9px; border: 0; border-radius: var(--sameem-radius-control); color: var(--ink); background: transparent; text-align: start; cursor: pointer; }
.family-item:hover { color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); }
.family-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; font-weight: var(--sameem-font-bold); }
.family-item small { color: var(--muted); }
.inventory-table-wrap { max-height: 555px; }
.sku-text, .table-subtitle { display: block; }
.table-subtitle { max-width: 220px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: var(--sameem-small-size); }
.numeric-cell,
.sameem-number {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: end;
}
.negative-number { color: var(--danger); }
.stock-badge { display: inline-flex; padding: var(--sameem-space-1) var(--sameem-space-2); border: 1px solid currentColor; border-radius: var(--sameem-radius-control); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.stock-available { color: var(--sameem-emerald); background: var(--sameem-white); }
.stock-low { color: var(--sameem-ink); background: var(--sameem-bg-canvas); border-color: var(--sameem-warning); }
.stock-out { color: var(--sameem-danger-text); background: var(--sameem-danger-surface); }
.stock-negative { color: var(--sameem-white); background: var(--danger); }
.stock-inactive { color: var(--sameem-gray); background: var(--sameem-bg-subtle); }

.document-filters { margin-block-end: 13px; }
.filter-chip { min-height: var(--sameem-control-min); padding: var(--sameem-space-2) var(--sameem-space-4); border: 1px solid var(--sameem-navy); border-radius: var(--sameem-radius-control); color: var(--sameem-navy); background: var(--sameem-white); cursor: pointer; }
.filter-chip.is-active { border-color: var(--sameem-navy); color: var(--sameem-text-inverse); background: var(--sameem-navy); }
.documents-list { display: grid; gap: 8px; }
.document-card { display: flex; align-items: center; justify-content: space-between; gap: var(--sameem-space-5); width: 100%; padding: var(--sameem-space-4); border: 1px solid var(--line); border-inline-start: 4px solid var(--sameem-emerald); border-radius: var(--sameem-radius-control); color: var(--ink); background: var(--sameem-surface); text-align: start; cursor: pointer; }
.document-card:hover { color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); }
.document-card > div > strong, .document-card > div > span, .document-card-meta small { display: block; }
.document-card > div > span, .document-card-meta small { color: var(--muted); font-size: .74rem; }
.document-card-meta { text-align: end; }
.document-card:hover > div > span, .document-card:hover .document-card-meta small { color: var(--sameem-text-inverse); }

.app-dialog { width: min(620px, calc(100vw - 24px)); max-height: min(90vh, 850px); padding: 0; border: 1px solid var(--sameem-border-inverse); border-radius: var(--sameem-radius-control); color: var(--ink); background: var(--surface); box-shadow: var(--sameem-shadow-raised); overflow: hidden; }
.app-dialog::backdrop { background: color-mix(in srgb, var(--sameem-navy) 76%, transparent); }
.wide-dialog { width: min(880px, calc(100vw - 24px)); }
.document-dialog, .detail-dialog { width: min(1120px, calc(100vw - 24px)); }
.dialog-form { max-height: min(90vh, 850px); overflow-y: auto; }
.dialog-form > header, .dialog-form > footer { position: sticky; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--sameem-space-4); padding: var(--sameem-space-4) var(--sameem-space-5); background: var(--surface); }
.dialog-form > header { inset-block-start: 0; border-block-start: 4px solid var(--sameem-navy); border-block-end: 1px solid var(--line); }
.dialog-form > footer { inset-block-end: 0; justify-content: flex-end; border-block-start: 1px solid var(--line); }
.dialog-form h2 { margin: 0; font-size: 1.25rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px; }
.form-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid label, .document-line label { display: grid; align-content: start; gap: 5px; min-width: 0; color: var(--muted); font-size: .75rem; font-weight: var(--sameem-font-bold); }
.form-grid .has-select { position: relative; }
.form-grid input:not([type="checkbox"]), .form-grid select, .document-line input { min-width: 0; width: 100%; padding: var(--sameem-space-2) var(--sameem-space-3); border: 1px solid var(--line); border-radius: var(--sameem-radius-control); color: var(--ink); background: var(--sameem-white); outline: 0; }
.form-grid select { padding-inline-end: 34px; }
.form-grid input:focus, .form-grid select:focus, .document-line input:focus { border-color: var(--sameem-focus); box-shadow: 0 0 0 2px var(--sameem-focus); }
.form-grid .full { grid-column: 1 / -1; }
.check-label { display: flex !important; align-items: center; flex-direction: row; align-self: end; min-height: 42px; }
.check-label input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-help { margin: 0; padding: 0 20px 20px; color: var(--muted); font-size: .76rem; }
.line-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 20px 10px; }
.line-heading h3 { margin: 0; }
.document-lines { display: grid; gap: 8px; padding: 0 20px 15px; }
.document-line { display: grid; grid-template-columns: minmax(180px, 1.6fr) repeat(5, minmax(90px, .65fr)) 48px; gap: var(--sameem-space-2); align-items: end; padding: var(--sameem-space-3); border: 1px solid var(--line); border-radius: var(--sameem-radius-control); background: var(--surface-soft); }
.product-lookup { display: grid; align-content: start; gap: 5px; min-width: 0; color: var(--muted); font-size: .75rem; font-weight: var(--sameem-font-bold); }
.product-combobox { position: relative; min-width: 0; }
.product-combobox > input { padding-inline-start: 38px; padding-inline-end: 42px; }
.combobox-search-icon { position: absolute; inset-inline-start: var(--sameem-space-3); inset-block-start: 13px; z-index: 1; color: var(--sameem-gray); pointer-events: none; }
.combobox-clear { position: absolute; inset-inline-end: 1px; inset-block-start: 1px; z-index: 2; }
.product-options { position: absolute; inset-inline: 0; inset-block-end: calc(100% + 4px); z-index: 30; max-height: min(320px, 48vh); overflow-y: auto; border: 1px solid var(--sameem-border-inverse); border-block-start: 4px solid var(--sameem-mint); border-radius: var(--sameem-radius-control); background: var(--sameem-white); box-shadow: var(--sameem-shadow-raised); scrollbar-color: var(--sameem-gray) transparent; }
.product-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--sameem-space-3); min-height: 62px; padding: var(--sameem-space-3); border-block-end: 1px solid var(--sameem-border); color: var(--sameem-text); background: var(--sameem-white); cursor: pointer; }
.product-option:last-child { border-block-end: 0; }
.product-option:hover, .product-option.is-active { color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse-raised); }
.product-option-identity, .product-option-facts, .product-option strong, .product-option small, .product-option b { display: block; min-width: 0; }
.product-option-identity small { overflow: hidden; color: var(--sameem-text-muted); text-overflow: ellipsis; white-space: nowrap; font-size: var(--sameem-small-size); font-weight: var(--sameem-font-regular); }
.product-option-facts { display: grid; gap: 2px; justify-items: end; white-space: nowrap; }
.product-option-facts b { font-size: var(--sameem-small-size); }
.product-option-facts small { color: var(--sameem-text-muted); font-size: var(--sameem-small-size); font-style: normal; }
.product-option:hover small, .product-option.is-active small { color: var(--sameem-text-inverse); }
.product-option-state { padding: var(--sameem-space-4); color: var(--sameem-text-muted); background: var(--sameem-bg-canvas); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-regular); }
.product-option-state.is-error { color: var(--sameem-danger-text); background: var(--sameem-danger-surface); }
.stock-hint { min-height: 18px; overflow: hidden; color: var(--primary); text-overflow: ellipsis; white-space: nowrap; font-size: var(--sameem-small-size); }
.stock-hint.is-error { color: var(--danger); }
.document-totals { margin: 0 var(--sameem-space-5) var(--sameem-space-5); padding: var(--sameem-space-3) var(--sameem-space-4); border-inline-start: 4px solid var(--sameem-success); border-radius: var(--sameem-radius-control); color: var(--sameem-text); background: var(--sameem-bg-canvas); text-align: end; font-weight: var(--sameem-font-bold); }
.impact-banner { display: flex; align-items: center; gap: var(--sameem-space-3); margin: 0 var(--sameem-space-5) var(--sameem-space-4); padding: var(--sameem-space-3) var(--sameem-space-4); border: 1px solid var(--sameem-border); border-inline-start: 4px solid var(--sameem-success); border-radius: var(--sameem-radius-control); background: var(--sameem-bg-canvas); }
.impact-banner.is-outgoing { border-inline-start-color: var(--sameem-warning); }
.impact-sign { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: var(--sameem-radius-control); color: var(--sameem-white); background: var(--sameem-success); font-size: 1.2rem; font-weight: var(--sameem-font-bold); }
.impact-banner.is-outgoing .impact-sign { color: var(--sameem-navy); background: var(--sameem-warning); }
.impact-banner strong, .impact-banner small { display: block; }
.impact-banner small { color: var(--muted); font-size: var(--sameem-small-size); }

.direct-file-mode .primary-nav, .direct-file-mode #view-dashboard .section-header, .direct-file-mode .action-strip, .direct-file-mode .subsection-heading { display: none; }
.direct-file-mode main { padding-block-start: 42px; }
.direct-file-mode .summary-grid { display: block; }
.direct-file-card { display: flex; align-items: flex-start; gap: var(--sameem-space-5); padding: clamp(var(--sameem-space-6), 5vw, var(--sameem-space-12)); border: 1px solid var(--sameem-warning); border-inline-start: 4px solid var(--sameem-warning); border-radius: var(--sameem-radius-control); background: var(--sameem-surface); box-shadow: none; }
.direct-file-card h2 { margin: 2px 0 8px; font-size: clamp(1.3rem, 3vw, 2rem); }
.direct-file-card p:not(.eyebrow) { max-width: 760px; margin: 0 0 14px; color: var(--muted); }
.direct-file-icon { display: grid; place-items: center; flex: 0 0 50px; width: 50px; height: 50px; border-radius: var(--sameem-radius-control); color: var(--sameem-navy); background: var(--sameem-warning); font-size: 1.4rem; font-weight: var(--sameem-font-bold); }
.launch-command { display: block; padding: 10px 12px; direction: ltr; overflow-x: auto; text-align: left; }

#detail-content { padding: 20px; }
.detail-kpis, .analytics-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.detail-metric { padding: var(--sameem-space-4); border: 1px solid var(--line); border-block-start: 3px solid var(--sameem-navy); border-radius: var(--sameem-radius-control); background: var(--sameem-surface); }
.detail-metric span, .detail-metric strong { display: block; }
.detail-metric span { color: var(--muted); font-size: .7rem; }
.detail-metric strong { margin-block-start: 3px; font-size: 1.15rem; }
.detail-section { margin-block-start: 18px; }
.detail-section h3 { margin: 0 0 8px; font-size: .95rem; }
.key-value-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.key-value-grid > div { padding: 10px; border: 1px solid var(--line); border-radius: var(--sameem-radius-control); }
.key-value-grid span, .key-value-grid strong { display: block; }
.key-value-grid span { color: var(--muted); font-size: var(--sameem-small-size); }
.key-value-grid strong { overflow-wrap: anywhere; font-size: .8rem; }
.detail-table-wrap { max-height: 330px; border: 1px solid var(--line); border-radius: var(--sameem-radius-control); }
.analytics-kpis { margin-block-end: 15px; }
.analytics-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-block-start: 15px; }

.toast { position: fixed; inset-inline-start: var(--sameem-space-6); inset-block-end: var(--sameem-space-6); z-index: 90; max-width: min(390px, calc(100vw - 48px)); padding: var(--sameem-space-3) var(--sameem-space-4); border-inline-start: 4px solid var(--sameem-mint); border-radius: var(--sameem-radius-control); color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse); box-shadow: var(--sameem-shadow-raised); font-size: var(--sameem-small-size); }
.toast.is-error { border-inline-start-color: var(--sameem-danger); background: var(--sameem-danger-text); }
.notice-card.is-error { border-color: var(--sameem-danger); border-inline-start-width: 4px; background: var(--sameem-danger-surface); }
.notice-card.is-error .notice-icon { background: var(--sameem-danger); }
.noscript { margin: 20px; padding: 15px; border-radius: var(--sameem-radius-control); color: var(--sameem-white); background: var(--danger); }

.auth-locked { min-height: 100vh; overflow: hidden; background: var(--sameem-bg-inverse); }
.auth-locked > :not(.auth-view):not(.noscript) { visibility: hidden; }
.auth-view { position: fixed; inset: 0; z-index: 200; overflow-x: hidden; overflow-y: auto; color: var(--sameem-text-inverse); background: var(--sameem-bg-inverse); }
.auth-view[hidden] { display: none; }
.public-screen { width: 100%; min-height: 100vh; }

.public-landing {
  position: relative;
  background-color: var(--sameem-bg-inverse);
  background-image:
    linear-gradient(var(--sameem-border-inverse) 1px, transparent 1px),
    linear-gradient(90deg, var(--sameem-border-inverse) 1px, transparent 1px);
  background-size: 72px 72px;
}
.public-landing::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, var(--sameem-bg-inverse) 0 28%, transparent 58%, var(--sameem-bg-inverse) 100%); }
.public-header, .public-main, .public-footer { position: relative; z-index: 1; width: 100%; margin-inline: auto; padding-inline: var(--sameem-gutter-desktop); }
.public-header { display: flex; align-items: center; justify-content: space-between; min-height: 96px; border-block-end: 1px solid var(--sameem-border-inverse); }
.public-login-button, .landing-primary, .landing-secondary { display: inline-flex; align-items: center; justify-content: center; gap: var(--sameem-space-3); min-height: var(--sameem-control-default); padding: var(--sameem-space-2) var(--sameem-space-5); border-radius: var(--sameem-radius-control); cursor: pointer; text-decoration: none; font-weight: var(--sameem-font-bold); transition: color var(--sameem-motion-fast), background var(--sameem-motion-fast), border-color var(--sameem-motion-fast), transform var(--sameem-motion-fast); }
.public-login-button { border: 1px solid var(--sameem-border-inverse); color: var(--sameem-white); background: transparent; }
.public-login-button:hover { border-color: var(--sameem-mint); color: var(--sameem-white); background: var(--sameem-mint); }
.landing-hero { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(380px, .92fr); gap: clamp(var(--sameem-space-8), 6vw, var(--sameem-space-16)); align-items: center; min-height: min(760px, calc(100vh - 96px)); padding-block: var(--sameem-space-16); }
.landing-kicker { display: flex; align-items: center; gap: var(--sameem-space-2); margin: 0 0 var(--sameem-space-5); color: var(--sameem-mint); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); letter-spacing: .02em; }
.landing-kicker > span { width: 28px; height: 2px; background: currentColor; }
.landing-copy h1 { max-width: 760px; margin: 0; color: var(--sameem-white); font-size: clamp(2.5rem, 5.6vw, 5.6rem); line-height: 1.24; letter-spacing: -.055em; }
.landing-copy h1 em, .login-brand-copy h2 em { color: var(--sameem-mint); font-style: normal; }
.landing-lead { max-width: 690px; margin: var(--sameem-space-6) 0 0; color: var(--sameem-gray); font-size: clamp(1rem, 1.45vw, 1.2rem); line-height: 2; }
.landing-lead strong { color: var(--sameem-white); }
.landing-actions { display: flex; flex-wrap: wrap; gap: var(--sameem-space-3); margin-block-start: var(--sameem-space-8); }
.landing-primary { border: 1px solid var(--sameem-mint); color: var(--sameem-white); background: var(--sameem-mint); }
.landing-primary:hover { border-color: var(--sameem-white); color: var(--sameem-navy); background: var(--sameem-white); transform: translateY(-2px); }
.landing-secondary { border: 1px solid var(--sameem-border-inverse); color: var(--sameem-white); background: transparent; }
.landing-secondary:hover { border-color: var(--sameem-white); background: var(--sameem-bg-inverse-raised); }
.landing-trust { display: flex; flex-wrap: wrap; gap: var(--sameem-space-4) var(--sameem-space-6); margin: var(--sameem-space-8) 0 0; padding: 0; color: var(--sameem-gray); list-style: none; font-size: var(--sameem-small-size); }
.landing-trust span { margin-inline-end: var(--sameem-space-1); color: var(--sameem-mint); }

.landing-visual { position: relative; overflow: hidden; border: 1px solid var(--sameem-border-inverse); border-block-start: 5px solid var(--sameem-mint); background: var(--sameem-bg-inverse-raised); box-shadow: var(--sameem-shadow-elevated); }
.landing-visual::after { content: "NSK"; position: absolute; inset-inline-end: -18px; inset-block-end: -44px; color: var(--sameem-border-inverse); font-family: var(--sameem-font-numeric); font-size: 9rem; font-weight: var(--sameem-font-bold); letter-spacing: -.09em; pointer-events: none; }
.visual-topline { display: flex; align-items: center; justify-content: space-between; gap: var(--sameem-space-4); padding: var(--sameem-space-4); border-block-end: 1px solid var(--sameem-border-inverse); font-size: var(--sameem-small-size); }
.visual-topline > span { color: var(--sameem-gray); }
.visual-topline strong { display: flex; align-items: center; gap: var(--sameem-space-2); color: var(--sameem-white); font-size: var(--sameem-small-size); }
.visual-topline i { width: 8px; height: 8px; border-radius: 50%; background: var(--sameem-mint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sameem-mint) 22%, transparent); }
.visual-focus { min-height: 260px; padding: var(--sameem-space-8); border-block-end: 1px solid var(--sameem-border-inverse); }
.visual-focus p { margin: 0 0 var(--sameem-space-3); color: var(--sameem-mint); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.visual-focus h2 { max-width: 440px; margin: 0; color: var(--sameem-white); font-size: clamp(1.45rem, 2.4vw, 2.25rem); line-height: 1.6; }
.stock-signal { display: flex; align-items: end; gap: var(--sameem-space-2); height: 74px; margin-block-start: var(--sameem-space-6); }
.stock-signal span { flex: 1 1 0; min-width: 8px; background: var(--sameem-mint); }
.stock-signal span:nth-child(1) { height: 36%; opacity: .42; }
.stock-signal span:nth-child(2) { height: 61%; opacity: .55; }
.stock-signal span:nth-child(3) { height: 46%; opacity: .66; }
.stock-signal span:nth-child(4) { height: 78%; opacity: .77; }
.stock-signal span:nth-child(5) { height: 67%; opacity: .88; }
.stock-signal span:nth-child(6) { height: 100%; }
.visual-modules { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); }
.visual-modules article { min-width: 0; min-height: 132px; padding: var(--sameem-space-4); border-inline-end: 1px solid var(--sameem-border-inverse); }
.visual-modules article:last-child { border-inline-end: 0; }
.visual-modules span, .visual-modules strong, .visual-modules small { display: block; }
.visual-modules span { color: var(--sameem-mint); font-family: var(--sameem-font-numeric); font-size: var(--sameem-small-size); }
.visual-modules strong { margin-block: var(--sameem-space-3) var(--sameem-space-1); color: var(--sameem-white); }
.visual-modules small { color: var(--sameem-gray); font-size: var(--sameem-small-size); line-height: 1.7; }

.landing-features { padding-block: var(--sameem-space-20); border-block-start: 1px solid var(--sameem-border-inverse); }
.features-intro { display: grid; grid-template-columns: .55fr 1fr; gap: var(--sameem-space-8); align-items: end; }
.features-intro .landing-kicker { margin: 0; }
.features-intro h2 { margin: 0; color: var(--sameem-white); font-size: clamp(1.8rem, 3.4vw, 3.5rem); line-height: 1.4; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-block-start: var(--sameem-space-10); border-block: 1px solid var(--sameem-border-inverse); }
.feature-grid article { min-height: 245px; padding: var(--sameem-space-8); border-inline-end: 1px solid var(--sameem-border-inverse); }
.feature-grid article:last-child { border-inline-end: 0; }
.feature-index { color: var(--sameem-mint); font-family: var(--sameem-font-numeric); font-weight: var(--sameem-font-bold); }
.feature-grid h3 { margin: var(--sameem-space-8) 0 var(--sameem-space-3); color: var(--sameem-white); font-size: 1.2rem; }
.feature-grid p { margin: 0; color: var(--sameem-gray); font-size: .9rem; line-height: 2; }
.public-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--sameem-space-6); min-height: 104px; border-block-start: 1px solid var(--sameem-border-inverse); color: var(--sameem-gray); font-size: var(--sameem-small-size); }
.public-footer p { margin: 0; }
.public-footer > div { display: flex; align-items: center; gap: var(--sameem-space-3); }
.public-footer img { filter: grayscale(1) brightness(3); opacity: .64; }

.login-screen { display: grid; grid-template-columns: minmax(360px, .82fr) minmax(460px, 1.18fr); background: var(--sameem-bg-canvas); }
.login-brand-panel { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; overflow: hidden; padding: clamp(var(--sameem-space-8), 5vw, var(--sameem-space-16)); border-inline-end: 6px solid var(--sameem-mint); background-color: var(--sameem-bg-inverse); background-image: linear-gradient(var(--sameem-border-inverse) 1px, transparent 1px), linear-gradient(90deg, var(--sameem-border-inverse) 1px, transparent 1px); background-size: 68px 68px; }
.login-brand-panel::after { content: "NSK"; position: absolute; inset-inline-end: -28px; inset-block-end: 50px; color: var(--sameem-border-inverse); font-family: var(--sameem-font-numeric); font-size: clamp(7rem, 16vw, 15rem); font-weight: var(--sameem-font-bold); letter-spacing: -.1em; line-height: .7; }
.nsk-lockup-inverse { position: relative; z-index: 1; align-self: flex-start; }
.login-brand-copy { position: relative; z-index: 1; max-width: 520px; }
.login-brand-copy > p { margin: 0 0 var(--sameem-space-5); color: var(--sameem-mint); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.login-brand-copy h2 { margin: 0; color: var(--sameem-white); font-size: clamp(2.3rem, 5vw, 5.2rem); line-height: 1.25; letter-spacing: -.05em; }
.login-brand-status { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--sameem-space-3); }
.login-brand-status > span { width: 12px; height: 12px; border-radius: 50%; background: var(--sameem-mint); box-shadow: 0 0 0 5px color-mix(in srgb, var(--sameem-mint) 20%, transparent); }
.login-brand-status p, .login-brand-status strong, .login-brand-status small { display: block; margin: 0; }
.login-brand-status strong { color: var(--sameem-white); font-size: var(--sameem-small-size); }
.login-brand-status small { color: var(--sameem-gray); font-size: var(--sameem-small-size); }
.login-form-panel { display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; padding: clamp(var(--sameem-space-5), 4.5vw, var(--sameem-space-12)); color: var(--sameem-text); background: var(--sameem-bg-canvas); }
.login-back { justify-self: start; min-height: var(--sameem-control-min); padding: 0; border: 0; color: var(--sameem-text-muted); background: transparent; cursor: pointer; font-weight: var(--sameem-font-semibold); }
.login-back:hover { color: var(--sameem-mint); }
.auth-panel { align-self: center; width: min(500px, 100%); margin-inline: auto; padding-block: var(--sameem-space-8); }
.auth-panel h1 { margin: var(--sameem-space-2) 0 var(--sameem-space-3); color: var(--sameem-navy); font-size: clamp(2rem, 4.4vw, 3.3rem); line-height: 1.35; letter-spacing: -.04em; }
.auth-lead { max-width: 460px; margin: 0; color: var(--sameem-text-muted); font-size: .92rem; line-height: 1.9; }
.auth-form { display: grid; gap: var(--sameem-space-4); margin-block-start: var(--sameem-space-8); }
.auth-form label, #password-change-form > label { display: grid; gap: var(--sameem-space-2); color: var(--sameem-text); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.auth-form input, #password-change-form > label input { width: 100%; min-height: 54px; padding: var(--sameem-space-2) var(--sameem-space-4); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-text); background: var(--sameem-white); }
.auth-form input::placeholder { color: var(--sameem-gray); opacity: .76; }
.auth-form input:focus, #password-change-form > label input:focus { border-color: var(--sameem-focus); outline: 3px solid color-mix(in srgb, var(--sameem-focus) 24%, transparent); outline-offset: 1px; }
.password-field { position: relative; display: block; }
.password-field input { padding-inline-end: 86px; }
.password-field button { position: absolute; inset-inline-end: var(--sameem-space-3); inset-block-start: 5px; min-height: 44px; padding-inline: var(--sameem-space-2); border: 0; color: var(--sameem-mint); background: transparent; cursor: pointer; font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.password-field button:hover { color: var(--sameem-danger-text); }
.auth-form .primary-button { width: 100%; }
.login-submit { min-height: 56px; margin-block-start: var(--sameem-space-1); font-weight: var(--sameem-font-bold); }
.auth-support { display: flex; gap: var(--sameem-space-3); margin-block-start: var(--sameem-space-6); padding: var(--sameem-space-4); border-inline-start: 4px solid var(--sameem-mint); color: var(--sameem-text-muted); background: var(--sameem-bg-subtle); }
.auth-support > span { display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; color: var(--sameem-white); background: var(--sameem-navy); font-family: var(--sameem-font-numeric); font-weight: var(--sameem-font-bold); }
.auth-support p { margin: 0; font-size: var(--sameem-small-size); line-height: 1.8; }
.auth-support small { color: var(--sameem-gray); font-size: inherit; }
.login-security { align-self: end; margin: 0; color: var(--sameem-gray); text-align: center; font-size: var(--sameem-small-size); }
.login-security span { color: var(--sameem-mint); }
.form-error { min-height: 1.4em; margin: 0; color: var(--sameem-danger-text); font-size: var(--sameem-small-size); }
#password-change-form > p, #password-change-form > label { margin-inline: var(--sameem-space-5); }
.user-session { display: flex; align-items: center; gap: var(--sameem-space-3); padding-inline: var(--sameem-space-3); border-inline-start: 1px solid var(--sameem-border); }
.user-session span, .user-session strong, .user-session small { display: block; }
.user-session strong { font-size: var(--sameem-small-size); }
.user-session small { color: var(--sameem-text-muted); font-size: var(--sameem-small-size); }
.cloud-only { display: none; }
body[data-cloud="true"] .cloud-only { display: inline-flex; }
.permission-legend { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; margin-block-end: var(--sameem-space-4); border: 1px solid var(--sameem-border); background: var(--sameem-border); }
.permission-legend span { padding: var(--sameem-space-3); background: var(--sameem-white); font-size: var(--sameem-small-size); }
.permission-legend strong { display: block; color: var(--sameem-navy); }
.customer-toolbar { display: grid; grid-template-columns: minmax(280px, 1fr) auto; align-items: center; gap: var(--sameem-space-4); margin-block-end: var(--sameem-space-4); padding: var(--sameem-space-4); border: 1px solid var(--sameem-border); background: var(--sameem-white); }
.contract-toolbar { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(150px, .35fr) minmax(180px, .45fr) auto; align-items: end; gap: var(--sameem-space-3); margin-block: var(--sameem-space-4); padding: var(--sameem-space-4); border: 1px solid var(--sameem-border); background: var(--sameem-white); }
.contracts-list { display: grid; gap: var(--sameem-space-3); }
.contract-card { display: grid; gap: var(--sameem-space-3); padding: var(--sameem-space-4); border: 1px solid var(--sameem-border); border-inline-start: 4px solid var(--sameem-emerald); background: var(--sameem-white); }
.contract-card-header { display: flex; align-items: start; justify-content: space-between; gap: var(--sameem-space-5); }
.contract-card-header h3 { margin: 5px 0; color: var(--sameem-navy); }
.contract-value { display: grid; justify-items: end; min-width: 220px; color: var(--sameem-text-muted); }
.contract-value strong { color: var(--sameem-navy); font-size: 1.25rem; }
.contract-value span { font-size: var(--sameem-small-size); }
.status-label { display: inline-flex; width: fit-content; padding: 4px 7px; border: 1px solid var(--sameem-border); color: var(--sameem-emerald-strong); background: var(--sameem-bg-subtle); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.contract-lines { display: grid; gap: 8px; padding: 0 20px 15px; }
.contract-pricing-line { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.contract-pricing-line .pricing-description { min-width: 150px; }
.contract-pricing-line .stock-hint { white-space: normal; overflow-wrap: anywhere; }
.fx-card { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-block-end: 16px; padding: 16px 20px; border: 1px solid var(--sameem-border); border-inline-start: 4px solid var(--primary); background: var(--surface-soft); }
.fx-card h2 { font-size: 16px; margin-block: 4px 8px; }
.fx-card strong { display: block; font-size: 22px; text-align: start; }
.fx-card p { max-width: 850px; overflow-wrap: anywhere; }
.fx-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fx-actions a { font-size: 12px; color: var(--sameem-text-muted); }
@media print {
  body.invoice-printing > * { display: none !important; }
  body.invoice-printing > #invoice-print { display: block !important; padding: 12mm; direction: rtl; }
  body.invoice-printing dialog::backdrop { display: none !important; }
  #invoice-print table { width: 100%; border-collapse: collapse; font-size: 11px; }
  #invoice-print td, #invoice-print th { border: 1px solid var(--sameem-border); padding: 6px; white-space: normal; }
  #invoice-print tr { break-inside: avoid; }
  #invoice-print .detail-section, #invoice-print .table-wrap { overflow: visible; }
}
.tender-import-panel { margin: 12px 20px; padding: 16px; border: 1px solid var(--sameem-border); background: var(--surface-soft); }
.tender-import-panel summary { cursor: pointer; font-weight: 700; min-height: var(--sameem-control-min); }
.import-file-label, .import-fields label { display: grid; gap: 8px; min-width: 0; }
.import-file-label input { max-width: 100%; }
.import-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 16px; }
.import-fields select { width: 100%; min-width: 0; }
.import-preview { overflow-x: auto; margin-block: 12px; }
.import-status { white-space: pre-line; overflow-wrap: anywhere; margin-block: 12px 0; }
.import-status.is-error { color: var(--sameem-danger-text); }
.contract-pricing-line .sku-field, .contract-pricing-line .pricing-description { grid-column: span 2; }
.contract-pricing-line .import-source, .contract-pricing-line .import-match-review { grid-column: 1 / -1; overflow-wrap: anywhere; }
.import-source { padding-block: 8px; border-bottom: 1px solid var(--sameem-border); font-size: 12px; color: var(--sameem-text-muted); }
.import-match-review { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--sameem-border); padding-block-start: 12px; }
.import-match-review > span { flex-basis: 100%; }
.import-match-review button { white-space: normal; text-align: start; max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .import-fields { grid-template-columns: minmax(0, 1fr); }
  .tender-import-panel { margin-inline: 12px; padding: 12px; }
  .contract-pricing-line .sku-field, .contract-pricing-line .pricing-description { grid-column: 1 / -1; }
}
.toolbar-summary { margin: 0; color: var(--sameem-text-muted); font-size: var(--sameem-small-size); }
.customer-identity strong, .customer-identity small { display: block; }
.customer-identity small { margin-block-start: var(--sameem-space-1); color: var(--sameem-text-muted); font-size: var(--sameem-small-size); }
.customer-actions { display: flex; flex-wrap: wrap; gap: var(--sameem-space-2); }
.account-status { display: inline-flex; align-items: center; min-height: 28px; padding-inline: var(--sameem-space-2); border-inline-start: 3px solid var(--sameem-emerald); color: var(--sameem-text); background: var(--sameem-bg-subtle); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
.account-status.is-over { border-color: var(--sameem-danger); color: var(--sameem-danger-text); background: var(--sameem-danger-surface); }
.customer-detail-actions { display: flex; flex-wrap: wrap; gap: var(--sameem-space-3); margin-block: var(--sameem-space-4); padding: var(--sameem-space-4); border-inline-start: 4px solid var(--sameem-mint); background: var(--sameem-bg-subtle); }
.warning-copy { margin: 0 var(--sameem-space-5); padding: var(--sameem-space-3); border-inline-start: 4px solid var(--sameem-warning); color: var(--sameem-text); background: var(--sameem-bg-canvas); font-size: var(--sameem-small-size); }
.form-grid textarea { width: 100%; resize: vertical; padding: var(--sameem-space-3); border: 1px solid var(--sameem-border); border-radius: var(--sameem-radius-control); color: var(--sameem-text); background: var(--sameem-white); font: inherit; }
.form-grid textarea:focus { border-color: var(--sameem-focus); outline: 3px solid var(--sameem-focus); outline-offset: 2px; }

@media (max-width: 920px) {
  /* Wrapped navigation scrolls with the page, never over the working area. */
  .primary-nav { position: static; }
  .landing-hero { grid-template-columns: 1fr; min-height: 0; }
  .landing-visual { width: min(100%, 660px); }
  .features-intro { grid-template-columns: 1fr; }
  .login-screen { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 420px; border-inline-end: 0; border-block-end: 6px solid var(--sameem-mint); }
  .login-brand-copy h2 { font-size: clamp(2.2rem, 8vw, 4.8rem); }
  .login-form-panel { min-height: auto; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .table-search { grid-column: 1 / -1; }
  .alert-grid, .detail-kpis, .analytics-kpis, .key-value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .document-line { grid-template-columns: repeat(3, minmax(110px, 1fr)); }
  .document-line .sku-field { grid-column: span 2; }
  .contract-toolbar { grid-template-columns: 1fr 1fr; }
  .contract-toolbar .search-field, .contract-toolbar .toolbar-summary { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .public-header, .public-main, .public-footer { padding-inline: var(--sameem-gutter-mobile); }
  .public-header { min-height: 82px; }
  .public-header .nsk-wordmark { font-size: 1.8rem; }
  .public-login-button { min-height: var(--sameem-control-min); padding-inline: var(--sameem-space-3); }
  .landing-hero { gap: var(--sameem-space-10); padding-block: var(--sameem-space-10); }
  .landing-copy h1 { font-size: clamp(2.15rem, 12vw, 3.5rem); }
  .landing-actions { display: grid; }
  .landing-primary, .landing-secondary { width: 100%; }
  .landing-trust { display: grid; gap: var(--sameem-space-2); }
  .visual-topline { align-items: flex-start; flex-direction: column; }
  .visual-focus { min-height: 230px; padding: var(--sameem-space-5); }
  .visual-modules { grid-template-columns: 1fr; }
  .visual-modules article { min-height: auto; border-inline-end: 0; border-block-end: 1px solid var(--sameem-border-inverse); }
  .visual-modules article:last-child { border-block-end: 0; }
  .landing-features { padding-block: var(--sameem-space-12); }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-grid article { min-height: auto; padding: var(--sameem-space-6) 0; border-inline-end: 0; border-block-end: 1px solid var(--sameem-border-inverse); }
  .feature-grid article:last-child { border-block-end: 0; }
  .feature-grid h3 { margin-block-start: var(--sameem-space-4); }
  .public-footer { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: var(--sameem-space-6); }
  .login-brand-panel { min-height: 290px; padding: var(--sameem-space-6) var(--sameem-gutter-mobile); }
  .login-brand-copy > p { margin-block-end: var(--sameem-space-3); }
  .login-brand-copy h2 { font-size: clamp(2rem, 11vw, 3.1rem); }
  .login-brand-status { display: none; }
  .login-form-panel { padding: var(--sameem-space-5) var(--sameem-gutter-mobile) var(--sameem-space-8); }
  .auth-panel { padding-block: var(--sameem-space-10); }
  .auth-panel h1 { font-size: clamp(1.9rem, 10vw, 2.7rem); }
  .topbar { align-items: flex-start; flex-wrap: wrap; padding: var(--sameem-space-4) var(--sameem-gutter-mobile); }
  .brand { align-items: flex-start; flex-direction: column; width: 100%; min-width: 0; }
  .nsk-app-lockup { max-width: 100%; }
  .brand-divider { display: none; }
  .product-lockup { width: 100%; padding-block-start: var(--sameem-space-2); border-block-start: 1px solid var(--sameem-border); }
  .brand h1 { white-space: normal; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .user-session { order: 3; width: 100%; justify-content: space-between; padding: var(--sameem-space-2) 0 0; border-inline-start: 0; border-block-start: 1px solid var(--sameem-border); }
  .primary-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: var(--sameem-gutter-mobile); }
  .nav-tab { white-space: normal; overflow-wrap: anywhere; padding-inline: var(--sameem-space-2); }
  .summary-grid { gap: 1px; }
  .summary-card { min-height: 96px; padding: var(--sameem-space-4); }
  .data-layout { display: block; }
  .sidebar { position: static; max-height: none; margin-block-end: 12px; }
  .tables-list { display: flex; max-height: none; gap: 6px; padding-block-end: 5px; overflow-x: auto; }
  .table-list-button { flex: 0 0 180px; border: 1px solid var(--line); }
  .table-list-button.is-active { box-shadow: inset 0 -3px var(--primary); }
  .workspace, .welcome-state { min-height: 490px; }
  .table-header, .section-header { align-items: flex-start; flex-direction: column; }
  .table-header { padding: 18px; }
  .toolbar { grid-template-columns: 1fr; padding-inline: 18px; }
  .table-search { grid-column: auto; }
  .subtabs { padding-inline: 14px; overflow-x: auto; }
  .section-header > p { max-width: none; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .pagination > div { width: 100%; justify-content: space-between; }
  .dashboard-grid, .analytics-columns, .split-layout { grid-template-columns: 1fr; }
  .catalog-toolbar, .form-grid.three-columns { grid-template-columns: 1fr 1fr; }
  .family-list { max-height: 220px; }
  .document-line { grid-template-columns: 1fr 1fr; }
  .document-line .sku-field { grid-column: 1 / -1; }
  .dashboard-header .sync-block { width: 100%; }
  .subsection-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (max-width: 640px) {
  main { padding-inline: var(--sameem-gutter-mobile); }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card strong { font-size: 1.3rem; }
  .relationship-grid { grid-template-columns: 1fr; }
  .relation-flow { grid-template-columns: 1fr; }
  .relation-arrow { transform: rotate(90deg); justify-self: center; }
  .alert-grid, .detail-kpis, .analytics-kpis, .key-value-grid, .catalog-toolbar, .form-grid, .form-grid.three-columns { grid-template-columns: 1fr; }
  .document-card { align-items: flex-start; flex-direction: column; }
  .document-card-meta { text-align: start; }
  .document-line { grid-template-columns: 1fr; }
  .document-line .sku-field { grid-column: auto; }
  .product-option { grid-template-columns: minmax(0, 1fr); }
  .product-option-facts { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .quick-product { align-items: flex-start; }
  .quick-product-facts { max-width: 42%; }
  .action-strip { grid-template-columns: 1fr; }
  .permission-legend { grid-template-columns: 1fr; }
  .customer-toolbar { grid-template-columns: 1fr; }
  .contract-toolbar { grid-template-columns: 1fr; }
  .contract-toolbar .search-field, .contract-toolbar .toolbar-summary { grid-column: auto; }
  .contract-card-header { flex-direction: column; }
  .contract-value { justify-items: start; min-width: 0; }
  .quick-action { min-height: 58px; }
  .direct-file-card { flex-direction: column; }
  #products-table thead { display: none; }
  #products-table, #products-table tbody { display: block; }
  #products-table tbody { display: grid; gap: 9px; padding: 9px; }
  #products-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-inline-start: 4px solid var(--sameem-emerald); border-radius: var(--sameem-radius-control); background: var(--sameem-white); overflow: hidden; }
  #products-table tbody td { display: grid; grid-template-columns: minmax(88px, .8fr) minmax(0, 1.2fr); gap: 8px; max-width: none; padding: 8px 10px; border-inline-end: 0; white-space: normal; }
  #products-table tbody td::before { content: attr(data-label); color: var(--muted); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
  #products-table tbody td:first-child, #products-table tbody td:last-child { grid-column: 1 / -1; }
  #products-table tbody td:first-child { display: block; padding: 12px; background: var(--surface-soft); }
  #products-table tbody td:first-child::before { display: none; }
  #products-table .row-actions { justify-content: flex-end; }
  #customers-table thead { display: none; }
  #customers-table, #customers-table tbody { display: block; }
  #customers-table tbody { display: grid; gap: 9px; padding: 9px; }
  #customers-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--sameem-border); border-inline-start: 4px solid var(--sameem-emerald); background: var(--sameem-white); }
  #customers-table tbody td { display: grid; grid-template-columns: minmax(96px,.8fr) minmax(0,1.2fr); gap: 8px; padding: 9px 11px; border-inline-end: 0; white-space: normal; }
  #customers-table tbody td::before { content: attr(data-label); color: var(--sameem-text-muted); font-size: var(--sameem-small-size); font-weight: var(--sameem-font-bold); }
  #customers-table tbody td:first-child, #customers-table tbody td:last-child { grid-column: 1 / -1; }
  #customers-table tbody td:first-child { display: block; background: var(--sameem-bg-subtle); }
  #customers-table tbody td:first-child::before { display: none; }
}

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