:root {
  --bg: #181a20;
  --card: #222630;
  --card2: #2b3139;
  --border: #2f3541;
  --text: #eaecef;
  --muted: #848e9c;
  --yellow: #fcd535;
  --red: #f6465d;
  --green: #0ecb81;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; margin: 8px 0 0; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card label { display: block; margin: 18px 0 6px; color: var(--muted); font-size: 13px; }

input, select, textarea {
  width: 100%; background: var(--card2); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; font: inherit; outline: none;
}
input:focus, select:focus { border-color: var(--yellow); }
input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--yellow); }

.btn { border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--yellow); color: #181a20; }
.btn.primary:disabled { opacity: 0.4; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--border); padding: 6px 10px; }
.btn.small { padding: 7px 12px; }
.login-card .btn { width: 100%; margin-top: 18px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.brand .muted { font-weight: 500; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--yellow); display: inline-block; }

.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 14px 18px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--yellow); }

.content { max-width: 960px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 24px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 10px; }

.section { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.section h3 { margin: 0; font-size: 17px; }
.section .hint { margin: 4px 0 16px; color: var(--muted); font-size: 13px; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.field.bool { display: flex; align-items: center; gap: 10px; padding-top: 22px; }
.field.bool label { margin: 0; color: var(--text); font-size: 15px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 0 8px 8px 0; }
td { padding: 4px 8px 4px 0; vertical-align: middle; }
td.check { width: 70px; }
td.act { width: 56px; text-align: right; }
.empty { color: var(--muted); padding: 10px 0; }
.add { margin-top: 12px; }

.preview { margin-top: 8px; color: var(--muted); }
.preview summary { cursor: pointer; padding: 8px 0; }
.preview pre { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; overflow: auto; color: var(--text); font-size: 12px; max-height: 360px; }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--card2); border: 1px solid var(--border); border-left: 4px solid var(--green); padding: 12px 16px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); }
.toast.bad { border-left-color: var(--red); }

@media (max-width: 640px) {
  .topbar, .tabs, .content { padding-left: 14px; padding-right: 14px; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 17px; font-weight: 700; margin-top: 4px; word-break: break-word; }
.stat-value.up { color: var(--green); }
.stat-value.down { color: var(--red); }
.seg { display: inline-flex; background: var(--card2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg-btn { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 7px; cursor: pointer; }
.seg-btn.on { background: var(--yellow); color: #181a20; }
.preview-line { margin-top: 14px; padding: 10px 12px; background: var(--card2); border-radius: 8px; color: var(--text); font-size: 14px; }
.field.gap { margin-top: 14px; }

.acct { display: flex; align-items: center; gap: 8px; }
.acct select { width: auto; max-width: 260px; padding: 6px 10px; }
.tab.locked { opacity: 0.45; cursor: not-allowed; }
.lock { margin-bottom: 14px; padding: 8px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 13px; }
table.wide { min-width: 820px; }
td.acts { white-space: nowrap; text-align: right; }
td.acts .btn { margin-left: 6px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.badge.active { background: rgba(14, 203, 129, 0.15); color: var(--green); }
.badge.pending { background: rgba(252, 213, 53, 0.15); color: var(--yellow); }
.badge.disabled { background: rgba(246, 70, 93, 0.15); color: var(--red); }

.fields.gap { margin-top: 14px; }
.help.wide { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin-top: -6px; }

.pw-row { display: flex; gap: 8px; align-items: center; }
.pw-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.3px; }
.pw-row .btn { white-space: nowrap; }
td.warn { color: var(--yellow); }
table.wide { min-width: 980px; }
.section.notice { border-color: var(--yellow); }
.login-details { background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 0; font: 14px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; user-select: all; overflow-x: auto; }

.fg-controls { margin-top: 14px; }
.fg-controls.off { opacity: 0.45; }
.fg-range { padding: 0; height: 28px; accent-color: var(--yellow); background: transparent; border: 0; cursor: pointer; }
.fg-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 2px; }
.fg-preview { margin-top: 18px; padding: 14px 16px; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; text-align: center; }
.fg-preview-title { color: var(--muted); font-size: 12px; text-align: left; }
.fg-value { font-size: 34px; font-weight: 700; margin-top: 4px; }
.fg-label { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.fg-bar { position: relative; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #f6465d 0%, #f07a3c 25%, #fcd535 50%, #8fd46f 75%, #0ecb81 100%); }
.fg-pointer { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--text); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--border); transition: left 0.08s linear; }
.is-off .fg-preview { opacity: 0.55; }

/* The PIN box: focusable (so the phone keyboard opens) but shows nothing at all, not even dots. */
.pin-ghost { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; outline: 0; opacity: 0; pointer-events: none; color: transparent; caret-color: transparent; background: transparent; font-size: 16px; }

/* display size slider */
.field input[type='range'] { width: 100%; accent-color: var(--yellow); }
.range-val { color: var(--yellow); font-weight: 700; }
.range-ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; padding: 4px 6px 0; }
