:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: rgba(15, 30, 49, .78);
  --surface-strong: #12243a;
  --line: rgba(148, 174, 199, .16);
  --text: #f4f8fb;
  --muted: #91a6ba;
  --accent: #26d0b4;
  --accent-2: #2e83ff;
  --danger: #ff6b7b;
  --warning: #f4bd58;
  --radius: 20px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% -10%, #123254 0, transparent 32%), var(--bg); color: var(--text); font-family: Tahoma, Arial, sans-serif; line-height: 1.6; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(38, 208, 180, .55); outline-offset: 3px; }
.skip-link { position: fixed; top: -80px; right: 1rem; z-index: 100; padding: .65rem 1rem; border-radius: 10px; background: var(--accent); color: #05241e; font-weight: 800; }
.skip-link:focus { top: 1rem; }
.ambient { position: fixed; z-index: -1; width: 32rem; height: 32rem; border-radius: 50%; filter: blur(110px); opacity: .11; pointer-events: none; }
.ambient-one { top: 12%; right: -18rem; background: var(--accent); }
.ambient-two { bottom: -18rem; left: -12rem; background: var(--accent-2); }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 74px; padding: 0 max(1.25rem, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 2rem; border-bottom: 1px solid var(--line); background: rgba(7, 17, 31, .82); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: .7rem; direction: ltr; font-size: 1.02rem; font-weight: 700; letter-spacing: -.02em; }
.brand b { color: var(--accent); }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(135deg, var(--accent), #3ce4ca); color: #06231f; box-shadow: 0 8px 25px rgba(38, 208, 180, .25); font-weight: 900; }
.topbar nav { display: flex; align-items: center; gap: .3rem; }
.topbar nav > a, .link-button { padding: .5rem .8rem; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; transition: color .2s ease, background .2s ease; }
.topbar nav > a:hover, .link-button:hover, .topbar nav > a.active { color: var(--text); background: rgba(255,255,255,.06); }
.topbar form { margin: 0; }
.shell { width: min(1180px, calc(100% - 2.5rem)); margin: 0 auto; padding: 3rem 0 5rem; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.hero h1 { max-width: 720px; margin: .25rem 0 .3rem; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.18; letter-spacing: -.055em; }
.eyebrow { margin: 0; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .06em; }
.muted { margin: 0; color: var(--muted); }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-left: .5rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(38,208,180,.1); }
.hero-actions { display: flex; align-items: center; gap: .7rem; flex-shrink: 0; }
.hero-actions form { margin: 0; }
.primary, .secondary { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 12px; padding: .72rem 1.15rem; font-weight: 800; cursor: pointer; transition: transform .2s ease, opacity .2s ease, border-color .2s ease; }
.primary { background: linear-gradient(135deg, var(--accent), #39e0c4); color: #06231f; box-shadow: 0 12px 28px rgba(38,208,180,.15); }
.secondary { background: rgba(255,255,255,.04); color: var(--text); border-color: var(--line); }
.primary:hover, .secondary:hover { transform: translateY(-1px); }
.primary:disabled, .secondary:disabled { opacity: .65; cursor: wait; transform: none; }
.compact { min-height: 42px; padding: .55rem 1rem; font-size: .9rem; }
.system-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(13, 27, 45, .62); overflow: hidden; }
.system-strip > div { display: flex; align-items: center; gap: .75rem; min-width: 0; padding: .9rem 1rem; border-left: 1px solid var(--line); }
.system-strip > div:last-child { border-left: 0; }
.system-strip span span { min-width: 0; display: block; }
.system-strip small, .system-strip b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.system-strip small { color: var(--muted); font-size: .7rem; }
.system-strip b { font-size: .82rem; }
.status-indicator { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.status-indicator.on { background: var(--accent); box-shadow: 0 0 0 5px rgba(38,208,180,.08); }
.status-indicator.error { background: var(--danger); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.metric, .panel { position: relative; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(18,36,58,.9), rgba(10,23,39,.82)); box-shadow: var(--shadow); }
.metric { min-height: 150px; padding: 1.15rem; border-radius: 17px; overflow: hidden; }
.metric.accent::before { content: ''; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.metric > span, .metric small { display: block; color: var(--muted); font-size: .78rem; }
.metric strong { display: block; margin: .4rem 0 .05rem; font-size: 2.2rem; line-height: 1.15; letter-spacing: -.04em; }
.metric .status-text { color: var(--muted); font-size: 1.75rem; }
.metric .status-text.enabled { color: var(--accent); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 1rem; }
.panel { border-radius: var(--radius); overflow: hidden; }
.panel-head { min-height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
.panel h2, .form-panel h2 { margin: .1rem 0 0; font-size: 1.15rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; }
th, td { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: .7rem; font-weight: 700; }
td { font-size: .82rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.address { display: block; max-width: 160px; overflow: hidden; color: var(--muted); direction: ltr; text-align: right; text-overflow: ellipsis; }
.symbol { display: inline-block; border-radius: 8px; padding: .25rem .5rem; background: rgba(38,208,180,.08); color: var(--accent); direction: ltr; font-weight: 800; }
.empty { padding: 2rem; color: var(--muted); text-align: center; }
.report-list { padding: .6rem; }
.report-list a { display: grid; grid-template-columns: 42px 1fr 20px; align-items: center; gap: .75rem; padding: .7rem; border-radius: 12px; transition: background .2s ease; }
.report-list a:hover { background: rgba(255,255,255,.04); }
.report-list b, .report-list small { display: block; }
.report-list b { font-size: .82rem; }
.report-list small { max-width: 180px; overflow: hidden; color: var(--muted); font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.report-list i { color: var(--accent); font-style: normal; }
.file-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,107,123,.1); color: #ff8b98; font-size: .65rem; font-weight: 900; }
.settings-form { display: grid; gap: 1rem; }
.form-panel { padding: 1.35rem; }
.section-title { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: .8rem; margin-bottom: 1.25rem; }
.section-title > span { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--accent); font-size: .72rem; font-weight: 900; }
.section-title p { margin: 0; color: var(--muted); font-size: .78rem; }
.form-grid { display: grid; gap: 1rem; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
label { display: grid; gap: .4rem; color: #dbe6ef; font-size: .8rem; font-weight: 700; }
label small { color: var(--muted); font-size: .67rem; font-weight: 400; }
input, select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; padding: .65rem .8rem; background: rgba(4,14,26,.65); color: var(--text); transition: border-color .2s ease, background .2s ease; }
input:hover, select:hover { border-color: rgba(148,174,199,.3); }
input:focus, select:focus { border-color: var(--accent); background: rgba(4,14,26,.9); outline: 0; box-shadow: 0 0 0 3px rgba(38,208,180,.08); }
input::placeholder { color: #60778d; }
.switch { display: flex; align-items: center; gap: .55rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { position: relative; width: 43px; height: 24px; border: 1px solid var(--line); border-radius: 99px; background: #26384b; transition: background .2s ease; }
.switch span::after { content: ''; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: #92a5b7; transition: transform .2s ease, background .2s ease; }
.switch input:checked + span { background: rgba(38,208,180,.25); border-color: rgba(38,208,180,.5); }
.switch input:checked + span::after { transform: translateX(-19px); background: var(--accent); }
.switch input:focus-visible + span { outline: 3px solid rgba(38,208,180,.45); outline-offset: 3px; }
.switch b { font-size: .75rem; }
.disabled-fields { opacity: .42; }
.disabled-fields input { pointer-events: none; }
.guide { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .85rem; color: var(--muted); font-size: .78rem; }
.guide summary { color: #c8d5e0; cursor: pointer; font-weight: 700; }
.guide ol { margin-bottom: 0; padding-right: 1.2rem; }
.guide code { color: var(--accent); }
.save-bar { position: sticky; bottom: 1rem; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 15px; background: rgba(11,24,40,.9); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.save-bar b, .save-bar small { display: block; }
.save-bar small { color: var(--muted); font-size: .7rem; }
.alert { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: .8rem 1rem; border: 1px solid; border-radius: 12px; font-size: .82rem; }
.alert.success { border-color: rgba(38,208,180,.3); background: rgba(38,208,180,.08); color: #8af0df; }
.alert.error { border-color: rgba(255,107,123,.3); background: rgba(255,107,123,.08); color: #ffadb6; }
.alert button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1.2rem; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding-block: 2rem; }
.login-card { width: min(430px, 100%); padding: 2rem; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, rgba(18,36,58,.92), rgba(8,20,35,.9)); box-shadow: var(--shadow); }
.login-brand { margin-bottom: 2.5rem; }
.login-card h1 { margin: .3rem 0; font-size: 2rem; }
.form-stack { display: grid; gap: 1rem; margin-top: 1.5rem; }
.form-stack .primary { margin-top: .25rem; }
.security-note { margin: 1.25rem 0 0; color: var(--muted); font-size: .7rem; text-align: center; }
.security-note span { color: var(--accent); }
.error-card { width: min(560px, 100%); margin: 8vh auto; padding: 3rem; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); text-align: center; }
.error-card > span { color: var(--accent); font-size: 4rem; font-weight: 900; }
.error-card h1 { margin: 0 0 .5rem; }
.error-card .primary { margin-top: 1.5rem; }

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .system-strip { grid-template-columns: 1fr; }
  .system-strip > div { border-left: 0; border-bottom: 1px solid var(--line); }
  .system-strip > div:last-child { border-bottom: 0; }
  .form-grid.three { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .topbar { min-height: 64px; padding: .6rem 1rem; align-items: flex-start; flex-direction: column; gap: .35rem; }
  .topbar nav { width: 100%; overflow-x: auto; }
  .topbar nav > a, .link-button { padding: .35rem .55rem; font-size: .75rem; white-space: nowrap; }
  .shell { width: min(100% - 1.25rem, 1180px); padding-top: 2rem; }
  .hero { align-items: stretch; flex-direction: column; gap: 1.25rem; }
  .hero h1 { font-size: 2.1rem; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions form, .hero-actions button, .hero-actions a { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .metric { min-height: 130px; padding: .9rem; }
  .metric strong { font-size: 1.8rem; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .section-title { grid-template-columns: 34px 1fr; }
  .section-title .switch { grid-column: 1 / -1; }
  .save-bar { align-items: stretch; flex-direction: column; }
  .save-bar .primary { width: 100%; }
}

@media (max-width: 390px) {
  .metric-grid, .hero-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
