:root {
  --bg: #f6f5f8;
  --surface: #ffffff;
  --surface-soft: #faf9fc;
  --text: #1f2747;
  --muted: #70768b;
  --line: #e9e7ef;
  --violet: #8d78d5;
  --violet-deep: #6957ae;
  --violet-soft: #eee9fb;
  --indigo: #35406d;
  --jade: #42a67d;
  --jade-soft: #e6f6ef;
  --gold: #c99b37;
  --gold-soft: #fbf2dd;
  --danger: #c44f62;
  --danger-soft: #fff0f2;
  --shadow: 0 24px 64px rgba(46, 42, 73, 0.12);
  --radius: 16px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.auth-page {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 16% 18%, rgba(141, 120, 213, .1), transparent 28%),
    radial-gradient(circle at 88% 84%, rgba(66, 166, 125, .07), transparent 24%),
    #f8f7f9;
}

.auth-shell {
  position: relative;
  display: grid;
  grid-template-columns: 58% 42%;
  width: min(1450px, 96vw);
  min-height: min(860px, 92vh);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(222, 219, 230, .7);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.auth-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 38px 44px 92px;
  background:
    linear-gradient(145deg, rgba(250, 248, 255, .98), rgba(241, 237, 251, .72)),
    var(--surface);
}

.company-lockup { display: flex; align-items: center; gap: 24px; position: relative; z-index: 2; }
.company-lockup h1 { margin: 0; color: #161a2a; font-size: clamp(22px, 2vw, 34px); font-weight: 700; letter-spacing: .02em; }
.company-lockup.compact { gap: 18px; }
.company-lockup.compact h1 { margin-top: 4px; font-size: 26px; }
.company-logo-image {
  display: block;
  flex: 0 0 auto;
  width: 112px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(19, 122, 88, .14));
}

.brand-logo {
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  color: #fff;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 27px;
  line-height: 1.05;
  letter-spacing: .08em;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 12px;
  background: linear-gradient(145deg, #ad9ae5, #8069cc);
  box-shadow: inset 0 1px rgba(255,255,255,.35), 0 8px 24px rgba(112, 87, 181, .2);
}
.brand-logo.small { width: 52px; height: 52px; font-size: 16px; border-radius: 10px; }

.finance-visual { position: relative; flex: 1; min-height: 480px; margin: 20px -44px 0; overflow: hidden; }
.visual-grid {
  position: absolute; inset: 14% 0 8%;
  opacity: .38;
  background-image:
    linear-gradient(rgba(122, 101, 197, .16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 101, 197, .16) 1px, transparent 1px);
  background-size: 52px 34px;
  mask-image: linear-gradient(90deg, #000, rgba(0,0,0,.25), transparent);
}
.trend-line { position: absolute; left: 4%; top: 21%; width: 60%; height: 37%; transform: rotate(-4deg); }
.trend-line::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(150deg, transparent 0 28%, #9982df 29% 30%, transparent 31% 43%, #9982df 44% 45%, transparent 46% 57%, #9982df 58% 59%, transparent 60% 100%);
  opacity: .65;
}
.trend-line i { position: absolute; width: 11px; height: 11px; border: 3px solid #8f76db; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(143,118,219,.12); }
.trend-line i:nth-child(1) { left: 16%; top: 67%; }
.trend-line i:nth-child(2) { left: 33%; top: 48%; }
.trend-line i:nth-child(3) { left: 49%; top: 61%; }
.trend-line i:nth-child(4) { left: 66%; top: 34%; }
.trend-line i:nth-child(5) { left: 83%; top: 18%; }
.document-stack { position: absolute; left: 35%; top: 26%; width: 320px; height: 270px; transform: rotate(-3deg); }
.document-card { position: absolute; width: 240px; height: 270px; border: 1px solid rgba(121,99,195,.25); border-radius: 9px; box-shadow: 0 20px 50px rgba(74,54,132,.15); }
.document-back { right: 0; top: 18px; background: linear-gradient(155deg, #8c74d1, #55468e); transform: rotate(7deg); }
.document-front { left: 0; padding: 30px; background: rgba(255,255,255,.94); }
.doc-pie { display: block; width: 52px; height: 52px; margin-bottom: 22px; border-radius: 50%; background: conic-gradient(#927bd6 0 28%, #e9e2fb 28% 64%, #d2c6f3 64%); }
.doc-line { display: block; width: 72%; height: 7px; margin: 10px 0; border-radius: 4px; background: #ded8ed; }
.doc-line.wide { width: 95%; }
.doc-line.short { width: 50%; }
.doc-bars { display: block; width: 150px; height: 76px; margin-top: 26px; border-bottom: 2px solid #d9d3e8; background: linear-gradient(90deg, transparent 0 8%, #b5a3e6 8% 20%, transparent 20% 30%, #8067cb 30% 44%, transparent 44% 54%, #c7b9ec 54% 69%, transparent 69% 79%, #947cd8 79% 94%, transparent 94%); }
.plum-motif { position: absolute; right: 4%; top: 7%; color: #b8a5e8; font-family: serif; font-size: 180px; line-height: 1; opacity: .38; transform: rotate(13deg); }
.finance-visual::after { content: ""; position: absolute; left: -8%; right: -8%; bottom: 3%; height: 110px; border-radius: 50%; border-top: 2px solid rgba(202,158,58,.7); background: linear-gradient(180deg, rgba(142,119,214,.2), transparent 68%); transform: rotate(3deg); }

.trust-row { position: relative; z-index: 3; display: grid; grid-template-columns: repeat(3, 1fr); padding: 24px 18px 4px; border-top: 1px solid rgba(135, 119, 188, .15); }
.trust-row > div { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; border-right: 1px solid rgba(135,119,188,.18); }
.trust-row > div:last-child { border-right: 0; }
.trust-row strong { font-size: 16px; font-weight: 600; color: #33374c; }
.trust-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 2px solid currentColor; border-radius: 11px; font-weight: 800; }
.trust-icon.violet { color: #7965c0; }
.trust-icon.jade { color: var(--jade); }
.trust-icon.gold { color: var(--gold); }

.auth-form-panel { display: grid; place-items: center; min-width: 0; padding: 72px clamp(42px, 5vw, 86px) 100px; background: rgba(255,255,255,.98); }
.auth-form-wrap { width: min(100%, 510px); }
.eyebrow { margin: 0 0 8px; color: var(--violet-deep); font-size: 12px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.auth-form-wrap > h2 { margin: 0; color: #13204b; font-size: clamp(28px, 2.6vw, 43px); line-height: 1.2; letter-spacing: .015em; }
.auth-subtitle { margin: 20px 0 0; color: var(--muted); font-size: 19px; }
.title-rule { display: block; width: 48px; height: 4px; margin: 24px 0 46px; border-radius: 4px; background: var(--jade); }
.form-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font-size: 18px; font-weight: 700; }
.form-heading span { width: 4px; height: 25px; border-radius: 4px; background: var(--violet); }

.auth-form, .stack-form { display: grid; gap: 18px; }
.auth-form label, .stack-form label, .inline-form label, .filter-bar label { display: grid; gap: 8px; color: #454b63; font-size: 14px; font-weight: 600; }
.auth-form label > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { width: 100%; height: 64px; padding: 0 54px 0 54px; color: var(--text); font-size: 16px; border: 1px solid #dedce6; border-radius: 9px; outline: none; background: #fff; transition: border-color .15s, box-shadow .15s; }
.input-wrap input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(141,120,213,.14); }
.field-icon { position: absolute; left: 19px; z-index: 1; color: #798096; font-size: 24px; line-height: 1; }
.field-icon.lock { font-size: 20px; }
.password-toggle { position: absolute; right: 14px; width: 38px; height: 38px; color: #7d8292; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.password-toggle:hover { background: #f2eff8; }
.auth-form .remember-device {
  display: grid; grid-template-columns: 20px 1fr; column-gap: 10px; row-gap: 3px;
  align-items: center; margin: -2px 0 2px; color: #454b63; cursor: pointer;
}
.remember-device input {
  width: 18px; height: 18px; margin: 0; grid-row: 1 / 3;
  accent-color: var(--violet); cursor: pointer;
}
.auth-form .remember-device > span {
  position: static; width: auto; height: auto; overflow: visible; clip: auto;
  font-size: 14px; font-weight: 650;
}
.remember-device small { color: #858a9a; font-size: 12px; font-weight: 400; }
.primary-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 58px; padding: 0 28px; color: #fff; font-weight: 700; font-size: 17px;
  border: 0; border-radius: 9px; cursor: pointer; text-decoration: none;
  background: linear-gradient(100deg, #927cdb, #8369cf);
  box-shadow: 0 10px 22px rgba(115,91,187,.18);
  transition: transform .15s, box-shadow .15s;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(115,91,187,.25); }
.form-help { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 26px 0 0; color: #777c8e; font-size: 14px; }
.form-help span { color: var(--jade); font-weight: 800; }
.auth-footer { position: absolute; left: 0; right: 0; bottom: 0; display: grid; place-items: center; height: 72px; color: #838797; font-size: 14px; border-top: 1px solid var(--line); background: rgba(255,255,255,.72); backdrop-filter: blur(8px); }

.alert { padding: 12px 15px; margin: 0 0 16px; border-radius: 9px; font-size: 14px; }
.alert.error { color: #96394a; border: 1px solid #f0c2ca; background: var(--danger-soft); }
.alert.success { color: #267257; border: 1px solid #bfe5d4; background: var(--jade-soft); }
.page-alert { margin: 0 0 20px; }

.setup-shell { width: min(100%, 680px); }
.setup-card, .message-card { padding: clamp(28px, 6vw, 58px); border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.setup-intro { margin: 28px 0; padding: 14px 16px; color: #62687a; border-left: 4px solid var(--violet); background: var(--violet-soft); }
.stack-form input, .stack-form select, .inline-form input, .inline-form select, .filter-bar input, .filter-bar select {
  width: 100%; height: 46px; padding: 0 13px; color: var(--text); border: 1px solid #dcd9e5; border-radius: 8px; outline: 0; background: #fff;
}
.stack-form input:focus, .inline-form input:focus, .inline-form select:focus, .filter-bar input:focus, .filter-bar select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(141,120,213,.12); }
.field-note { margin: -7px 0 2px; color: var(--muted); font-size: 13px; }
.message-card { text-align: center; }
.message-card .brand-logo { margin-bottom: 22px; }
.message-card h1 { font-size: 28px; }
.message-card p:not(.eyebrow) { margin: 14px 0 26px; color: var(--muted); }
.button-link { min-height: 48px; }

.app-page { background: #f5f5f8; }
.app-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 18px 18px; color: #dfe2f0; background: linear-gradient(180deg, #242c51, #1e2544); }
.sidebar-brand { display: flex; align-items: center; gap: 13px; margin: 0 7px 34px; color: #fff; text-decoration: none; }
.sidebar-logo-image { display: block; flex: 0 0 auto; width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 7px 14px rgba(0,0,0,.18)); }
.sidebar-brand > span:last-child { display: grid; gap: 3px; }
.sidebar-brand strong { font-size: 17px; }
.sidebar-brand small { color: #9ca5c7; font-size: 11px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 13px; color: #c1c6dc; font-size: 14px; text-decoration: none; border-radius: 9px; }
.sidebar nav a span { width: 20px; color: #9d8be0; text-align: center; font-size: 18px; }
.sidebar nav a:hover, .sidebar nav a.active { color: #fff; background: rgba(155,135,211,.17); }
.sidebar nav a.active { box-shadow: inset 3px 0 #a994ec; }
.nav-section { margin: 22px 13px 7px; color: #717b9f; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.sidebar-user { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; margin-top: auto; padding: 15px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user > div:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.sidebar-user strong { overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; }
.sidebar-user small { color: #8892b7; font-size: 11px; }
.sidebar-user form button { width: 32px; height: 32px; color: #aab1cc; border: 0; border-radius: 7px; cursor: pointer; background: transparent; }
.sidebar-user form button:hover { color: #fff; background: rgba(255,255,255,.1); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; color: #fff; font-weight: 700; border-radius: 50%; background: linear-gradient(145deg, #a28cdd, #6955ae); }

.main-content { min-width: 0; padding: 38px clamp(24px, 4vw, 58px) 70px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { margin: 3px 0 8px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.02em; }
.page-header p:last-child { margin: 0; color: var(--muted); }
.security-badge { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #267459; font-size: 13px; font-weight: 600; border: 1px solid #c9e8db; border-radius: 99px; background: #eef9f4; }
.security-badge span { display: grid; place-items: center; width: 20px; height: 20px; color: #fff; border-radius: 50%; background: var(--jade); }

.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.service-card { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 18px; min-height: 210px; padding: 28px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 6px 18px rgba(43,43,65,.04); }
.service-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--card-soft); }
.service-card.violet { --card: #826dca; --card-soft: #f0ecfb; }
.service-card.indigo { --card: #455381; --card-soft: #edf0f8; }
.service-card.jade { --card: #359b74; --card-soft: #e9f7f1; }
.service-card.gold { --card: #bd8e2d; --card-soft: #fcf4e4; }
.service-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 56px; height: 56px; color: #fff; font-size: 20px; font-weight: 800; border-radius: 15px; background: var(--card); box-shadow: 0 10px 20px color-mix(in srgb, var(--card) 25%, transparent); }
.service-card h2 { margin: 2px 0 8px; font-size: 20px; }
.service-card p { margin: 0; color: var(--muted); line-height: 1.65; }
.service-card small { display: block; margin-top: 9px; color: #9a9dab; font-size: 11px; }
.service-actions { grid-column: 2; align-self: end; display: grid; gap: 12px; }
.service-primary-action { justify-self: start; color: var(--card); font-size: 14px; font-weight: 700; text-decoration: none; }
.service-primary-action:hover { text-decoration: underline; }
.service-pending { color: #9b9ead; font-weight: 500; }
.empty-services { grid-column: 1 / -1; padding: 45px 24px; color: var(--muted); text-align: center; border: 1px dashed #d8d4e2; border-radius: 14px; background: rgba(255,255,255,.55); }
.empty-services h2 { margin: 0 0 8px; color: var(--text); font-size: 18px; }
.empty-services p { margin: 0; }
.context-notice { display: flex; gap: 10px; margin-top: 18px; padding: 13px 16px; color: #615876; font-size: 12px; line-height: 1.6; border: 1px solid #e2dcef; border-radius: 10px; background: #faf8fe; }
.context-notice strong { flex: 0 0 auto; color: var(--violet-deep); }
.info-banner { display: flex; align-items: flex-start; gap: 18px; margin-top: 24px; padding: 22px 24px; border: 1px solid #dbece5; border-radius: 13px; background: #f8fcfa; }
.info-banner h2 { margin: 0 0 5px; font-size: 16px; }
.info-banner p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.network-advisor {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 14px 22px; margin-bottom: 20px; padding: 18px 20px;
  border: 1px solid #ddd8eb; border-radius: 14px;
  background: linear-gradient(120deg, #fbf9ff, #f6fbf8);
}
.network-advisor-copy { display: flex; align-items: center; gap: 14px; }
.network-advisor h2 { margin: 0 0 4px; font-size: 15px; }
.network-advisor p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.network-pulse {
  display: block; flex: 0 0 auto; width: 13px; height: 13px;
  border: 3px solid #a99ae0; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(141,120,213,.35);
  animation: network-pulse 1.5s infinite;
}
.network-advisor.is-complete .network-pulse {
  border-color: var(--jade); background: var(--jade); animation: none;
}
@keyframes network-pulse {
  70% { box-shadow: 0 0 0 9px rgba(141,120,213,0); }
  100% { box-shadow: 0 0 0 0 rgba(141,120,213,0); }
}
.network-probe-button {
  min-height: 38px; padding: 0 15px; color: #fff; font-size: 12px;
  font-weight: 700; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--violet-deep);
}
.network-probe-button:disabled { cursor: wait; opacity: .65; }
.network-summary {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px;
  min-height: 0;
}
.network-summary:empty { display: none; }
.network-summary span {
  padding: 5px 9px; font-size: 11px; border-radius: 99px;
}
.network-summary .is-online { color: #267459; background: var(--jade-soft); }
.network-summary .is-offline { color: #8c6470; background: #f4eff1; }

.entry-options { display: flex; flex-wrap: wrap; gap: 7px; }
.entry-option {
  display: grid; gap: 2px; min-width: 92px; padding: 7px 9px;
  color: #62677a; text-decoration: none; border: 1px solid #e2e0e7;
  border-radius: 8px; background: #fafafa;
}
.entry-option > span { font-size: 11px; font-weight: 700; }
.entry-option small { margin: 0; color: #9598a5; font-size: 9px; }
.entry-option.is-checking { opacity: .66; }
.entry-option.is-online { color: #2e765c; border-color: #cce7dc; background: #f5fbf8; }
.entry-option.is-best { border-color: var(--card); box-shadow: inset 0 0 0 1px var(--card); }
.entry-option.is-offline {
  color: #777b89; border-color: #e5e3e9;
  background: #f8f8fa;
}

.panel { border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 3px 14px rgba(43,43,65,.025); }
.narrow-panel { width: min(100%, 620px); padding: 28px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px 18px; }
.panel-heading h2 { margin: 0 0 5px; font-size: 17px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.filter-bar { display: grid; grid-template-columns: repeat(5, minmax(125px, 1fr)) auto auto; align-items: end; gap: 12px; margin-bottom: 20px; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.filter-bar label { gap: 6px; font-size: 11px; }
.filter-bar input, .filter-bar select { height: 40px; font-size: 13px; }
.filter-button { height: 40px; padding: 0 20px; color: #fff; font-weight: 700; border: 0; border-radius: 8px; cursor: pointer; background: var(--violet-deep); }
.clear-filter { display: grid; place-items: center; height: 40px; color: var(--muted); font-size: 12px; text-decoration: none; }
.clear-filter:hover { color: var(--violet-deep); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.metric-card { display: grid; gap: 9px; min-height: 135px; padding: 22px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: 31px; line-height: 1; letter-spacing: -.03em; }
.metric-card strong em { margin-left: 3px; color: var(--muted); font-size: 13px; font-style: normal; font-weight: 500; }
.metric-card small { color: #9a9dad; font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 18px; margin-bottom: 18px; }
.legend-dot { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.legend-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); }
.line-chart { position: relative; height: 280px; margin: 0 22px 20px 50px; border-bottom: 1px solid #e8e6ed; background: repeating-linear-gradient(0deg, transparent 0 60px, #f0eef4 61px); }
.line-chart svg { position: absolute; inset: 0; width: 100%; height: calc(100% - 23px); overflow: visible; }
.chart-line { fill: none; stroke: #8068ca; stroke-width: 1.35; vector-effect: non-scaling-stroke; }
.chart-area { fill: url(#chart-fill); }
.line-chart circle { fill: #fff; stroke: #8068ca; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.chart-y { position: absolute; left: -43px; color: #a0a3b0; font-size: 10px; }
.chart-y.max { top: 4px; }
.chart-y.zero { bottom: 23px; }
.chart-labels { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; color: #999caa; font-size: 10px; }
.empty-chart { display: grid; place-items: center; height: 280px; color: #a0a3b0; font-size: 13px; }

.bar-list { display: grid; gap: 18px; padding: 10px 24px 20px; }
.bar-row { display: grid; grid-template-columns: 1fr 42px; gap: 7px 12px; }
.bar-row > div:first-child { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.bar-row > div:first-child span { color: var(--muted); }
.bar-track { height: 7px; overflow: hidden; border-radius: 8px; background: #eeeaf5; }
.bar-track span { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #9884d9, #6e58ba); }
.bar-row small { color: var(--muted); font-size: 10px; }
.empty-small { padding: 35px 0; color: #9da0af; font-size: 12px; text-align: center; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 4px 24px 24px; border: 1px solid var(--line); border-radius: 10px; }
.status-item { display: grid; gap: 3px; padding: 12px 6px; text-align: center; border-right: 1px solid var(--line); }
.status-item:last-child { border: 0; }
.status-item strong { font-size: 15px; }
.status-item span { color: var(--muted); font-size: 10px; }
.status-4 strong, .status-5 strong { color: var(--danger); }

.table-panel { margin-bottom: 18px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 11px 15px; color: #8b8f9f; font-size: 10px; font-weight: 700; text-align: left; letter-spacing: .04em; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #faf9fc; }
td { padding: 14px 15px; color: #555b70; font-size: 12px; border-bottom: 1px solid #efedf3; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbfe; }
td a { color: var(--violet-deep); font-weight: 700; text-decoration: none; }
.empty-cell { height: 100px; color: #9da0ae; text-align: center; }
.text-error { color: var(--danger); font-weight: 700; }
.service-pill, .role-pill, .state-pill, .status-code { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 99px; font-size: 10px; font-weight: 700; }
.service-pill { color: #6554a7; background: var(--violet-soft); }
.status-code { color: #2e765a; background: var(--jade-soft); }
.status-code.code-4, .status-code.code-5 { color: #9d3f50; background: var(--danger-soft); }
.path-cell { display: inline-block; max-width: 260px; overflow: hidden; vertical-align: middle; text-overflow: ellipsis; }
td code { margin-right: 5px; color: #73788a; font-size: 10px; }

.create-user-panel { margin-bottom: 18px; }
.inline-form { display: grid; grid-template-columns: 1fr 1.4fr .8fr auto; align-items: end; gap: 15px; padding: 0 24px 24px; }
.compact-button { min-height: 46px; padding: 0 22px; font-size: 14px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell > div { display: grid; gap: 3px; }
.user-cell small { color: #a0a3af; font-size: 10px; }
.small-avatar { width: 34px; height: 34px; font-size: 12px; }
.role-pill { color: #5f5097; background: var(--violet-soft); }
.state-pill.enabled { color: #257154; background: var(--jade-soft); }
.state-pill.disabled { color: #9c4051; background: var(--danger-soft); }
.action-group { display: flex; align-items: center; gap: 10px; }
.action-group form { margin: 0; }
.text-button, details summary { padding: 0; color: var(--violet-deep); font-size: 11px; border: 0; cursor: pointer; background: none; }
details { position: relative; }
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
.popover-form { position: absolute; z-index: 10; right: 0; top: 26px; display: grid; gap: 10px; width: 250px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 15px 35px rgba(36,32,61,.17); }
.popover-form label { display: grid; gap: 6px; font-size: 11px; }
.popover-form input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #ddd9e5; border-radius: 7px; }
.small-button { height: 36px; color: #fff; border: 0; border-radius: 7px; cursor: pointer; background: var(--violet-deep); }
.permission-popover { width: 310px; }
.permission-popover > strong { font-size: 12px; line-height: 1.5; }
.check-row { display: flex !important; align-items: center; gap: 9px !important; cursor: pointer; }
.check-row input { flex: 0 0 auto; width: 16px; height: 16px; padding: 0; accent-color: var(--violet-deep); }
.check-row > span { display: grid; gap: 2px; font-size: 12px; }
.check-row small { color: #999dac; font-size: 10px; }

.admin-dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  padding: 0;
  overflow: auto;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(28, 24, 50, .26);
}
.admin-dialog::backdrop { background: rgba(25, 29, 48, .48); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 25px 26px 20px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font-size: 20px; }
.dialog-heading p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dialog-heading .eyebrow { margin-bottom: 5px; font-size: 10px; }
.dialog-close { flex: 0 0 auto; width: 34px; height: 34px; color: #777c8d; font-size: 24px; line-height: 1; border: 0; border-radius: 8px; cursor: pointer; background: #f5f3f8; }
.dialog-close:hover { color: var(--text); background: #ece8f3; }
.dialog-form { display: grid; gap: 17px; padding: 22px 26px 26px; }
.dialog-form > label { display: grid; gap: 8px; color: #454b63; font-size: 13px; font-weight: 600; }
.dialog-form > label input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #dcd9e5; border-radius: 8px; outline: 0; }
.dialog-form > label input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(141,120,213,.12); }
.permission-list { display: grid; gap: 10px; }
.permission-option { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 12px; padding: 14px; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; background: #fbfafc; }
.permission-option:hover { border-color: #cfc7e5; background: #f8f5fd; }
.permission-option input { width: 17px; height: 17px; accent-color: var(--violet-deep); }
.permission-option > span { display: grid; gap: 4px; }
.permission-option strong { font-size: 13px; }
.permission-option small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.dialog-admin-note { margin: 22px 26px 0; padding: 16px; color: #51645d; font-size: 13px; line-height: 1.7; border: 1px solid #dbece5; border-radius: 9px; background: #f6fbf8; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.dialog-admin-note + .dialog-actions { padding: 20px 26px 26px; }
.dialog-actions .small-button, .dialog-actions .secondary-button { min-width: 94px; height: 40px; padding: 0 17px; border-radius: 8px; cursor: pointer; }
.secondary-button { color: #5c6174; border: 1px solid #dcd9e5; background: #fff; }

.service-create-form { display: grid; grid-template-columns: 1fr 1.2fr .8fr 1.8fr auto; align-items: end; gap: 15px; padding: 0 24px 24px; }
.service-create-form label { display: grid; gap: 8px; color: #454b63; font-size: 13px; font-weight: 600; }
.service-create-form input { width: 100%; height: 46px; padding: 0 13px; color: var(--text); border: 1px solid #dcd9e5; border-radius: 8px; outline: 0; background: #fff; }
.service-create-form input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(141,120,213,.12); }
.service-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.service-editor { padding: 22px; }
.service-editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.service-editor-heading > div { display: grid; gap: 8px; }
.service-editor-heading h2 { margin: 0; font-size: 18px; }
.host-port-field { display: grid; grid-template-columns: auto 1fr; align-items: center; overflow: hidden; border: 1px solid #dcd9e5; border-radius: 8px; background: #f8f7fa; }
.host-port-field span { padding-left: 12px; color: #777c8d; font-size: 12px; }
.host-port-field input { border: 0; border-left: 1px solid #e5e2ea; border-radius: 0; }
.toggle-row { display: flex !important; grid-template-columns: none; align-items: center; gap: 9px !important; cursor: pointer; }
.toggle-row input { width: 17px; height: 17px; accent-color: var(--violet-deep); }

@media (max-width: 1180px) {
  .auth-shell { grid-template-columns: 50% 50%; }
  .finance-visual { min-height: 400px; }
  .document-stack { left: 25%; transform: scale(.85) rotate(-3deg); }
  .trust-row { grid-template-columns: 1fr; gap: 8px; }
  .trust-row > div { justify-content: flex-start; border: 0; }
  .filter-bar { grid-template-columns: repeat(3, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .service-create-form { grid-template-columns: repeat(2, 1fr); }
  .service-create-form .wide-field { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .auth-page { padding: 0; place-items: stretch; }
  .auth-shell { display: block; width: 100%; min-height: 100vh; border: 0; border-radius: 0; }
  .auth-brand-panel { min-height: auto; padding: 24px 24px 30px; }
  .company-lockup { gap: 14px; }
  .brand-logo { width: 58px; height: 58px; font-size: 18px; }
  .company-lockup h1 { font-size: 19px; }
  .finance-visual { display: none; }
  .trust-row { grid-template-columns: repeat(3, 1fr); margin-top: 25px; padding: 18px 0 0; }
  .trust-row > div { justify-content: center; border-right: 1px solid rgba(135,119,188,.18); }
  .trust-row strong { font-size: 11px; }
  .trust-icon { width: 27px; height: 27px; border-radius: 8px; }
  .auth-form-panel { padding: 40px 24px 100px; }
  .auth-form-wrap > h2 { font-size: 28px; }
  .auth-subtitle { font-size: 15px; }
  .title-rule { margin: 20px 0 30px; }
  .app-layout { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 16px; }
  .sidebar-brand { margin-bottom: 14px; }
  .sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .sidebar nav a { justify-content: center; }
  .sidebar nav a span, .nav-section, .sidebar-user { display: none; }
  .main-content { padding: 27px 16px 50px; }
  .network-advisor { grid-template-columns: 1fr; }
  .network-probe-button { justify-self: start; }
  .service-grid, .metric-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: repeat(2, 1fr); }
  .inline-form { grid-template-columns: 1fr; }
  .service-admin-grid, .service-create-form { grid-template-columns: 1fr; }
  .service-create-form .wide-field { grid-column: auto; }
}

@media (max-width: 520px) {
  .trust-row { grid-template-columns: 1fr; gap: 8px; }
  .trust-row > div { justify-content: flex-start; border: 0; }
  .auth-footer { font-size: 11px; }
  .sidebar nav { grid-template-columns: 1fr; }
  .sidebar nav a { justify-content: flex-start; }
  .page-header { display: block; }
  .security-badge { display: none; }
  .service-card { grid-template-columns: 46px minmax(0, 1fr); padding: 20px; }
  .service-icon { width: 46px; height: 46px; }
  .entry-option { min-width: calc(50% - 4px); }
  .filter-bar { grid-template-columns: 1fr; }
  .line-chart { margin-left: 42px; }
  .context-notice { display: grid; }
}
