/**
 * MARITIME INDUSTRIAL OPERATIONS - DESIGN SYSTEM
 * نظام العمليات البحرية والساحات اللوجستية
 * Architecture: RTL-First with Bidirectional ISO Isolation
 */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600;700;800&display=swap');

:root {
  /* Surface Tokens */
  --color-surface: #f6fafe;
  --color-surface-dim: #d6dade;
  --color-surface-bright: #f6fafe;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-low: #f0f4f8;
  --color-surface-container: #eaeef2;
  --color-surface-container-high: #e4e9ed;
  --color-surface-container-highest: #dfe3e7;
  --color-on-surface: #171c1f;
  --color-on-surface-variant: #44474d;
  --color-inverse-surface: #2c3134;
  --color-inverse-on-surface: #edf1f5;
  --color-outline: #74777e;
  --color-outline-variant: #c4c6ce;
  --color-surface-tint: #4d5f7a;

  /* Primary & Accent Tokens */
  --color-primary: #000511;
  --color-on-primary: #ffffff;
  --color-primary-container: #0b1f36; /* Primary Navy */
  --color-on-primary-container: #7587a3;
  --color-inverse-primary: #b5c8e6;

  /* Secondary (Safety Amber) */
  --color-secondary: #a73a00;
  --color-on-secondary: #ffffff;
  --color-secondary-container: #ea580c; /* Safety Terminal Amber */
  --color-on-secondary-container: #571a00;

  /* Tertiary */
  --color-tertiary: #00050d;
  --color-on-tertiary: #ffffff;
  --color-tertiary-container: #002035;
  --color-on-tertiary-container: #1d8dd0;

  /* Error / Alerts */
  --color-error: #ba1a1a;
  --color-on-error: #ffffff;
  --color-error-container: #ffdad6;
  --color-on-error-container: #93000a;

  /* Fixed Colors */
  --color-primary-fixed: #d3e3ff;
  --color-primary-fixed-dim: #b5c8e6;
  --color-on-primary-fixed: #081c33;
  --color-on-primary-fixed-variant: #364861;
  --color-secondary-fixed: #ffdbce;
  --color-secondary-fixed-dim: #ffb599;
  --color-on-secondary-fixed: #370e00;
  --color-on-secondary-fixed-variant: #7f2b00;

  /* Background & Base */
  --color-background: #f1f5f9; /* Slate 100 Glare-proof canvas */
  --color-on-background: #0f172a; /* Slate 900 7:1 contrast */

  /* Specific Yard State Tokens */
  --yard-primary-navy: #0b1f36;
  --yard-safety-amber: #ea580c;
  --yard-safety-amber-light: #fff7ed;
  --yard-occupied-teal: #0284c7;
  --yard-occupied-teal-light: #f0f9ff;
  --yard-reefer-cyan: #06b6d4;
  --yard-reefer-cyan-light: #ecfeff;
  --yard-alert-red: #ef4444;
  --yard-alert-red-light: #fef2f2;
  --yard-empty-slate-bg: #f8fafc;
  --yard-empty-slate-border: #94a3b8;
  --yard-card-border: #cbd5e1;
  --yard-card-border-focus: #0b1f36;
  --yard-cleared-green: #16a34a;
  --yard-cleared-green-light: #f0fdf4;

  /* Typography */
  --font-arabic: 'IBM Plex Sans Arabic', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing */
  --spacing-gutter: 0.75rem;
  --spacing-margin: 1rem;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 0.875rem;
  --spacing-lg: 1.25rem;
  --spacing-xl: 1.75rem;

  /* Shapes - Soft Industrial Geometry */
  --radius-sm: 0.125rem;
  --radius-default: 0.25rem; /* 4px baseline */
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;    /* 8px composite cards */
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* Physical Tactile Depth (Zero washed out soft shadows) */
  --shadow-tactile-card: 0 2px 0 0 rgba(15, 23, 42, 0.08);
  --shadow-tactile-float: 0 4px 12px rgba(11, 31, 54, 0.16);
  --shadow-tactile-button: 0 3px 0 0 #071424;
  --shadow-amber-button: 0 3px 0 0 #9a3412;
}

/* ==========================================================================
   RESET & FOUNDATIONS
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  background-color: var(--color-background);
  color: var(--color-on-background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-background);
  color: var(--color-on-background);
  font-size: 14px;
}

/* ==========================================================================
   TYPOGRAPHY SYSTEM
   ========================================================================== */
.font-arabic { font-family: var(--font-arabic); }
.font-mono { font-family: var(--font-mono); }

/* ISO & Coordinate Strict LTR Isolation */
.iso-code, .slot-coord, .mono-code, [data-iso], [dir="ltr"] {
  font-family: var(--font-mono) !important;
  direction: ltr !important;
  unicode-bidi: isolate !important;
  display: inline-block;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.headline-lg {
  font-family: var(--font-arabic);
  font-size: 26px;
  font-weight: 700;
  line-height: 36px;
  color: var(--yard-primary-navy);
}

.headline-md {
  font-family: var(--font-arabic);
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  color: var(--yard-primary-navy);
}

.headline-sm {
  font-family: var(--font-arabic);
  font-size: 18px;
  font-weight: 600;
  line-height: 26px;
  color: var(--yard-primary-navy);
}

.body-lg {
  font-family: var(--font-arabic);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

.body-md {
  font-family: var(--font-arabic);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.body-sm {
  font-family: var(--font-arabic);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  color: var(--color-on-surface-variant);
}

.label-code-lg {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: 0.08em;
}

.label-code-md {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.06em;
}

.label-code-sm {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  letter-spacing: 0.04em;
}

.label-status {
  font-family: var(--font-arabic);
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
}

/* ==========================================================================
   LAYOUT & CONTAINER
   ========================================================================== */
.terminal-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.terminal-sidebar {
  width: 260px;
  background-color: var(--yard-primary-navy);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-left: 2px solid #000511;
  transition: width 0.2s ease;
  z-index: 40;
}

.terminal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--color-background);
}

.terminal-header {
  height: 64px;
  background-color: #ffffff;
  border-bottom: 2px solid var(--yard-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 30;
  box-shadow: var(--shadow-tactile-card);
}

.terminal-content {
  flex: 1;
  padding: 1.25rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   TACTILE & GLOVE-READY BUTTONS (Minimum 48px - 56px touch footprint)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.25rem;
  font-family: var(--font-arabic);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-default);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-lg {
  min-height: 54px;
  font-size: 16px;
  padding: 0 1.5rem;
}

.btn-sm {
  min-height: 38px;
  font-size: 13px;
  padding: 0 0.875rem;
}

/* 1. Primary Navy Action */
.btn-primary {
  background-color: var(--yard-primary-navy);
  color: #ffffff;
  border: 1.5px solid #000511;
  box-shadow: 0 3px 0 0 #000511;
}
.btn-primary:hover {
  background-color: #122b49;
}
.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 #000511;
}

/* 2. Safety Terminal Amber Action (Machinery moves, Gate pass, Pickups) */
.btn-amber {
  background-color: var(--yard-safety-amber);
  color: #ffffff;
  border: 1.5px solid #c2410c;
  box-shadow: var(--shadow-amber-button);
  font-weight: 700;
}
.btn-amber:hover {
  background-color: #f97316;
}
.btn-amber:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 #9a3412;
}

/* 3. Secondary / Neutral Outlined */
.btn-outline {
  background-color: #ffffff;
  color: var(--yard-primary-navy);
  border: 1.5px solid var(--yard-card-border);
  box-shadow: 0 2px 0 0 rgba(15, 23, 42, 0.06);
}
.btn-outline:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
}
.btn-outline:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* 4. Danger Action */
.btn-danger {
  background-color: var(--yard-alert-red);
  color: #ffffff;
  border: 1.5px solid #b91c1c;
  box-shadow: 0 3px 0 0 #991b1b;
}
.btn-danger:hover {
  background-color: #dc2626;
}
.btn-danger:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 #991b1b;
}

/* ==========================================================================
   INPUTS & SCANNER TRIGGER INPUT (52px height)
   ========================================================================== */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--yard-primary-navy);
  margin-bottom: 0.375rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.75rem 1rem;
  background-color: #ffffff;
  border: 1.5px solid var(--yard-empty-slate-border);
  border-radius: var(--radius-default);
  font-family: var(--font-arabic);
  font-size: 15px;
  color: var(--color-on-background);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--yard-primary-navy);
  box-shadow: 0 0 0 3px rgba(11, 31, 54, 0.12);
}

.form-input-mono {
  font-family: var(--font-mono) !important;
  direction: ltr !important;
  letter-spacing: 0.06em;
  font-weight: 600;
  font-size: 16px;
  text-transform: uppercase;
}

/* Barcode / OCR Trigger Composite Input */
.scan-input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  border-radius: var(--radius-default);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.scan-input-group .form-input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: none;
}

.scan-input-btn {
  background-color: var(--yard-safety-amber);
  color: #ffffff;
  border: 1.5px solid #c2410c;
  padding: 0 1.25rem;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  cursor: pointer;
  border-top-left-radius: var(--radius-default);
  border-bottom-left-radius: var(--radius-default);
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.scan-input-btn:hover {
  background-color: #ea580c;
}
.scan-input-btn:active {
  background-color: #c2410c;
}

/* ==========================================================================
   CARDS & STRUCTURAL MODULES (Surface Tier 1 & Tier 2)
   ========================================================================== */
.card {
  background-color: #ffffff;
  border: 1px solid var(--yard-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-tactile-card);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1.5px solid #f1f5f9;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--yard-primary-navy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Surface Tier 2: Floating Action Bars & Modals */
.floating-bar {
  background-color: #ffffff;
  border: 2px solid var(--yard-primary-navy);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-tactile-float);
  padding: 1rem 1.5rem;
}

/* ==========================================================================
   ISO CHIPS & COORDINATE BADGES (JetBrains Mono)
   ========================================================================== */
/* Standard Container Chip */
.iso-badge {
  background-color: #0f172a;
  color: #38bdf8; /* Cyan 400 */
  font-family: var(--font-mono) !important;
  direction: ltr !important;
  unicode-bidi: isolate !important;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-default);
  border: 1px solid #1e293b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.08em;
}

.iso-badge-lg {
  font-size: 16px;
  padding: 6px 14px;
}

.iso-badge-reefer {
  color: #06b6d4;
  background-color: #082f49;
  border-color: #0284c7;
}

.iso-badge-damaged {
  color: #fca5a5;
  background-color: #450a0a;
  border-color: #dc2626;
}

/* Spatial Slot Coordinate Chip */
.coord-badge {
  background-color: #f8fafc;
  color: var(--yard-primary-navy);
  border: 1.5px solid var(--yard-primary-navy);
  font-family: var(--font-mono) !important;
  direction: ltr !important;
  unicode-bidi: isolate !important;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-default);
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   QUICK STATUS PILLS (3px colored border right in RTL)
   ========================================================================== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-default);
  border-right: 3.5px solid transparent;
  line-height: 1.2;
}

.status-pill-transit {
  background-color: #fff7ed;
  color: #c2410c;
  border-right-color: var(--yard-safety-amber);
}

.status-pill-cleared {
  background-color: #f0fdf4;
  color: #15803d;
  border-right-color: var(--yard-cleared-green);
}

.status-pill-hold {
  background-color: #fef2f2;
  color: #b91c1c;
  border-right-color: #dc2626;
}

.status-pill-reefer {
  background-color: #ecfeff;
  color: #0891b2;
  border-right-color: var(--yard-reefer-cyan);
}

.status-pill-empty {
  background-color: #f1f5f9;
  color: #64748b;
  border-right-color: #94a3b8;
}

/* ==========================================================================
   YARD CELL GRID BLOCKS (Interactive Matrix)
   ========================================================================== */
.yard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 0.65rem;
}

.yard-cell {
  position: relative;
  min-height: 90px;
  padding: 0.5rem;
  border-radius: var(--radius-default);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s ease;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.yard-cell:active {
  transform: scale(0.97);
}

/* Empty Cell */
.yard-cell-empty {
  background-color: #ffffff;
  border: 1.5px dashed var(--yard-empty-slate-border);
  color: #64748b;
}
.yard-cell-empty:hover {
  border-color: var(--yard-primary-navy);
  background-color: #f8fafc;
}

/* Occupied Standard Teal */
.yard-cell-occupied {
  background-color: var(--yard-occupied-teal);
  border: 1.5px solid #0369a1;
  color: #ffffff;
  box-shadow: 0 2px 0 0 #075985;
}
.yard-cell-occupied:hover {
  background-color: #0277b0;
}

/* Active Reefer Cyan */
.yard-cell-reefer {
  background-color: #ecfeff;
  border: 2px solid var(--yard-reefer-cyan);
  color: #0e7490;
  box-shadow: 0 2px 0 0 #0891b2;
}
.yard-cell-reefer:hover {
  background-color: #cffafe;
}

/* Customs Hold / Damaged Alert */
.yard-cell-hold {
  background-color: #fef2f2;
  border: 2px solid var(--yard-alert-red);
  color: #b91c1c;
  box-shadow: 0 2px 0 0 #dc2626;
}
.yard-cell-hold:hover {
  background-color: #fee2e2;
}

.yard-cell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.yard-cell-coord {
  font-family: var(--font-mono);
  direction: ltr;
  font-weight: 700;
  font-size: 11px;
}

.yard-cell-tier {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  background: rgba(0,0,0,0.15);
  padding: 1px 4px;
  border-radius: 2px;
}

.yard-cell-cno {
  font-family: var(--font-mono);
  direction: ltr;
  font-weight: 700;
  font-size: 12px;
  margin: 3px 0;
  word-break: break-all;
}

.yard-cell-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
}

/* ==========================================================================
   CONTAINER INSPECTION CARDS
   ========================================================================== */
.inspection-card {
  background-color: #ffffff;
  border: 1px solid var(--yard-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-tactile-card);
  overflow: hidden;
  margin-bottom: 1rem;
}

.inspection-card-head {
  background-color: #f8fafc;
  border-bottom: 1.5px solid var(--yard-card-border);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.inspection-card-body {
  padding: 1.25rem;
}

.weight-stack {
  display: flex;
  gap: 1.25rem;
  margin: 0.75rem 0;
  padding: 0.75rem;
  background-color: #f1f5f9;
  border-radius: var(--radius-default);
  border: 1px solid #e2e8f0;
}

.weight-item {
  display: flex;
  flex-direction: column;
}

.weight-item-lbl {
  font-size: 11px;
  color: var(--color-on-surface-variant);
  font-weight: 600;
}

.weight-item-val {
  font-family: var(--font-mono);
  direction: ltr;
  font-size: 14px;
  font-weight: 700;
  color: var(--yard-primary-navy);
}

.seal-checkbox-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background-color: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius-default);
  margin-top: 0.75rem;
  font-weight: 600;
  color: #166534;
}

.seal-checkbox-box input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: #16a34a;
  cursor: pointer;
}

/* ==========================================================================
   KPI SUMMARY METRIC CARDS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background-color: #ffffff;
  border: 1.5px solid var(--yard-card-border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-tactile-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.kpi-card-bar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background-color: var(--yard-primary-navy);
}

.kpi-card-bar.amber { background-color: var(--yard-safety-amber); }
.kpi-card-bar.teal { background-color: var(--yard-occupied-teal); }
.kpi-card-bar.cyan { background-color: var(--yard-reefer-cyan); }
.kpi-card-bar.red { background-color: var(--yard-alert-red); }

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-on-surface-variant);
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-family: var(--font-mono);
  direction: ltr;
  text-align: right;
  font-size: 28px;
  font-weight: 800;
  color: var(--yard-primary-navy);
  line-height: 1.1;
}

.kpi-sub {
  margin-top: 0.5rem;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   DATA TABLES (Dense Operational High Contrast)
   ========================================================================== */
.table-container {
  background-color: #ffffff;
  border: 1px solid var(--yard-card-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-tactile-card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 13px;
}

.table th {
  background-color: #f8fafc;
  color: var(--yard-primary-navy);
  font-weight: 700;
  padding: 0.875rem 1rem;
  border-bottom: 2px solid var(--yard-card-border);
  white-space: nowrap;
}

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  color: var(--color-on-background);
  vertical-align: middle;
}

.table tr:hover td {
  background-color: #f8fafc;
}

/* ==========================================================================
   NAVIGATION & SIDEBAR
   ========================================================================== */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-right: 4px solid transparent;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.active {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-right-color: var(--yard-safety-amber);
}

.nav-category {
  padding: 1rem 1.25rem 0.35rem;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   MODALS & DRAWERS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 31, 54, 0.65);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background-color: #ffffff;
  border: 2px solid var(--yard-primary-navy);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-tactile-float);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.15s ease-out;
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 2px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1.5px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   TOASTS & NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background-color: #ffffff;
  border: 2px solid var(--yard-primary-navy);
  border-radius: var(--radius-default);
  box-shadow: var(--shadow-tactile-float);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 320px;
  font-weight: 600;
  animation: toastIn 0.2s ease-out;
}

.toast-amber {
  border-color: var(--yard-safety-amber);
  background-color: #fff7ed;
  color: #9a3412;
}

.toast-green {
  border-color: var(--yard-cleared-green);
  background-color: #f0fdf4;
  color: #166534;
}

.toast-red {
  border-color: var(--yard-alert-red);
  background-color: #fef2f2;
  color: #991b1b;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVENESS (Desert & Harbor Mobile Tablets)
   ========================================================================== */
@media (max-width: 992px) {
  .terminal-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -280px;
    width: 270px;
  }
  .terminal-sidebar.open {
    right: 0;
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 35;
    display: none;
  }
  .sidebar-overlay.active {
    display: block;
  }
}
