:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #172033;
  --muted: #68758a;
  --line: #e3e8f0;
  --primary: #2457d6;
  --primary-dark: #183e9f;
  --primary-soft: #eaf0ff;
  --green: #17835f;
  --green-soft: #e8f7f1;
  --yellow: #9a6500;
  --yellow-soft: #fff5d8;
  --red: #c33b45;
  --red-soft: #ffebed;
  --sidebar: #111a2c;
  --sidebar-muted: #98a6bf;
  --shadow: 0 18px 50px rgba(25, 43, 80, .1);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(145deg, #2b63ed, #163b9b);
  box-shadow: 0 12px 28px rgba(36, 87, 214, .28);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -.03em;
}
.brand-mark.small { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; box-shadow: none; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 20%, rgba(60, 109, 235, .2), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(23, 131, 95, .13), transparent 28%),
    #eef3fb;
}
.login-card {
  width: min(430px, 100%);
  padding: 42px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 26px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
}
.login-card .brand-mark { margin-bottom: 30px; }
.login-card h1 { margin: 0; font-size: clamp(28px, 5vw, 38px); letter-spacing: -.04em; }
.login-copy { margin: 12px 0 30px; color: var(--muted); line-height: 1.7; }
.login-footnote { margin: 24px 0 0; color: #8a95a8; text-align: center; font-size: 13px; }

.form-stack { display: grid; gap: 18px; }
.form-stack label { display: grid; gap: 8px; color: #344057; font-size: 14px; font-weight: 700; }
.form-stack label small { color: var(--muted); font-size: 12px; font-weight: 500; }
input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #cfd7e5;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(36,87,214,.11); }
input:disabled { color: #79859a; background: #f1f3f7; }
.form-error { min-height: 18px; margin: -5px 0 0; color: var(--red); font-size: 13px; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  transition: transform .15s, background .15s, border-color .15s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .58; transform: none; }
.button.primary { color: #fff; background: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.ghost { color: #3d4c64; border-color: var(--line); background: #fff; }
.button.warning { color: var(--yellow); border-color: #f1d284; background: var(--yellow-soft); }
.button.wide { width: 100%; min-height: 48px; }
.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-size: 20px;
}

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 236px;
  flex-direction: column;
  padding: 24px 18px;
  color: #fff;
  background: var(--sidebar);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 7px 27px; color: #fff; text-decoration: none; }
.sidebar-brand span:last-child { display: grid; gap: 2px; }
.sidebar-brand strong { font-size: 16px; }
.sidebar-brand small { color: var(--sidebar-muted); font-size: 12px; }
.sidebar-nav { display: grid; gap: 7px; }
.nav-item {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 0;
  border-radius: 11px;
  color: #bac5d8;
  background: transparent;
  text-align: left;
  font-weight: 700;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: linear-gradient(120deg, #2659d5, #214dbb); box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.nav-icon { display: grid; width: 24px; place-items: center; font-size: 18px; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 15px 10px 3px; color: var(--sidebar-muted); font-size: 12px; }
.secure-dot { width: 8px; height: 8px; border-radius: 50%; background: #45d19b; box-shadow: 0 0 0 4px rgba(69,209,155,.12); }

.workspace { min-height: 100vh; margin-left: 236px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  padding: 15px 32px;
  border-bottom: 1px solid rgba(222,228,238,.85);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(14px);
}
.topbar h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-menu-wrap { position: relative; }
.user-button {
  display: flex;
  min-width: 178px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}
.avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; color: var(--primary); background: var(--primary-soft); font-weight: 900; }
.user-copy { display: grid; flex: 1; gap: 1px; }
.user-copy strong { font-size: 14px; }
.user-copy small { color: var(--muted); font-size: 11px; }
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 170px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}
.user-menu button { width: 100%; padding: 10px; border: 0; border-radius: 8px; color: #38465d; background: transparent; text-align: left; }
.user-menu button:hover { background: var(--panel-soft); }
.mobile-menu { display: none; }

.content { width: min(1320px, 100%); margin: 0 auto; padding: 32px; }
.view { display: none; }
.view.active { display: block; animation: view-in .2s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.hero-panel {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 34px 38px;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 84% 15%, rgba(255,255,255,.17), transparent 26%),
    linear-gradient(130deg, #183a91, #285fe0 58%, #3479ef);
  box-shadow: 0 22px 45px rgba(32,78,180,.22);
}
.hero-panel .eyebrow { color: #bcd1ff; }
.hero-panel h1 { margin: 0; font-size: clamp(29px, 4vw, 43px); letter-spacing: -.045em; }
.hero-panel p:last-child { max-width: 670px; margin: 13px 0 0; color: #d9e5ff; line-height: 1.7; }
.hero-summary { display: grid; min-width: 126px; place-items: center; padding: 20px; border: 1px solid rgba(255,255,255,.18); border-radius: 19px; background: rgba(255,255,255,.1); }
.hero-summary strong { font-size: 35px; }
.hero-summary span { color: #dce7ff; font-size: 13px; }
.section-heading, .panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-heading { margin: 34px 0 17px; }
.section-heading h3, .panel-heading h3 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.section-heading p:last-child, .panel-heading p:last-child { margin-bottom: 0; }

.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.service-card {
  position: relative;
  display: grid;
  min-height: 225px;
  align-content: space-between;
  padding: 23px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(32,51,84,.055);
}
.service-card::after { content: ""; position: absolute; top: -34px; right: -34px; width: 105px; height: 105px; border-radius: 50%; background: var(--primary-soft); opacity: .7; }
.service-card-head { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.service-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; color: var(--primary); background: var(--primary-soft); font-size: 16px; font-weight: 900; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.ok { color: var(--green); background: var(--green-soft); }
.status-pill.degraded { color: var(--yellow); background: var(--yellow-soft); }
.status-pill.offline { color: var(--red); background: var(--red-soft); }
.service-card h4 { margin: 20px 0 7px; font-size: 19px; }
.service-card p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 13px; }
.service-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 23px; }
.service-meta { color: #7d899c; font-size: 12px; }
.empty-card { padding: 34px; border: 1px dashed #cbd4e2; border-radius: var(--radius); color: var(--muted); background: #fafbfd; text-align: center; }

.status-banner {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.status-banner p { margin: 4px 0 0; color: var(--muted); }
.status-banner.ok { border-color: #bce8d7; background: var(--green-soft); }
.status-banner.warn { border-color: #f1d58e; background: var(--yellow-soft); }
.status-banner.bad { border-color: #f2bdc1; background: var(--red-soft); }
.status-orb { width: 14px; height: 14px; flex: 0 0 auto; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 6px rgba(36,87,214,.12); }
.status-banner.ok .status-orb { background: var(--green); box-shadow: 0 0 0 6px rgba(23,131,95,.12); }
.status-banner.warn .status-orb { background: var(--yellow); box-shadow: 0 0 0 6px rgba(154,101,0,.12); }
.status-banner.bad .status-orb { background: var(--red); box-shadow: 0 0 0 6px rgba(195,59,69,.12); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.metric-card { padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { display: block; margin: 7px 0 3px; font-size: 25px; letter-spacing: -.035em; }
.metric-card small { color: #8792a4; }
.panel { margin-top: 18px; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 8px 26px rgba(32,51,84,.045); }
.panel-heading { align-items: center; margin-bottom: 18px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { color: #5c687b; background: #f7f9fc; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.alert-list { display: grid; gap: 10px; }
.alert-row { display: flex; align-items: center; gap: 11px; padding: 13px 15px; border-radius: 11px; color: #3d4a5f; background: var(--panel-soft); }
.alert-row::before { content: ""; width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--primary); }
.alert-row.ok::before { background: var(--green); }
.alert-row.warn::before { background: var(--yellow); }
.alert-row.bad::before { background: var(--red); }

.accounts-heading { align-items: center; margin-top: 0; }
.accounts-heading .muted { margin: 7px 0 0; }
.account-panel { padding: 0; overflow: hidden; }
.account-list { display: grid; }
.account-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(220px, 2fr) 120px 120px; align-items: center; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.account-row:last-child { border-bottom: 0; }
.account-person { display: flex; align-items: center; gap: 12px; }
.account-person .avatar { width: 42px; height: 42px; }
.account-person div { display: grid; gap: 3px; }
.account-person small { color: var(--muted); }
.app-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 7px; color: #385077; background: #edf2fa; font-size: 11px; }
.role-badge { display: inline-flex; width: fit-content; padding: 6px 9px; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 800; }
.role-badge.service { color: #5c6575; background: #edf0f4; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(10,18,34,.56); backdrop-filter: blur(4px); }
.modal { width: min(480px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 25px; border-radius: 20px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.wide-modal { width: min(730px, 100%); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.modal-heading h3 { margin: 0; font-size: 23px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 7px; color: #4b586d; font-size: 13px; font-weight: 800; }
.app-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.app-check { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
.app-check input, .checkbox-row input { width: 17px; min-height: 17px; }
.checkbox-row { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }

.toast { position: fixed; right: 25px; bottom: 25px; z-index: 100; max-width: 380px; padding: 13px 17px; border-radius: 11px; color: #fff; background: #1d2a40; box-shadow: var(--shadow); font-size: 14px; }
.toast.error { background: var(--red); }

@media (max-width: 1050px) {
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-row { grid-template-columns: 1fr 1.5fr 90px; }
  .account-row .account-action { grid-column: 3; grid-row: 1; }
  .account-row .account-state { grid-column: 3; grid-row: 2; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,.25); }
  .workspace { margin-left: 0; }
  .mobile-menu { display: grid; }
  .topbar { padding: 13px 16px; }
  .topbar > div:first-of-type { margin-right: auto; padding-left: 10px; }
  .topbar .button.ghost { display: none; }
  .user-button { min-width: 0; }
  .user-copy { display: none; }
  .content { padding: 20px 15px 34px; }
  .hero-panel { min-height: 0; align-items: flex-start; padding: 27px 24px; }
  .hero-summary { display: none; }
  .service-grid, .metric-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .accounts-heading { flex-direction: column; }
  .account-row { grid-template-columns: 1fr; gap: 11px; }
  .account-row .account-action, .account-row .account-state { grid-column: auto; grid-row: auto; }
  .form-grid, .app-check-grid { grid-template-columns: 1fr; }
  .modal { padding: 21px; }
  .login-card { padding: 30px 25px; }
}
