/* =========================================================
   Gatekeeper-style Theme for Customer Tracker
   One-file drop-in: replace static/style.css with this file.
   Tune brand tokens below to match exact corporate values.
   ========================================================= */

/* ---------- Brand Tokens (single source of truth) ---------- */
:root {
  /* Adjust these 8 values to hard-match the corporate site */
  --brand-navy: #0C2744;          /* primary background/nav color */
  --brand-navy-900: #081A2F;      /* deeper navy for gradients */
  --brand-blue: #0A7EC2;          /* primary CTA/link color */
  --brand-blue-600: #096AA5;      /* hover/active state */
  --accent-cyan: #18B6E6;         /* optional accent for charts/badges */
  --ink: #0F172A;                 /* main text */
  --muted: #64748B;               /* secondary text */
  --surface: #FFFFFF;             /* cards/tables background */
  --surface-alt: #F5F7FA;         /* section headers / table head */
  --line: #E6EDF5;                /* hairline borders */
  --ring: rgba(10,126,194,0.35);  /* focus ring */
  --shadow: 0 6px 14px rgba(12,39,68,0.10), 0 1px 2px rgba(12,39,68,0.06);
  --radius: 10px;                 /* default corner radius */
  --radius-sm: 8px;
  --radius-lg: 12px;
}

html[data-theme="dark"] {
  --brand-navy: #161616;
  --brand-navy-900: #0f0f0f;
  --brand-blue: #f2d400;
  --brand-blue-600: #e3c400;
  --accent-cyan: #ffe05a;
  --ink: #f5f5f0;
  --muted: #c7c0a6;
  --surface: #1a1a1a;
  --surface-alt: #222222;
  --line: #303030;
  --ring: rgba(242, 212, 0, 0.28);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.34), 0 2px 8px rgba(0, 0, 0, 0.18);
}


/* ---------- Base / Reset ---------- */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: #FAFCFF;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height: 1.5;
}
html[data-theme="dark"] body {
  background: #101010;
  color: var(--ink);
}
body {
  min-height: 100vh;
}
img { max-width: 100%; height: auto; border: 0; }
a { color: var(--brand-blue); text-decoration: none; }
a:hover { color: var(--brand-blue-600); }

/* ---------- Layout: Sidebar + Content ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: 240px; background: var(--brand-navy); color: #E6F1FF;
  padding: 18px 14px; overflow-y: auto; box-shadow: var(--shadow);
}
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li + li { margin-top: 6px; }
.sidebar a {
  color: #CFE6FF; display: block;
  padding: 10px 12px; border-radius: var(--radius-sm);
}
.sidebar a:hover, .sidebar a:focus {
  background: rgba(255,255,255,0.08); color: #fff; outline: none;
}
.sidebar .active { background: rgba(255,255,255,0.14); color: #fff; }

.main-content, .content {
  margin-left: 240px; padding: 18px;
}

/* Sidebar submenu (hover-to-reveal) */
.sidebar ul li.has-submenu {
  position: relative;
}

.sidebar ul li.has-submenu > a.submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* caret indicator */
.sidebar ul li.has-submenu > a.submenu-toggle::after {
  content: "▸";
  font-size: 0.9rem;
  opacity: 0.8;
  transition: transform 120ms ease;
  margin-left: 8px;
}

/* nested list (hidden by default) */
.sidebar ul li.has-submenu > .submenu {
  display: none;
  margin: 6px 0 0 0;
  padding-left: 12px;            /* indent submenu items */
  border-left: 2px solid rgba(255,255,255,0.08);
}

.sidebar ul li.has-submenu > .submenu li a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.95rem;
  opacity: 0.95;
}

/* reveal on hover or keyboard focus */
.sidebar ul li.has-submenu:hover > .submenu,
.sidebar ul li.has-submenu:focus-within > .submenu {
  display: block;
}

.sidebar ul li.has-submenu:hover > a.submenu-toggle::after,
.sidebar ul li.has-submenu:focus-within > a.submenu-toggle::after {
  transform: rotate(90deg);
}

/* optional: slight background hover for submenu links */
.sidebar ul li.has-submenu > .submenu li a:hover {
  background: rgba(255,255,255,0.08);
}


/* === Force unified inputs sitewide (wins specificity) === */
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="tel"],
.form input[type="number"],
.form input[type="url"],
.form input[type="search"],
.form select,
.form textarea{
  width:100%;
  min-height:40px;
  padding:10px 12px;
  font:inherit;
  background:#fff !important;
  border:1px solid #d7dee6 !important;
  border-radius:8px !important;
  box-sizing:border-box;
  appearance:none;
  -webkit-appearance:none;
}

/* Focus ring */
.form input:focus,
.form select:focus,
.form textarea:focus{
  outline:none;
  border-color:#3b82f6 !important;
  box-shadow:0 0 0 3px rgba(59,130,246,.15) !important;
}

/* Toolbar search box sizing (don’t stretch to 100%) */
#search-form input[type="search"]{
  width:220px;                 /* tweak as desired */
  min-height:36px;
  border-radius:8px !important;
  padding:8px 10px;
  background:#fff !important;
  border:1px solid #d7dee6 !important;
  appearance:none;
  -webkit-appearance:none;
}
#search-form input[type="search"]:focus{
  outline:none;url_for('show_customers')
  border-color:#3b82f6 !important;
  box-shadow:0 0 0 3px rgba(59,130,246,.15) !important;
}




/* Text-like controls: size via padding + line-height */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea {
  line-height: 1.35;
  min-height: 40px;          /* comfortable touch target */
}

/* Selects are OS-native; don't force line-height */
select {
  line-height: normal;        /* avoid clipping in Firefox/Edge */
  min-height: 40px;
  padding-right: 36px;        /* room for the arrow */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20'%3E%3Cpath fill='%23677' d='M5.5 7l4.5 5 4.5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}

/* Optional: consistent focus */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}










/* Optional hero band for page titles */
.brand-hero {
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-navy-900));
  color: #fff; border-radius: var(--radius-lg);
  padding: 16px 18px; margin: 0 0 14px 0; box-shadow: var(--shadow);
}
.brand-hero h1 { margin: 0; color: #fff; }

/* ---------- Typography ---------- */
h1, h2, h3 { color: var(--ink); letter-spacing: .3px; margin: 0 0 10px; }
h1 { font-weight: 700; font-size: 28px; }
h2 { font-weight: 600; font-size: 20px; color: var(--muted); text-transform: uppercase; }
p { margin: 0 0 10px; }

/* ---------- Panels / Cards ---------- */
.panel, .card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 22px; font-weight: 700; }

/* ---------- Toolbar / Search ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin: 10px 0 14px; }

/* ---------- Buttons ---------- */


/* Icon-only button: same visual rhythm as .btn/.btn-sm */
.btn-icon {
  width: 36px;             /* matches .btn height */
  height: 36px;
  padding: 0;              /* icon centered */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.btn-icon svg,
.btn-icon img {
  width: 20px;
  height: 20px;
}

/* Screen-reader only text for accessibility */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}



/* Full-screen overlay centered modal */
.modal-overlay{
  position: fixed;
  inset: 0;                    /* top:0; right:0; bottom:0; left:0 */
  display: none;               /* toggled to flex in JS */
  align-items: center;         /* vertical center */
  justify-content: center;     /* horizontal center */
  background: rgba(17,24,39,.45); /* dim */
  z-index: 3000;               /* above sidebar/content */
  padding: 16px;               /* small gutter on narrow screens */
}
.modal{
  background: #fff;
  width: 420px;
  max-width: 96vw;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
  padding: 16px;
}
.modal-header{ margin-bottom: 8px; }
.modal-body{ display: grid; gap: 10px; }
.modal-label{ display: grid; gap: 6px; font-weight: 600; }
.modal-label input{ font-weight: 400; }
.modal-actions{ display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* Prevent background scroll when modal is open */
body.modal-open{ overflow: hidden; }





.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* accessibility: avoid clipping and meet touch target */
  min-height: 40px;                 /* was: height: 36px */
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1;                   /* prevents vertical clipping */
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease,
              border-color .15s ease, box-shadow .15s ease;
}

.btn-sm {
  min-height: 32px;                 /* was: height: 30px */
  padding: 0 10px;
  border-radius: var(--radius-sm);
}

.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-600); }

.btn-secondary { background: #E9F4FB; color: var(--brand-blue); border-color: #D6ECF8; }
.btn-secondary:hover { background: #DFF0FA; }

/* predictable hover colors; no brightness filter */
.btn-danger {
  background: #E53935;
  color: #fff;
  border-color: #E53935;
}
.btn-danger:hover {
  background: #B32624;
  border-color: #B32624;
  filter: none;
}

.btn-outline {
  background: transparent;
  color: var(--brand-blue);
  border-color: var(--brand-blue);
  border-width: 1px;
  border-style: solid;
}
.btn-outline:hover { background: rgba(10,126,194,0.08); }

/* keyboard focus */
.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}


/* Align action buttons in tables */
.table-actions {
  display: flex;
  gap: 8px;
  justify-content: center;   /* was: flex-end */
  align-items: center;
}


/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin: 10px 0 6px; color: var(--ink); }
input[type=text], input[type=email], input[type=tel], input[type=file], select, textarea {
  width: 100%; background: #fff; border: 1px solid #DEE7F0;
  border-radius: var(--radius); padding: 10px 12px; outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px var(--ring);
}
input::placeholder, textarea::placeholder { color: #94A3B8; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
thead th {
  text-align: left; font-size: 12px; color: #4B5563;
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--surface-alt);
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid #EEF2F7; vertical-align: middle; }
tbody tr:hover { background: #F8FBFE; }

/* Sort direction arrows (if you print ↑/↓ directly, keep as-is) */
th a { color: inherit; text-decoration: none; }
th a:hover { text-decoration: underline; }

/* ---------- Alerts (Flash Messages) ---------- */
.flash-messages { margin: 10px 0; }
.alert { border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; border: 1px solid transparent; }
.alert-success { background: #E8F6EE; color: #166534; border-color: #C8EAD6; }
.alert-error, .alert-danger { background: #FDECEC; color: #7F1D1D; border-color: #F4CACA; }
.alert-warning { background: #FFF6E6; color: #7A3E06; border-color: #FDE2B5; }
.alert-info { background: #E9F4FB; color: #0C4A6E; border-color: #D6ECF8; }

/* ---------- Modals (for profile pop-up) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12,39,68,0.45);
  display: none; align-items: center; justify-content: center; z-index: 999;
}
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); width: min(640px, 92vw); padding: 18px; }
.modal header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal header h3 { margin: 0; font-size: 18px; }
.modal .modal-actions { display: flex; gap: 8px; }
.modal.show + .modal-backdrop, .modal-backdrop.show { display: flex; }

/* ---------- Hosted Servers: Chart + Table (stacked) ---------- */
.chart-table-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 16px; margin-top: 12px;
}
.chart-card { height: 380px; display: block; }

/* ---------- Badges / Pills (optional) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; font-size: 12px; font-weight: 600;
  color: #0C4A6E; background: #E9F4FB; border: 1px solid #D6ECF8;
  border-radius: 999px;
}

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.m-0 { margin: 0 !important; }
.mt-8 { margin-top: 8px !important; }
.mt-12 { margin-top: 12px !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-12 { margin-bottom: 12px !important; }
.p-0 { padding: 0 !important; }

/* ---------- Print Tweaks ---------- */
@media print {
  .sidebar { display: none; }
  .content, .main-content { margin: 0; }
  .panel, .card, .kpi-card { box-shadow: none; border: 1px solid var(--line); }
}



.truncate { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }




/* condensed table cells */
thead th { padding: 8px 10px; }
tbody td { padding: 8px 10px; }





/* Header actions on Add Customer */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.page-header h1 { margin: 0; }

.page-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 640px) {
  .page-actions { width: 100%; justify-content: flex-start; }
}





/* Icon-only button for the profile column */
.profile-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  /* Hide any accidental text */
  font-size: 0;
}

/* Draw a person icon using a mask + currentColor */
.profile-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  display: block;
  background-color: currentColor; /* inherits from .btn-... color */
  -webkit-mask: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'>\
  <path fill='%23000' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 12a7 7 0 0 1-5.916-3.152c.052-1.974 4-3.048 5.916-3.048s5.864 1.074 5.916 3.048A7 7 0 0 1 12 19z'/>\
</svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'>\
  <path fill='%23000' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 12a7 7 0 0 1-5.916-3.152c.052-1.974 4-3.048 5.916-3.048s5.864 1.074 5.916 3.048A7 7 0 0 1 12 19z'/>\
</svg>") no-repeat center / contain;
}





.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.cap-card {
  background: #fff;
  border: 1px solid var(--border-200, #E5E7EB);
  border-radius: var(--radius, 10px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cap-title {
  font-weight: 600;
  margin-bottom: 8px;
}
.cap-legend {
  margin-top: 8px;
  font-size: 14px;
}
.cap-over {
  color: #E53935;
  font-weight: 600;
  margin-left: 6px;
}
.muted { color: var(--muted-600, #6B7280); font-size: 14px; }



/* ===== Layout fixes: fixed sidebar + fixed topbar ===== */
:root{
  --sidebar-w: 240px;
  --topbar-h: 56px;
}

/* keep your existing sidebar styles; these lines make intent explicit */
.sidebar{ position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); }

/* fixed top bar that does NOT cover the sidebar */
.topbar{
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--brand-navy);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 1000;
}

/* push main content below the topbar and to the right of the sidebar */
.content,
.main-content{
  margin-left: var(--sidebar-w);
  padding: 18px;
  padding-top: calc(var(--topbar-h) + 12px);
  min-height: calc(100vh - var(--topbar-h));
  background: transparent;
}

.layout{
  min-height: 100vh;
  background: transparent;
}

/* topbar layout: title left, actions right */
.topbar { justify-content: space-between; }

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.theme-picker{
  display:flex;
  align-items:center;
  gap:8px;
}

.theme-picker-text{
  font-size:12px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:#e2ebf7;
}

.theme-picker-select{
  min-width:96px;
  height:32px;
  padding:0 30px 0 10px;
  border:1px solid rgba(255,255,255,0.18);
  border-radius:8px;
  background-color:rgba(255,255,255,0.08);
  color:#fff;
  font-size:13px;
  font-weight:600;
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20'%3E%3Cpath fill='%23ffffff' d='M5.5 7l4.5 5 4.5-5z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 10px center;
  background-size:12px;
}

.theme-picker-select:focus{
  outline:none;
  box-shadow:0 0 0 3px rgba(255,255,255,0.15);
}

.theme-picker-select option{
  color:#0f172a;
}

html[data-theme="dark"] .theme-picker-text{
  color:#f0e3a2;
}

html[data-theme="dark"] .theme-picker-select{
  background-color:#232323;
  color:#f5f5f0;
  border-color:#3a3a3a;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20'%3E%3Cpath fill='%23f2d400' d='M5.5 7l4.5 5 4.5-5z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .theme-picker-select option{
  background:#1a1a1a;
  color:#f5f5f0;
}

.account-menu{ position:relative; }

.account-dropdown{
  position:absolute;
  right:0;
  top:calc(100% + 6px);
  min-width:180px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  box-shadow:var(--shadow);
  padding:6px;
  display:none;
  z-index:1100;
}

.account-menu.open .account-dropdown{
  display:block;
}

.account-dropdown .dropdown-item{
  width:100%;
  text-align:left;
  border:0;
  background:transparent;
  padding:8px 10px;
  border-radius:6px;
  color:var(--ink);
  cursor:pointer;
  font-weight:600;
}

.account-dropdown .dropdown-item:hover{
  background: rgba(10,126,194,0.08);
}

/* green button */
.btn-success {
  background: #16a34a;   /* green-600 */
  color: #fff;
  border-color: #16a34a;
}
.btn-success:hover {
  background: #15803d;   /* green-700 */
  border-color: #15803d;
}


/* ---- Service-plan tiles with prices ---- */
.plan-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
}
.plan-tile{ display:block; cursor:pointer; }
.plan-tile input{ display:none; }
.plan-body{
  background:#fff;
  border:1px solid #d7dee6;
  border-radius:var(--radius,10px);
  padding:14px;
  min-height:150px;
  box-shadow:var(--shadow,0 6px 14px rgba(12,39,68,.08));
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.plan-title{ font-weight:700; margin:0 0 6px; color:var(--ink,#0F172A); }
.plan-meta{ font-size:13px; color:var(--muted,#64748B); }
.plan-price{
  font-size:28px;
  font-weight:800;
  letter-spacing:.3px;
  margin-top:10px;
  color:var(--ink,#0F172A);
}
.plan-tile input:checked + .plan-body{
  border-color:var(--brand-blue,#0A7EC2);
  box-shadow:0 0 0 3px var(--ring,rgba(10,126,194,.25));
}



/* ---- Toast messages ---- */
.toast {
  position: fixed; top: 16px; right: 16px; z-index: 4000;
  min-width: 280px; max-width: 420px;
  padding: 12px 14px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  color: #0F172A; background: #fff; border: 1px solid #E6EDF5;
  opacity: 0; transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: #C8EAD6; background: #E8F6EE; color: #166534; }
.toast-error   { border-color: #F4CACA; background: #FDECEC; color: #7F1D1D; }
.toast-close { float:right; cursor:pointer; font-weight:700; margin-left:8px; }

/* ---- Modal popup ---- */
.modal-overlay{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(17,24,39,.45);z-index:4000;padding:16px}
.modal{background:#fff;border:1px solid #E6EDF5;border-radius:12px;box-shadow:0 20px 40px rgba(0,0,0,.25);width:min(520px,95vw);padding:16px}

html[data-theme="dark"] .content,
html[data-theme="dark"] .main-content{
  background: #101010;
}

html[data-theme="dark"] .layout,
html[data-theme="dark"]{
  background: #101010;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .account-dropdown,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .alert,
html[data-theme="dark"] .flash-messages .alert,
html[data-theme="dark"] .dd-card,
html[data-theme="dark"] .dougs-card {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .account-dropdown .dropdown-item{
  color: var(--ink);
}

html[data-theme="dark"] .account-dropdown .dropdown-item:hover{
  background: rgba(242,212,0,0.12);
}

html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] thead,
html[data-theme="dark"] tbody,
html[data-theme="dark"] tr {
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] table {
  background: var(--surface);
}

html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .hist-row:hover {
  background: rgba(242, 212, 0, 0.08);
}

html[data-theme="dark"] thead,
html[data-theme="dark"] th {
  background: var(--surface-alt);
  color: #f2d400;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .form input,
html[data-theme="dark"] .form select,
html[data-theme="dark"] .form textarea {
  background: var(--surface-alt) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .btn.btn-secondary,
html[data-theme="dark"] .btn-secondary {
  background: #242424;
  color: var(--ink);
  border-color: #3a3a3a;
}

html[data-theme="dark"] .btn.btn-primary,
html[data-theme="dark"] .btn-primary {
  background: #f2d400;
  color: #171717;
  border-color: #f2d400;
}

html[data-theme="dark"] .btn.btn-primary:hover,
html[data-theme="dark"] .btn-primary:hover {
  background: #e3c400;
  border-color: #e3c400;
}

html[data-theme="dark"] .sidebar a:hover,
html[data-theme="dark"] .sidebar a:focus,
html[data-theme="dark"] .sidebar .active {
  background: rgba(255,255,255,0.14);
}

html[data-theme="dark"] .dougs-note,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .sub,
html[data-theme="dark"] .label {
  color: var(--muted) !important;
}

.modal h3{margin:0 0 8px 0}
.modal.success{border-color:#C8EAD6;background:#E8F6EE;color:#166534}
.modal.error{border-color:#F4CACA;background:#FDECEC;color:#7F1D1D}
.modal-actions{display:flex;justify-content:flex-end;margin-top:12px;gap:8px}


/* header row */
.brand-hero.hero-row{display:flex;align-items:center;justify-content:space-between}

/* order-tracker */
.tracker{display:grid;gap:10px}
.tracker-h{display:flex;flex-direction:column;gap:4px;margin-bottom:6px}
.steps{display:grid;gap:8px}
.step { display:flex; gap:10px; align-items:flex-start; padding:6px 0; }
.step-name{ font-weight:600; }
.step-msg{ color:#7F1D1D; margin-top:2px; }

/* status badges */
.badge{ display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:50%; border:1px solid transparent; font-weight:700; }
.badge.ok{ background:#E8F6EE; color:#166534; border-color:#C8EAD6; }
.badge.fail{ background:#FDECEC; color:#7F1D1D; border-color:#F4CACA; }
.badge.pending{ background:#E9F4FB; color:#0C4A6E; border-color:#D6ECF8; }
.badge.na{ background:#F3F4F6; color:#4B5563; border-color:#E5E7EB; }


.pill{display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;border:1px solid transparent}
.pill-ok{background:#E8F6EE;color:#166534;border-color:#C8EAD6}
.pill-fail{background:#FDECEC;color:#7F1D1D;border-color:#F4CACA}
.pill-pending{background:#E9F4FB;color:#0C4A6E;border-color:#D6ECF8}

.hist-list { display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.hist-row { display:grid; grid-template-columns: 1fr auto auto; gap:10px; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:#fff; cursor:pointer; }
.hist-row:hover { background:#F8FBFE; }

/* force SIM header to be a row */
.brand-hero.hero-row{s
  display:flex !important;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.brand-hero.hero-row h1{ margin:0; }

/* ---------- Mobile / Responsive ---------- */
.sidebar-toggle{
  display:none;
  border:1px solid rgba(255,255,255,0.2);
  background:#fff;
  padding:6px 8px;
  border-radius:8px;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:3px;
}

.mobile-menu-row{
  display:none;
}

.sidebar-toggle-bar{
  display:block;
  width:18px;
  height:2px;
  background:#0C2744;
  margin:0;
  border-radius:2px;
}

.sidebar-backdrop{
  display:none;
}

.has-submenu.open > .submenu{
  display:block;
}

.has-submenu.open > a.submenu-toggle::after{
  transform: rotate(90deg);
}

/* Animated submenu overrides (slow expand/collapse) */
.sidebar ul li.has-submenu > .submenu{
  display:block;
  max-height:0;
  opacity:0;
  overflow:hidden;
  transition: max-height 720ms ease, opacity 720ms ease;
  will-change: max-height, opacity;
}

.sidebar ul li.has-submenu:hover > .submenu,
.sidebar ul li.has-submenu:focus-within > .submenu,
.has-submenu.open > .submenu{
  max-height:480px;
  opacity:1;
}

.sidebar ul li.has-submenu > a.submenu-toggle::after{
  transition: transform 660ms ease;
}

@media (max-width: 900px) {
  :root{
    --sidebar-w: 260px;
  }

  .sidebar{
    width: min(260px, 70vw);
    transform: translateX(-100%);
    transition: transform 180ms ease;
    z-index: 2000;
  }

  body.sidebar-open .sidebar{
    transform: translateX(0);
  }

  body.sidebar-open{
    overflow: hidden;
  }

  .sidebar-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.4);
    z-index: 1500;
    display: none;
  }

  body.sidebar-open .sidebar-backdrop{
    display: block;
  }

  .topbar{
    left: 0;
    gap: 10px;
  }

  .sidebar-toggle{
    display:inline-flex;
    border-color:#d7dee6;
  }

  .mobile-menu-row{
    display:flex;
    justify-content:flex-start;
    margin-bottom:10px;
  }

  .content,
  .main-content{
    margin-left: 0;
    padding-left: 14px;
    padding-right: 14px;
  }

  .toolbar{
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .toolbar form{
    flex: 1 1 220px;
  }

  .table-actions{
    flex-wrap: wrap;
  }

  table{
    display:block;
    overflow-x:auto;
    white-space: nowrap;
  }

  .modal{
    width: min(520px, 96vw);
  }

  h1{
    font-size: 22px;
  }
}

@media (max-width: 640px) {
  .topbar{
    padding: 0 12px;
  }

  .sidebar{
    width: min(240px, 72vw);
  }

  .toolbar .btn,
  .page-actions .btn{
    width: 100%;
  }

  .panel,
  .card{
    padding: 14px;
  }
}
