/* ==========================================================================
   ALMS tech : Enterprise Product UI Component System (alms-ui.css)
   Wired to ../tokens/tokens.css. First-class Dark/Light & LTR/RTL parity.
   Zero decorative blur, zero rounded bento slop, zero bronze in Light Mode.
   ========================================================================== */

.alms-ui-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 680px;
  background: var(--alms-bg-canvas);
  color: var(--alms-text-primary);
  border: 1px solid var(--alms-border-subtle);
  font-family: var(--alms-font-en);
}
html[dir="rtl"] .alms-ui-shell { font-family: var(--alms-font-ar); }

/* Sidebar */
.alms-ui-sidebar {
  background: var(--alms-bg-surface);
  border-inline-end: 1px solid var(--alms-border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 24px;
}
.alms-ui-sb-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--alms-border-subtle);
}
.alms-ui-sb-brand img { height: 24px; width: auto; display: block; }
.alms-ui-nav { display: flex; flex-direction: column; gap: 4px; }
.alms-ui-nav-group {
  font-family: var(--alms-font-en); font-variant-numeric: tabular-nums;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--alms-text-secondary);
  padding: 12px 10px 6px;
  text-transform: uppercase;
}
.alms-ui-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--alms-text-secondary);
  text-decoration: none;
  border-inline-start: 2px solid transparent;
  transition: color var(--alms-duration-fast) var(--alms-ease-architectural), background var(--alms-duration-fast);
}
.alms-ui-nav a:hover { color: var(--alms-text-heading); background: var(--alms-bg-elevated); }
.alms-ui-nav a.is-active {
  color: var(--alms-text-heading);
  background: var(--alms-bg-elevated);
  border-inline-start-color: var(--alms-brand-primary);
  font-weight: 600;
}
.alms-ui-nav svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Main Column & Command Bar */
.alms-ui-main { display: flex; flex-direction: column; min-width: 0; }
.alms-ui-topbar {
  height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--alms-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--alms-bg-canvas);
}
.alms-ui-cmd {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 12px;
  min-width: 280px;
  background: var(--alms-bg-surface);
  border: 1px solid var(--alms-border-subtle);
  color: var(--alms-text-secondary);
  font-size: 12.5px;
  cursor: pointer;
}
.alms-ui-cmd:hover { border-color: var(--alms-brand-primary); color: var(--alms-text-heading); }
.alms-ui-cmd kbd {
  margin-inline-start: auto;
  font-family: var(--alms-font-en); font-variant-numeric: tabular-nums;
  font-size: 10px;
  padding: 2px 5px;
  border: 1px solid var(--alms-border-subtle);
  color: var(--alms-text-secondary);
}

.alms-ui-content { padding: 24px; display: flex; flex-direction: column; gap: 22px; }

/* Buttons */
.alms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--alms-border-subtle);
  background: var(--alms-bg-canvas);
  color: var(--alms-text-heading);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--alms-duration-fast) var(--alms-ease-architectural);
}
.alms-btn:hover { border-color: var(--alms-brand-primary); }
.alms-btn--primary {
  background: var(--alms-brand-primary);
  border-color: var(--alms-brand-primary);
  color: #FFFFFF;
}
[data-theme="dark"] .alms-btn--primary { color: #0B0D10; }
.alms-btn--primary:hover { background: var(--alms-brand-hover); border-color: var(--alms-brand-hover); }
.alms-btn--sm { height: 30px; padding: 0 12px; font-size: 11.5px; }

/* Status Indicators (Semantic Enterprise Tokens) */
.alms-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--alms-font-en); font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border: 1px solid var(--alms-border-subtle);
  background: var(--alms-bg-surface);
  color: var(--alms-text-heading);
}
.alms-status__dot { width: 6px; height: 6px; display: inline-block; }
.alms-status--ok .alms-status__dot { background: #15803D; }
.alms-status--warn .alms-status__dot { background: #B45309; }
.alms-status--err .alms-status__dot { background: #B91C1C; }
.alms-status--info .alms-status__dot { background: var(--alms-brand-primary); }
[data-theme="dark"] .alms-status--ok .alms-status__dot { background: #22C55E; }
[data-theme="dark"] .alms-status--warn .alms-status__dot { background: #C8A26A; }
[data-theme="dark"] .alms-status--err .alms-status__dot { background: #EF4444; }

/* KPI Strip */
.alms-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 2px solid var(--alms-brand-primary);
  border-bottom: 1px solid var(--alms-border-subtle);
}
.alms-kpi { padding: 16px 18px 16px 0; }
.alms-kpi + .alms-kpi { border-inline-start: 1px solid var(--alms-border-subtle); padding-inline-start: 18px; }
.alms-kpi__lbl { font-size: 11.5px; color: var(--alms-text-secondary); margin-bottom: 6px; }
.alms-kpi__val {
  font-family: var(--alms-font-en);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 700;
  color: var(--alms-text-heading);
  letter-spacing: -0.025em;
  direction: ltr;
  display: inline-block;
}
.alms-kpi__meta { font-family: var(--alms-font-en); font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--alms-text-secondary); margin-top: 4px; }

/* Enterprise Data Table (Tabular Numerals) */
.alms-table-wrap { border: 1px solid var(--alms-border-subtle); overflow-x: auto; }
.alms-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.alms-table th {
  background: var(--alms-bg-surface);
  color: var(--alms-text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: start;
  padding: 11px 14px;
  border-bottom: 1px solid var(--alms-border-subtle);
}
.alms-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--alms-border-subtle);
  color: var(--alms-text-primary);
  vertical-align: middle;
}
.alms-table tr:last-child td { border-bottom: none; }
.alms-table .col-num {
  text-align: end;
  font-family: var(--alms-font-en); font-variant-numeric: tabular-nums;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

/* Form Inputs */
.alms-field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.alms-field { display: flex; flex-direction: column; gap: 6px; }
.alms-field label { font-size: 11.5px; font-weight: 600; color: var(--alms-text-heading); }
.alms-input, .alms-select {
  height: 36px;
  padding: 0 11px;
  background: var(--alms-bg-canvas);
  border: 1px solid var(--alms-border-subtle);
  color: var(--alms-text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.alms-input:focus, .alms-select:focus { border-color: var(--alms-brand-primary); }

/* Modal Sheet */
.alms-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 13, 16, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.alms-modal-backdrop.is-open { display: flex; }
.alms-modal {
  width: 100%;
  max-width: 500px;
  background: var(--alms-bg-canvas);
  border: 1px solid var(--alms-border-subtle);
  border-top: 3px solid var(--alms-brand-primary);
  color: var(--alms-text-primary);
}
.alms-modal__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--alms-border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.alms-modal__head h3 { font-size: 15px; font-weight: 600; color: var(--alms-text-heading); }
.alms-modal__body { padding: 20px; display: flex; flex-direction: column; gap: 14px; font-size: 13px; }
.alms-modal__foot {
  padding: 14px 20px;
  border-top: 1px solid var(--alms-border-subtle);
  background: var(--alms-bg-surface);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
