/*
 * Metroniq Admin — Shared Theme
 * Applied to all admin/dashboard pages
 * Light theme with Metroniq watermark
 */

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

:root {
  color-scheme: light;

  /* Colours */
  --bg:        #e8f5ee;
  --surf:      rgba(255,255,255,0.82);
  --surf2:     rgba(248,249,251,0.75);
  --surf3:     #f0f2f6;
  --border:    #e2e6ed;
  --border2:   #d0d5de;
  --accent:    #1655a2;
  --accent2:   #2db86a;
  --text:      #1a2035;
  --muted:     #64748b;
  --head:      #0e1a2e;
  --ok:        #166534;
  --ok-bg:     #dcfce7;
  --warn:      #92400e;
  --warn-bg:   #fef3c7;
  --err:       #991b1b;
  --err-bg:    #fee2e2;
  --info:      #1e40af;
  --info-bg:   #dbeafe;

  /* Typography */
  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --mono:      'JetBrains Mono', 'Courier New', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.05);
}

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

/* ── WATERMARK ── */
body {
  font-family: var(--font);
  background-color: #e2f2e8;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
  background-image: url('/admin/theme-watermark');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 75% auto;
  background-attachment: fixed;
}

/* ── TOPBAR / NAV ── */
.m-nav {
  background: rgba(14,53,45,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.m-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
  text-decoration: none;
}
.m-nav-brand img {
  height: 28px;
  width: auto;
}
.m-nav-brand span {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -.02em;
}
.m-nav-brand span em {
  color: var(--accent2);
  font-style: normal;
}

.m-nav-sep { width: 1px; height: 18px; background: rgba(255,255,255,.2); margin: 0 8px; }
.m-nav-spacer { flex: 1; }

.m-nav a {
  display: inline-flex !important;
  align-items: center !important;
  padding: 5px 11px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: rgba(255,255,255,.65) !important;
  text-decoration: none !important;
  transition: background .12s, color .12s;
  white-space: nowrap !important;
  border: none !important;
  background: none !important;
}
.m-nav a:hover { background: rgba(255,255,255,.12) !important; color: #ffffff !important; }
.m-nav a.active { background: rgba(45,184,106,.25) !important; color: #7af0a8 !important; font-weight: 700 !important; }
.m-nav a.logout { color: #ff8a8a !important; }
.m-nav a.logout:hover { background: rgba(255,100,100,.15) !important; color: #ffaaaa !important; }

/* ── CARDS ── */
.m-card {
  background: rgba(255,255,255,0.65);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  backdrop-filter: blur(2px);
}
.m-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surf2);
}
.m-card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--head);
  flex: 1;
}
.m-card-body { padding: 16px; }

/* ── BADGES ── */
.m-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
}
.m-badge-ok   { background: var(--ok-bg);   color: var(--ok); }
.m-badge-warn { background: var(--warn-bg);  color: var(--warn); }
.m-badge-err  { background: var(--err-bg);   color: var(--err); }
.m-badge-info { background: var(--info-bg);  color: var(--info); }
.m-badge-mut  { background: var(--surf3);    color: var(--muted); }

/* ── BUTTONS ── */
.m-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: var(--surf);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}
.m-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--info-bg); }
.m-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-btn-primary:hover { background: #1245880; border-color: #124588; color: #fff; }
.m-btn-ok { background: var(--ok-bg); border-color: #86efac; color: var(--ok); }
.m-btn-danger { background: var(--err-bg); border-color: #fca5a5; color: var(--err); }
.m-btn-warn { background: var(--warn-bg); border-color: #fcd34d; color: var(--warn); }
.m-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── FORM ELEMENTS ── */
.m-input, .m-select {
  border: 1px solid var(--border2);
  background: var(--surf);
  border-radius: 7px;
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  transition: border-color .12s;
}
.m-input:focus, .m-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,85,162,.1); }
.m-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 4px; }

/* ── TABLE ── */
.m-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.m-table th { color: var(--muted); text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.m-table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.m-table tr:last-child td { border: none; }
.m-table tr:hover td { background: var(--surf2); }

/* ── STATUS INDICATORS ── */
.m-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.m-dot-ok   { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.5); }
.m-dot-warn { background: #f59e0b; }
.m-dot-err  { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.5); }
.m-dot-off  { background: var(--border2); }

/* ── CHECK ROWS (debug/health style) ── */
.m-check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.m-check:last-child { border: none; }
.m-check-icon { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; font-size: 10px; font-weight: 900; }
.m-icon-ok   { background: var(--ok-bg);   color: var(--ok); }
.m-icon-err  { background: var(--err-bg);   color: var(--err); }
.m-icon-warn { background: var(--warn-bg);  color: var(--warn); }
.m-icon-info { background: var(--info-bg);  color: var(--info); }
.m-check-content { flex: 1; min-width: 0; }
.m-check-label { color: var(--text); font-size: 13px; }
.m-check-detail { color: var(--muted); font-size: 11px; margin-top: 2px; word-break: break-all; }
.m-check-detail code { background: var(--surf3); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 11px; color: var(--accent); border: 1px solid var(--border); }
.m-check-fix { font-size: 11px; color: var(--warn); margin-top: 4px; padding: 4px 8px; background: var(--warn-bg); border-left: 3px solid #f59e0b; border-radius: 0 4px 4px 0; }

/* ── STAT GRID ── */
.m-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.m-stat { background: var(--surf); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.m-stat-label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.m-stat-value { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--head); margin-top: 4px; line-height: 1; }
.m-stat-value.ok   { color: var(--ok); }
.m-stat-value.warn { color: #b45309; }
.m-stat-value.err  { color: var(--err); }
.m-stat-unit { font-size: 11px; font-weight: 400; color: var(--muted); }
.m-stat-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* ── TOOLBAR ── */
.m-toolbar {
  background: var(--surf);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.m-toolbar-sep { width: 1px; height: 20px; background: var(--border2); }
.m-toolbar-label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ── SUMMARY BAR ── */
.m-sumbar {
  background: var(--surf);
  border-bottom: 1px solid var(--border);
  padding: 6px 20px;
  display: flex;
  gap: 20px;
  overflow-x: auto;
  font-size: 12px;
}
.m-sum-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.m-sum-val { font-family: var(--mono); font-weight: 700; color: var(--head); }
.m-sum-lbl { color: var(--muted); }

/* ── TABS ── */
.m-tabs { background: var(--surf); border-bottom: 1px solid var(--border); padding: 0 20px; display: flex; gap: 0; }
.m-tab { padding: 11px 16px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; white-space: nowrap; }
.m-tab:hover { color: var(--text); }
.m-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.m-tab-badge { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; font-size: 9px; font-weight: 700; margin-left: 5px; background: var(--err-bg); color: var(--err); vertical-align: middle; }

/* ── PAGE LAYOUT ── */
.m-page { padding: 16px 20px; display: grid; gap: 14px; }
.m-page-1 { grid-template-columns: 1fr; }
.m-page-2 { grid-template-columns: 1fr 1fr; }
.m-page-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 1100px) { .m-page-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .m-page-2, .m-page-3 { grid-template-columns: 1fr; } }
.m-span2 { grid-column: span 2; }
.m-spanall { grid-column: 1 / -1; }

/* ── UPLINK LOG ── */
.m-log { max-height: 280px; overflow-y: auto; }
.m-log::-webkit-scrollbar { width: 4px; }
.m-log::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── CODE / MONO ── */
code, .mono { font-family: var(--mono); font-size: 11px; background: var(--surf3); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }

/* ── ALERT BANNER ── */
.m-banner { display: none; padding: 8px 20px; font-size: 12px; font-weight: 600; align-items: center; gap: 10px; }
.m-banner.visible { display: flex; }
.m-banner-err  { background: var(--err-bg);  border-bottom: 1px solid #fca5a5; color: var(--err); }
.m-banner-warn { background: var(--warn-bg); border-bottom: 1px solid #fcd34d; color: var(--warn); }

/* ── SIGNAL BAR ── */
.m-sigbar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 5px; }
.m-sigfill { height: 100%; border-radius: 3px; transition: width .4s; }

/* ── TOAST ── */
#m-toast { position: fixed; bottom: 20px; right: 20px; background: var(--head); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 12px; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 999; box-shadow: var(--shadow); }
#m-toast.visible { opacity: 1; }
#m-toast.err { background: var(--err); }

/* ── SCROLLBAR (global) ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
