:root {
  --bg-main: #0b0c12;
  --bg-card: #141724;
  --bg-card-hover: #1a1e30;
  --bg-input: #0d0f18;
  --border: #262a40;
  --accent: #7b2cbf;
  --accent-light: #a855f7;
  --teal: #2ec4b6;
  --amber: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-lg: 14px;
  --radius-md: 9px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; }
body { background: var(--bg-main); color: var(--text-primary); min-height: 100vh; padding: 16px 22px 40px; }
code { background: #1e2235; padding: 2px 6px; border-radius: 5px; font-size: 12px; color: #93c5fd; }
.hidden { display: none !important; }
.mt-10 { margin-top: 10px; }
.mt-16 { margin-top: 16px; }
.container { max-width: 1540px; margin: 0 auto; }

.login-wrap { min-height: 88vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 400px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }

.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 42px; height: 42px; border-radius: 11px; background: linear-gradient(135deg, #7b2cbf 0%, #2563eb 100%); display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 6px 20px rgba(123, 44, 191, 0.35); }
.brand h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.brand p, .subtext { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.health-pill { background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; font-size: 12px; display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.dot.ok { background: var(--teal); box-shadow: 0 0 8px rgba(46, 196, 182, 0.7); }
.dot.warn { background: var(--amber); box-shadow: 0 0 8px rgba(245, 158, 11, 0.7); }

button, .btn { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); padding: 8px 14px; border-radius: var(--radius-md); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all 0.15s ease; display: inline-flex; align-items: center; gap: 6px; }
button:hover { background: var(--bg-card-hover); border-color: #3b4264; }
.btn-primary { background: linear-gradient(135deg, #7b2cbf 0%, #4f46e5 100%); border-color: transparent; }
.btn-teal { background: rgba(46, 196, 182, 0.14); border-color: rgba(46, 196, 182, 0.45); color: #5eead4; }
.btn-amber { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.45); color: #fcd34d; }
.btn-danger { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: 7px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.stat-label { font-size: 11.5px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-val { font-size: 22px; font-weight: 800; margin-top: 6px; }
.stat-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 10px; flex-wrap: wrap; }
.tab { background: transparent; border-color: transparent; color: var(--text-secondary); }
.tab.active { background: rgba(123, 44, 191, 0.22); border-color: rgba(168, 85, 247, 0.45); color: #e9d5ff; }

.tab-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.inline-form { display: flex; gap: 8px; align-items: center; }

input, select { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 11px; font-size: 13px; width: 100%; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent-light); cursor: pointer; }
.cfg-num { width: 92px; padding: 6px 8px; font-size: 12.5px; }
.inline-form input { width: 240px; }
.field { margin-bottom: 11px; }
.field label { display: block; font-size: 11.5px; color: var(--text-secondary); margin-bottom: 5px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 10px 9px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-secondary); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-ok { background: rgba(46, 196, 182, 0.16); color: #5eead4; }
.badge-warn { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.badge-err { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.badge-muted { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.badge-info { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }

.pill-list { display: flex; flex-wrap: wrap; gap: 5px; max-width: 280px; }
.attr-pill { background: #1c2135; border: 1px solid #2e3554; border-radius: 6px; padding: 2px 7px; font-size: 11px; color: #cbd5e1; white-space: nowrap; }
.attr-pill strong { color: var(--teal); }

.share-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 14px; }
.share-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12.5px; }
.share-bar { display: flex; height: 11px; border-radius: 999px; overflow: hidden; background: #1e2235; gap: 1px; }
.share-seg { height: 100%; transition: width 0.25s ease; }
.share-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11.5px; color: var(--text-secondary); }
.share-item { display: inline-flex; align-items: center; gap: 6px; }
.share-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.bar-wrap { width: 130px; height: 7px; background: #1e2235; border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--info)); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.info-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; font-size: 12.5px; }
.info-box h3 { font-size: 13.5px; color: #e2e8f0; border-bottom: 1px solid var(--border); padding-bottom: 7px; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-card { width: 100%; max-width: 660px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.error-msg { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.45); color: #fca5a5; padding: 8px 10px; border-radius: 8px; font-size: 12px; margin-top: 8px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #1e293b; border: 1px solid var(--border); color: var(--text-primary); padding: 10px 16px; border-radius: 10px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0,0,0,0.45); z-index: 90; }
