/* MuuZi 平台后台
 *
 * Same console system as GuDuu MCN's 平台總後台 (../GuDuu MCN/admin): dark rail,
 * paper workspace, zero radius anywhere, mono for labels and numerals. What
 * differs is the brand — MuuZi's blue instead of MCN's red, MuuZi's typefaces,
 * and 简体 to match the app. */

:root {
  --ink: #15171e;
  --ink-2: #33374a;
  --muted: #73787d;
  --line: #dfe2e6;
  --paper: #f4f5f8;
  --surface: #fff;
  --accent: #2f6df4;
  --green: #218b57;
  --amber: #9a6b12;
  --danger: #c8372a;
  --sidebar: #15171e;
  --sidebar-muted: #8c9297;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Noto Sans SC", "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.eyebrow { margin: 0; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted); }

.loading-view { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); font-size: 13px; }
.loading-view img { object-fit: contain; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* --- Login: dark brand panel, form on paper --- */

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 43%) 1fr; background: var(--surface); }
.login-brand { position: relative; min-height: 100vh; padding: 46px 54px; background: var(--sidebar); color: #f5f6f7; display: flex; flex-direction: column; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; right: -220px; bottom: -220px; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 72px rgba(255,255,255,.025), 0 0 0 146px rgba(255,255,255,.018); }
.brand-lockup { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 26px; font-weight: 600; }
.brand-lockup img { object-fit: contain; }
.brand-statement { position: relative; z-index: 1; margin: auto 0; max-width: 490px; }
.brand-statement .eyebrow { color: #6f9bfb; }
.brand-statement h1 { margin: 22px 0 18px; font-size: 60px; line-height: 1.06; font-weight: 700; }
.brand-statement > p:last-child { max-width: 390px; margin: 0; color: #adb2b6; font-size: 16px; line-height: 1.8; }
.brand-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; color: #747b80; font-family: var(--mono); font-size: 11px; }
.brand-foot span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(33,139,87,.14); }

.login-panel { display: grid; place-items: center; padding: 48px; }
.login-inner { width: min(100%, 430px); }
.login-heading h2 { margin: 10px 0 6px; font-size: 32px; }
.login-heading > p:last-child { margin: 0; color: var(--muted); }
.platform-login-form { margin-top: 38px; }
.field { display: block; margin-bottom: 19px; }
.field span { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; }
.field input { width: 100%; height: 52px; border: 1px solid var(--line); border-radius: 0; background: #fafafa; padding: 0 15px; outline: none; color: var(--ink); transition: border-color .15s, background .15s; }
.field input:focus { border-color: var(--ink); background: var(--surface); }
.form-error { margin: -4px 0 16px; color: var(--danger); font-size: 13px; line-height: 1.5; }
.primary-button { width: 100%; min-height: 54px; padding: 0 18px; border: 0; background: var(--ink); color: white; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.primary-button:hover { background: #24283a; }
/* Greyed out is the whole message — no explanatory line underneath. */
.primary-button:disabled { background: #b6b9c2; cursor: not-allowed; }
.text-button { width: 100%; min-height: 42px; margin-top: 10px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.text-button:hover { color: var(--ink); }
.identity-state { margin-top: 23px; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #adb2b6; }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(33,139,87,.11); }
.status-dot.offline { background: var(--danger); }

/* --- Console shell --- */

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 250px; height: 100dvh; overflow: hidden; background: var(--sidebar); color: #f4f5f8; display: flex; flex-direction: column; }
.sidebar-brand { height: 74px; flex: 0 0 74px; padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.global-logo-slot { width: 42px; height: 42px; flex: 0 0 42px; overflow: hidden; display: grid; place-items: center; }
.global-logo-slot img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand div { display: flex; flex-direction: column; }
.sidebar-brand strong { font-size: 19px; line-height: 1; }
.sidebar-brand span { margin-top: 5px; color: var(--sidebar-muted); font-family: var(--mono); font-size: 11px; }
.close-menu { display: none; }

.org-switcher { flex: 0 0 auto; margin: 18px 15px 10px; padding: 13px 14px; border: 1px solid rgba(255,255,255,.1); border-left: 3px solid var(--accent); display: grid; gap: 4px; }
.org-switcher span, .org-switcher small { color: var(--sidebar-muted); font-size: 11px; }
.org-switcher small { font-family: var(--mono); }

.navigation { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 15px 12px; }
.nav-group-toggle { width: 100%; min-height: 40px; margin-top: 9px; padding: 0 10px; border: 0; border-bottom: 1px solid rgba(255,255,255,.08); background: transparent; color: #9aa0a5; display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; text-align: left; }
.nav-group-toggle:hover, .nav-group-toggle[aria-expanded="true"] { color: #b7bcc0; }
.nav-group-toggle i { color: #9ba0a4; font-family: var(--mono); font-style: normal; font-size: 13px; }
.nav-sublist { margin-top: 5px; border-left: 1px solid rgba(255,255,255,.1); }
.nav-sublist .nav-item { padding-left: 14px; }
.nav-item { position: relative; width: 100%; min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: #b7bcc0; display: flex; align-items: center; gap: 11px; text-align: left; font-size: 14px; }
.nav-item i { width: 24px; color: #7d8489; font-family: var(--mono); font-size: 11px; font-style: normal; }
.nav-item:hover { color: white; background: rgba(255,255,255,.04); }
.nav-item.is-active { color: white; background: rgba(255,255,255,.08); }
.nav-item.is-active::before { content: ""; position: absolute; left: 0; width: 2px; height: 18px; background: var(--accent); }

.sidebar-user { min-height: 72px; flex: 0 0 72px; padding: 12px 15px; border-top: 1px solid rgba(255,255,255,.08); display: grid; grid-template-columns: 34px 1fr 34px; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; background: #e8e9ea; color: var(--ink); font-weight: 700; font-size: 12px; }
.sidebar-user > div:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.sidebar-user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.sidebar-user span { margin-top: 3px; color: var(--sidebar-muted); font-size: 9px; }
.icon-button { width: 34px; height: 34px; padding: 0; border: 1px solid rgba(255,255,255,.1); background: transparent; color: inherit; display: grid; place-items: center; }
.icon-button:hover { background: rgba(255,255,255,.06); }
.menu-button { display: none; border-color: var(--line); color: var(--ink); }
.sidebar-scrim { display: none; }

.workspace { min-width: 0; grid-column: 2; }
.topbar { height: 74px; padding: 0 34px; background: rgba(244,245,248,.95); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 15px; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px); }
.topbar h1 { margin: 2px 0 0; font-size: 21px; }
.topbar-spacer { flex: 1; }
.node-chip { min-height: 31px; padding: 0 11px; border: 1px solid #b9d5c6; color: var(--green); display: flex; align-items: center; gap: 8px; flex: 0 0 auto; white-space: nowrap; font-family: var(--mono); font-size: 10px; font-weight: 500; }
.node-chip span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.node-chip.is-idle { border-color: var(--line); color: var(--muted); }

.workspace-content { padding: 30px 34px 48px; }
.content-view { display: none; }
.content-view.is-active { display: block; }
.welcome-row, .section-heading { margin-bottom: 22px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.welcome-row p { margin: 0 0 3px; color: var(--muted); font-size: 12px; }
.welcome-row h2, .section-heading h2 { margin: 0; font-size: 25px; }
.welcome-row > span, .section-heading > span { color: var(--muted); font-size: 12px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.metric { min-height: 138px; padding: 19px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; }
.metric > span { color: var(--muted); font-size: 12px; }
.metric strong { margin: auto 0 3px; font-family: var(--mono); font-size: 35px; }
.metric small { color: #9aa0a4; font-family: var(--mono); font-size: 9px; }
.metric-dark { background: var(--ink); border-color: var(--ink); color: white; }
.metric-dark > span, .metric-dark small { color: #8f9599; }

.overview-grid { margin-top: 13px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 13px; }
.surface { background: var(--surface); border: 1px solid var(--line); }
.surface > header { min-height: 68px; padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.surface h3 { margin: 3px 0 0; font-size: 16px; }
.surface > header > span { color: var(--muted); font-family: var(--mono); font-size: 10px; }

.activity-list { max-height: 330px; overflow-y: auto; }
.activity-row { padding: 14px 18px; border-bottom: 1px solid #eceef1; display: flex; align-items: baseline; gap: 12px; font-size: 12px; }
.activity-row:last-child { border-bottom: 0; }
.activity-row time { flex: 0 0 auto; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.activity-empty { padding: 40px 18px; color: var(--muted); text-align: center; font-size: 12px; }

.reach-value { padding: 22px 18px 6px; display: flex; align-items: baseline; gap: 6px; }
.reach-value span { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.reach-value strong { font-family: var(--mono); font-size: 34px; }
.reach-value small { margin-left: auto; color: var(--muted); font-size: 11px; }
.surface dl { margin: 0; padding: 6px 18px 18px; }
.surface dl > div { padding: 11px 0; border-bottom: 1px solid #eceef1; display: flex; justify-content: space-between; font-size: 12px; }
.surface dl > div:last-child { border-bottom: 0; }
.surface dt { color: var(--muted); }
.surface dd { margin: 0; font-weight: 500; }
.surface dd.ok { color: var(--green); }

.node-search { display: flex; align-items: end; gap: 10px; }
.node-search input { width: 260px; height: 40px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); padding: 0 13px; outline: none; color: var(--ink); }
.node-search input:focus { border-color: var(--ink); }
.node-search button { min-height: 40px; padding: 0 16px; border: 1px solid var(--ink); background: var(--ink); color: white; font-size: 13px; font-weight: 500; }
.node-search button:hover { background: #24283a; }

.table-surface { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 17px; border-bottom: 1px solid #eceef1; text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #fafafa; font-family: var(--mono); font-size: 9px; }
td { font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.table-empty { height: 170px; color: var(--muted); text-align: center; }
td strong { display: block; }
td small { display: block; margin-top: 3px; color: var(--muted); font-family: var(--mono); font-size: 10px; }

.state-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; background: #ebf5ef; color: var(--green); font-family: var(--mono); font-size: 10px; font-weight: 500; }
.state-chip.is-muted { color: var(--muted); background: #eef0f2; }
.state-chip.is-warn { color: var(--amber); background: #f7f0e0; }
.state-chip.is-down { color: var(--danger); background: #f7e8e6; }

.empty-state { min-height: 360px; padding: 40px; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-state > span { width: 48px; height: 48px; display: grid; place-items: center; background: var(--ink); color: white; font-family: var(--mono); font-size: 11px; }
.empty-state h3 { margin: 17px 0 6px; font-size: 18px; }
.empty-state p { max-width: 380px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

@media (max-width: 1050px) {
  .brand-statement h1 { font-size: 42px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 220px; padding: 26px; }
  .brand-statement { margin: 42px 0 0; }
  .brand-statement h1 { margin: 10px 0 0; font-size: 34px; }
  .brand-statement > p:last-child, .brand-foot { display: none; }
  .login-panel { padding: 36px 24px; align-items: start; }
  .login-heading h2 { font-size: 27px; }
  .admin-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 18px 0 45px rgba(0,0,0,.2); }
  .sidebar.is-open { transform: translateX(0); }
  .close-menu, .menu-button { display: grid; }
  .close-menu { margin-left: auto; }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 15; border: 0; background: rgba(15,17,18,.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-scrim.is-open { opacity: 1; pointer-events: auto; }
  .workspace { min-height: 100vh; }
  .topbar { height: 66px; padding: 0 17px; }
  .topbar h1 { font-size: 17px; }
  .topbar .eyebrow { display: none; }
  .workspace-content { padding: 22px 17px 36px; }
  .metrics-grid { gap: 9px; }
  .metric { min-height: 120px; padding: 15px; }
  .metric strong { font-size: 30px; }
  /* The heading row is title + controls + count; at this width they have to
     stack instead of pushing the search button off the right edge. */
  .welcome-row, .section-heading { flex-wrap: wrap; align-items: start; }
  .node-search { width: 100%; }
  .node-search input { flex: 1 1 auto; width: auto; min-width: 0; }
}
