/* AGS Manager — light-blue theme on top of Fomantic UI. */

:root {
  --mgr-bg: #eaf4fc;            /* page background */
  --mgr-sidebar-bg: #d9ecfa;    /* sidebar */
  --mgr-sidebar-border: #bcdcf2;
  --mgr-topbar-bg: #f4fafe;
  --mgr-accent: #2185d0;        /* fomantic primary blue */
  --mgr-accent-dark: #0f4c81;
  --mgr-text: #173a52;
  --mgr-muted: #6b87a0;
  --mgr-segment-border: #cfe4f4;
}

body {
  background: var(--mgr-bg);
  color: var(--mgr-text);
}

/* ---------- Sidebar ---------- */
.mgr-sidebar {
  width: 220px;
  background: var(--mgr-sidebar-bg) !important;
  border-right: 1px solid var(--mgr-sidebar-border);
  height: 100vh;
}
.mgr-sidebar .item {
  color: var(--mgr-text) !important;
  font-weight: 600;
}
.mgr-sidebar .item:hover {
  background: #c7e3f7 !important;
}
.mgr-sidebar .item.active {
  background: #bfe0f7 !important;
  color: var(--mgr-accent-dark) !important;
  border-left: 3px solid var(--mgr-accent);
}
.mgr-brand {
  font-size: 1.15em;
  font-weight: 700;
  color: var(--mgr-accent-dark) !important;
  border-bottom: 1px solid var(--mgr-sidebar-border);
  padding: 18px 14px !important;
}
.mgr-sidebar-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  border-top: 1px solid var(--mgr-sidebar-border);
  color: var(--mgr-muted) !important;
  font-weight: 400;
}
.mgr-clock { font-variant-numeric: tabular-nums; }

/* ---------- Top bar + content ---------- */
.mgr-main { margin-left: 220px; }
.mgr-topbar {
  background: var(--mgr-topbar-bg) !important;
  border-bottom: 1px solid var(--mgr-segment-border);
  margin: 0 !important;
  padding: 8px 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.mgr-env { color: var(--mgr-muted); font-size: 0.9em; }
.mgr-content { padding: 22px; max-width: 1400px !important; }
.mgr-date { color: var(--mgr-muted); font-size: 0.75em; font-weight: 400; margin-left: 8px; }
.mgr-id { font-size: 0.7em; margin-left: 8px; }

/* ---------- Segments / cards ---------- */
.mgr-segment {
  background: #ffffff !important;
  border: 1px solid var(--mgr-segment-border) !important;
  box-shadow: 0 1px 3px rgba(23, 58, 82, 0.06) !important;
}
.mgr-segment > .header { color: var(--mgr-accent-dark); }

/* ---------- Statistics ---------- */
.mgr-stats {
  width: 100%;
  justify-content: space-around;
  background: #ffffff;
  border: 1px solid var(--mgr-segment-border);
  border-radius: 4px;
  padding: 14px 0;
  margin-bottom: 18px;
}
.mgr-stats .statistic .value { color: var(--mgr-accent-dark); }
.mgr-stats .statistic .label { color: var(--mgr-muted); }
.mgr-indicators .statistic .value { font-size: 1.2rem !important; }

/* ---------- Dispatch gate bar ---------- */
.mgr-dispatch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px !important;
  margin-bottom: 18px;
}
.mgr-dispatch-info { display: flex; align-items: center; gap: 8px; }
.mgr-dispatch-info .icon { margin: 0; font-size: 1.1em; }
#mgr-dispatch-btn { min-width: 72px; font-weight: 700; letter-spacing: 0.5px; }
#mgr-dispatch-btn:disabled { opacity: 0.6; cursor: default; }

/* ---------- Tables ---------- */
.ui.table thead th {
  background: #f0f8fe;
  color: var(--mgr-accent-dark);
  border-bottom: 2px solid var(--mgr-segment-border);
}
.ui.table td { border-color: #e4f0f9; }
.mgr-row { cursor: pointer; }
.mgr-detail td { background: #f4fafe !important; }
.mgr-muted { color: var(--mgr-muted); }
.mgr-dot { width: 0.9em !important; height: 0.9em !important; padding: 0 !important; margin-right: 4px !important; }

/* ---------- Login ---------- */
.mgr-login-body { background: var(--mgr-bg); }
.mgr-login-grid { height: 100vh; }
.mgr-login-col { max-width: 420px; }
.mgr-brand-text { color: var(--mgr-accent-dark) !important; }
.mgr-brand-text .sub.header { color: var(--mgr-muted) !important; }
.mgr-login-hint { font-size: 0.9em; color: var(--mgr-muted) !important; }
#mgr-login-btn.loading { opacity: 0.7; pointer-events: none; }
#mgr-login-btn.loading::after { content: "…"; }

/* ---------- Toasts ---------- */
.mgr-toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mgr-toast {
  min-width: 260px;
  opacity: 1;
  transition: opacity 0.6s;
  box-shadow: 0 2px 8px rgba(23, 58, 82, 0.15);
}
.mgr-toast-out { opacity: 0; }

/* ---------- Modal (vanilla) ---------- */
.mgr-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  min-width: 360px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(23, 58, 82, 0.25);
}
.mgr-modal.active { display: block; }
.mgr-modal .header {
  padding: 14px 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--mgr-segment-border);
  color: var(--mgr-accent-dark);
}
.mgr-modal .content { padding: 18px; }
.mgr-modal .actions {
  padding: 12px 18px;
  border-top: 1px solid var(--mgr-segment-border);
  text-align: right;
}
body:has(.mgr-modal.active)::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(23, 58, 82, 0.35);
  z-index: 1000;
}

/* ---------- Misc ---------- */
.mgr-hidden { display: none !important; }
