/* ===================================================================
   alerts.css — Aurora redesign
   Modern, smooth, glass cards · responsive tables · animated transitions
   =================================================================== */

.al-page{
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: 100px 20px 60px;
}

/* ====================================================
   HERO
==================================================== */
.al-hero{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.al-hero__info{ min-width: 0; }
.al-kicker{
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(239,68,68,0.12);
  color: var(--au-bad);
  border: 1px solid rgba(239,68,68,0.30);
  margin-bottom: 10px;
}
.al-title{
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, var(--au-text-1) 0%, var(--au-bad) 60%, var(--au-warn) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.al-sub{
  margin: 0;
  font-size: 13px;
  color: var(--au-text-3);
  max-width: 640px;
  line-height: 1.6;
}

.al-profile{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  background: var(--au-surface-strong);
  border: 1px solid var(--au-border-2);
  border-radius: 999px;
  backdrop-filter: blur(var(--au-blur));
  -webkit-backdrop-filter: blur(var(--au-blur));
}
.al-avatar{
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--au-bad), var(--au-warn));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 0 18px rgba(239,68,68,0.4);
}
.al-name{ font-weight: 700; font-size: 13px; color: var(--au-text-1); }
.al-role{ font-size: 11px; color: var(--au-text-3); }
.al-sync{ font-size: 10px; color: var(--au-text-4); font-family: ui-monospace, Menlo, monospace; }

/* ====================================================
   STATS row (KPIs)
==================================================== */
.al-stats{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.al-stat{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: var(--au-r);
  background: var(--au-surface);
  border: 1px solid var(--au-border);
  backdrop-filter: blur(var(--au-blur));
  -webkit-backdrop-filter: blur(var(--au-blur));
  transition: border-color .2s, transform .15s;
  overflow: hidden;
}
.al-stat:hover{
  border-color: var(--au-border-2);
  transform: translateY(-2px);
}
.al-stat::after{
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(140% 80% at 0% 0%, color-mix(in srgb, var(--au-bad) 12%, transparent), transparent 60%);
  pointer-events: none;
  opacity: .5;
}
.al-stat span{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--au-text-3);
}
.al-stat b{
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--au-text-1);
  z-index: 1;
}
.al-stat:nth-child(1) b{ color: var(--au-bad); }
.al-stat:nth-child(2) b{ color: var(--au-warn); }
.al-stat:nth-child(3) b{ color: var(--au-ok); }
.al-stat:nth-child(4) b{ font-size: 18px; }

/* ====================================================
   MAIN CARD container
==================================================== */
.al-card{
  background: var(--au-surface-strong);
  border: 1px solid var(--au-border-2);
  border-radius: var(--au-r-lg);
  backdrop-filter: blur(var(--au-blur));
  -webkit-backdrop-filter: blur(var(--au-blur));
  overflow: hidden;
}

/* ====================================================
   TABS — pill style with smooth animated underline
==================================================== */
.al-tabs{
  display: flex;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--au-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.al-tabs::-webkit-scrollbar{ display: none; }
.al-tab{
  position: relative;
  flex-shrink: 0;
  padding: 9px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--au-text-3);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.al-tab:hover{
  color: var(--au-text-1);
  background: var(--au-surface);
}
.al-tab.active{
  color: var(--au-accent);
  background: rgba(6,182,212,0.12);
  border-color: rgba(6,182,212,0.30);
  box-shadow: 0 4px 14px rgba(6,182,212,0.18);
}

.al-panel{ display: none; padding: 18px; animation: al-fade .2s ease-out; }
.al-panel.active{ display: block; }
@keyframes al-fade{ from{ opacity: 0; transform: translateY(4px); } }

/* ====================================================
   TOOLBAR (filters + actions)
==================================================== */
.al-toolbar{
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--au-r);
  background: var(--au-surface);
  border: 1px solid var(--au-border);
  margin-bottom: 14px;
}
.al-field{ display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.al-field.grow{ flex: 1; min-width: 220px; }
.al-field.wide{ grid-column: 1 / -1; }
.al-field label{
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--au-text-3);
}
.al-input{
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  color: var(--au-text-1);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.al-input::placeholder{ color: var(--au-text-3); }
.al-input:focus{
  border-color: var(--au-accent);
  background: var(--au-surface-2);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.18);
}
.al-textarea{ min-height: 76px; padding: 10px 12px; resize: vertical; }

.al-spacer{ flex: 1; min-width: 4px; }

.al-pager{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--au-text-3);
  padding: 0 4px;
}
.al-pager b{ color: var(--au-text-1); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ====================================================
   BUTTONS
==================================================== */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  color: var(--au-text-1);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover{ background: var(--au-surface-2); border-color: var(--au-border-2); }
.btn:active{ transform: scale(.97); }
.btn:disabled{ opacity: .4; cursor: not-allowed; }
.btn.primary{
  background: linear-gradient(135deg, var(--au-accent), var(--au-accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(6,182,212,0.3);
}
.btn.primary:hover{ box-shadow: 0 12px 28px rgba(6,182,212,0.45); }
.btn.danger{
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.40);
  color: var(--au-bad);
}
.btn.danger:hover{ background: rgba(239,68,68,0.25); }
.btn.tiny{ height: 30px; padding: 0 10px; font-size: 12px; }

/* ====================================================
   NOTE banner
==================================================== */
.al-note{
  padding: 12px 16px;
  margin: 10px 0 14px;
  border-radius: var(--au-r);
  background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(139,92,246,0.04));
  border: 1px solid rgba(6,182,212,0.20);
  color: var(--au-text-2);
  font-size: 12.5px;
  line-height: 1.65;
}
.al-note b{ color: var(--au-text-1); font-weight: 800; }

/* ====================================================
   GRID / TABLE
==================================================== */
.al-gridWrap{
  position: relative;
  border-radius: var(--au-r);
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  overflow: auto;
  max-height: 70vh;
}
.al-grid{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.al-grid thead{
  position: sticky; top: 0; z-index: 2;
  background: var(--au-surface-strong);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.al-grid th{
  padding: 12px 12px;
  text-align: start;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--au-text-3);
  border-bottom: 1px solid var(--au-border);
  white-space: nowrap;
}
.al-grid td{
  padding: 12px 12px;
  border-bottom: 1px solid var(--au-border);
  color: var(--au-text-1);
  vertical-align: middle;
}
.al-grid tbody tr{ transition: background .12s; }
.al-grid tbody tr:hover{ background: var(--au-surface-2); }
.al-grid tbody tr:last-child td{ border-bottom: none; }
.al-grid .c-brand{ font-weight: 700; }
.al-grid .c-model{ color: var(--au-text-2); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-grid .c-desc{ color: var(--au-text-3); font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-grid .c-meters{ color: var(--au-text-2); text-align: center; font-variant-numeric: tabular-nums; }
.al-grid .c-current{ text-align: center; font-variant-numeric: tabular-nums; }
.al-grid .c-current b{ font-size: 15px; font-weight: 800; color: var(--au-text-1); }
.al-grid .c-threshold{ text-align: center; }
.al-grid .c-enabled{ text-align: center; }
.al-grid .c-status{ text-align: center; white-space: nowrap; }
.al-grid .c-actions{ text-align: end; white-space: nowrap; }
.al-grid .c-actions .btn{ height: 28px; padding: 0 10px; font-size: 11px; }

/* Threshold cell layout */
.al-th-cell{
  display: inline-flex; align-items: center; gap: 4px;
  justify-content: center;
}
.al-numInput{
  width: 80px;
  height: 32px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--au-border);
  background: var(--au-surface-strong);
  color: var(--au-text-1);
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, Menlo, monospace;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.al-numInput:focus{
  border-color: var(--au-accent);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.20);
}
.al-numInput::-webkit-inner-spin-button,
.al-numInput::-webkit-outer-spin-button{ -webkit-appearance: none; margin: 0; }
.al-numInput[type="number"]{ -moz-appearance: textfield; }

/* Apply-to-all button */
.al-applyall{
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  color: var(--au-text-3);
  cursor: pointer;
  font-size: 14px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
  font-family: inherit;
}
.al-applyall:hover{
  background: rgba(6,182,212,0.18);
  border-color: var(--au-accent);
  color: var(--au-accent);
  transform: scale(1.08);
}

/* Suggested-threshold button */
.al-suggest{
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid rgba(245,158,11,0.30);
  background: rgba(245,158,11,0.10);
  color: var(--au-warn);
  cursor: pointer;
  font-size: 11px; font-weight: 800;
  font-family: inherit;
  white-space: nowrap;
  transition: all .15s;
}
.al-suggest:hover{ background: rgba(245,158,11,0.25); transform: scale(1.06); }

/* ====================================================
   TOGGLE SWITCH
==================================================== */
.al-switch{
  width: 38px; height: 22px;
  border-radius: 999px;
  background: var(--au-surface-2);
  border: 1px solid var(--au-border);
  position: relative;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  display: inline-block;
}
.al-switch::after{
  content: "";
  position: absolute;
  top: 2px; inset-inline-start: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--au-text-3);
  transition: transform .22s cubic-bezier(.4,1.4,.6,1), background .2s;
}
.al-switch.on{
  background: linear-gradient(135deg, var(--au-ok), #059669);
  border-color: transparent;
  box-shadow: 0 0 12px rgba(16,185,129,0.4);
}
.al-switch.on::after{
  transform: translateX(16px);
  background: #fff;
}
[dir="rtl"] .al-switch.on::after{ transform: translateX(-16px); }

/* ====================================================
   CHECKBOX CHIP ("الناقص فقط")
==================================================== */
.al-check{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 38px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  border-radius: 9px;
  font-size: 12.5px; font-weight: 600;
  color: var(--au-text-2);
  cursor: pointer; user-select: none;
  transition: all .15s;
}
.al-check:hover{ border-color: var(--au-border-2); color: var(--au-text-1); }
.al-check:has(input:checked){
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.40);
  color: var(--au-bad);
  box-shadow: 0 0 12px rgba(239,68,68,0.20);
}
.al-check input{ accent-color: var(--au-bad); cursor: pointer; }

/* ====================================================
   BADGES
==================================================== */
.al-badge{
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.al-badge.ok{ background: rgba(16,185,129,0.18); color: var(--au-ok); }
.al-badge.warn{ background: rgba(245,158,11,0.18); color: var(--au-warn); }
.al-badge.danger{ background: rgba(239,68,68,0.20); color: var(--au-bad); }
.al-badge.muted{ background: var(--au-surface-2); color: var(--au-text-3); }

/* ====================================================
   ROW STATES (saving / saved / error / triggered)
==================================================== */
tr.al-saving{ opacity: .6; }
tr.al-saved td{ background: rgba(16,185,129,0.10); }
tr.al-saved{ animation: al-flash-ok .9s ease-out; }
tr.al-error td{ background: rgba(239,68,68,0.10); }
tr.al-error{ animation: al-flash-err 1.5s ease-out; }
@keyframes al-flash-ok{
  0%{ box-shadow: inset 3px 0 0 var(--au-ok); }
  100%{ box-shadow: none; }
}
@keyframes al-flash-err{
  0%, 30%{ box-shadow: inset 3px 0 0 var(--au-bad); }
  100%{ box-shadow: none; }
}
tr.is-triggered td{ background: rgba(239,68,68,0.06); }
tr.is-triggered td.c-current b{ color: var(--au-bad); }
body.al-only-triggered tr[data-item]:not(.is-triggered){ display: none; }

/* ====================================================
   EMPTY / LOADING STATES
==================================================== */
.al-empty, .al-loading{
  padding: 60px 20px;
  text-align: center;
  color: var(--au-text-3);
  font-size: 13px;
}
.al-loading::before{
  content: "";
  display: inline-block;
  width: 22px; height: 22px;
  border: 2.5px solid var(--au-border);
  border-top-color: var(--au-accent);
  border-radius: 50%;
  animation: al-spin .7s linear infinite;
  vertical-align: middle;
  margin-inline-end: 10px;
}
@keyframes al-spin{ to{ transform: rotate(360deg); } }

/* ====================================================
   MODALS
==================================================== */
.al-modal{
  position: fixed; inset: 0; z-index: 2000;
  display: none;
}
.al-modal[aria-hidden="false"]{ display: block; }
.al-modal__backdrop{
  position: absolute; inset: 0;
  background: rgba(5,6,20,0.65);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: al-fade-in .15s;
}
@keyframes al-fade-in{ from{ opacity: 0; } }
.al-modal__panel{
  position: relative;
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 80px);
  margin: 8vh auto 0;
  background: var(--au-surface-strong);
  border: 1px solid var(--au-border-2);
  border-radius: var(--au-r-lg);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 60px rgba(6,182,212,0.15);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: al-pop-in .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes al-pop-in{ from{ opacity: 0; transform: scale(.96) translateY(10px); } }
.al-modal__head{
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--au-border);
}
.al-modal__title{
  font-size: 17px; font-weight: 800;
  color: var(--au-text-1);
  letter-spacing: -0.02em;
}
.al-modal__sub{ font-size: 12px; color: var(--au-text-3); margin-top: 4px; }
.al-modal__body{ padding: 18px 20px; overflow-y: auto; flex: 1; }
.al-modal__foot{
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--au-border);
  background: var(--au-surface);
}
.al-formGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.al-formGrid .wide{ grid-column: 1 / -1; }
.al-formGrid .al-field{ min-width: 0; }

.al-btn-loading{ opacity: .7; cursor: wait; }

/* ====================================================
   RESPONSIVE
==================================================== */
@media (max-width: 900px){
  .al-page{ padding: 90px 14px 40px; }
  .al-hero{ grid-template-columns: 1fr; }
  .al-stats{ grid-template-columns: repeat(2, 1fr); }
  .al-formGrid{ grid-template-columns: 1fr; }
  .al-tabs{ gap: 2px; }
  .al-tab{ font-size: 12px; padding: 8px 12px; }
  .al-grid{ font-size: 12px; }
  .al-grid th, .al-grid td{ padding: 9px 8px; }
  .al-grid .c-desc{ display: none; }
}
@media (max-width: 560px){
  .al-stats{ grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .al-stat{ padding: 12px 14px; }
  .al-stat b{ font-size: 22px; }
  .al-grid .c-meters{ display: none; }
  .al-grid .c-brand{ font-size: 12px; }
  .al-numInput{ width: 64px; height: 28px; font-size: 12px; }
  .al-applyall, .al-suggest{ height: 24px; }
}
