:root {
    --bg: #f3f5f2;
    --surface: #ffffff;
    --surface-soft: #f8faf8;
    --ink: #1c2825;
    --muted: #697873;
    --line: #dfe6e1;
    --line-strong: #cbd6d0;
    --brand: #137d68;
    --brand-dark: #0d6353;
    --brand-soft: #e4f3ee;
    --amber: #b96f20;
    --amber-soft: #fff2df;
    --danger: #b94b42;
    --danger-soft: #fceceb;
    --sidebar: #111817;
    --sidebar-muted: #93a39e;
    font-family: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }

.app-frame { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 244px; padding: 24px 16px 18px; display: flex; flex-direction: column; background: var(--sidebar); color: #fff; }
.sidebar-brand { min-height: 44px; display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: #f2b84b; color: #1e211a; font-weight: 900; font-size: 19px; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 17px; line-height: 1.2; }
.sidebar-brand small { margin-top: 3px; color: var(--sidebar-muted); font-size: 11px; }
.side-nav { display: grid; gap: 5px; margin-top: 34px; }
.side-nav a { height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 12px; border-radius: 6px; color: #b9c7c3; text-decoration: none; font-size: 14px; font-weight: 650; }
.side-nav a:hover { background: #1a2522; color: #fff; }
.side-nav a.active { background: #20332e; color: #fff; box-shadow: inset 3px 0 0 #55c5a8; }
.side-nav a.active svg { color: #65d3b6; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid #29332f; display: flex; align-items: center; gap: 8px; }
.user-summary { min-width: 0; display: flex; align-items: center; gap: 10px; flex: 1; }
.user-avatar, .mobile-avatar { display: grid; place-items: center; border-radius: 50%; background: #31423d; color: #e7f4f0; font-weight: 800; }
.user-avatar { width: 34px; height: 34px; }
.user-summary strong, .user-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-summary strong { max-width: 118px; font-size: 13px; }
.user-summary small { color: var(--sidebar-muted); font-size: 11px; }
.logout-link { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; color: var(--sidebar-muted); text-decoration: none; }
.logout-link:hover { background: #2a211f; color: #ef9f94; }
.logout-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.app-workspace { min-height: 100vh; margin-left: 244px; display: flex; flex-direction: column; }
.mobile-bar, .sidebar-backdrop { display: none; }
.page-shell { width: 100%; max-width: 1240px; margin: 0 auto; padding: 42px 38px 72px; flex: 1; }
footer { padding: 18px 32px 28px; color: #88948f; font-size: 12px; text-align: center; }

.page-heading, .hero-row { margin: 0 0 28px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.page-heading h1, .hero-row h1 { margin: 0; font-size: 29px; line-height: 1.25; letter-spacing: 0; }
.page-heading p, .hero-row p { margin: 8px 0 0; }
.eyebrow { margin: 0 0 6px!important; color: var(--brand); font-size: 11px; line-height: 1.2; font-weight: 850; letter-spacing: 1.4px; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 13px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-title h2, .section-title h3 { margin: 0; }
.section-title h2, .section-title h3, .section-title>div { min-width: 0; }

.panel { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 24px rgba(27, 46, 40, .045); }
.panel h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
.panel p { font-size: 13px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; margin: 18px 0 0; font-size: 13px; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; min-width: 0; font-weight: 700; word-break: break-word; }

label { display: grid; gap: 7px; color: #3f4e49; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); }
input, select { min-height: 44px; padding: 10px 12px; }
textarea { min-height: 92px; padding: 11px 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9aa6a2; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(19, 125, 104, .13); border-color: var(--brand); }
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.button { min-height: 42px; padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 6px; cursor: pointer; text-decoration: none; text-align: center; font-size: 13px; font-weight: 800; }
.button.primary { background: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { background: #edf1ef; color: #33433e; }
.button.secondary:hover { background: #e2e8e5; }
.button.small { min-height: 32px; padding: 6px 10px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; }
.button.danger { background: var(--danger-soft); color: var(--danger); }
.icon-button { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.text-link { color: var(--brand); font-size: 13px; font-weight: 750; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.notice { margin: 0 0 20px; padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid; border-radius: 7px; font-size: 13px; white-space: pre-line; }
.notice.success { border-color: #b9ddcf; background: #eaf6f1; color: #17654f; }
.notice.error { border-color: #edc5c1; background: #fff0ef; color: #983d36; }

.status-chip, .status-pill { min-height: 34px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-chip.good, .status-pill.good { background: var(--brand-soft); color: var(--brand-dark); }
.status-chip.bad, .status-pill.bad { background: var(--amber-soft); color: #945512; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.metric-item { min-height: 108px; padding: 20px; border-right: 1px solid var(--line); }
.metric-item:last-child { border-right: 0; }
.metric-item .metric-icon { width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); }
.metric-item:nth-child(3) .metric-icon { background: var(--amber-soft); color: var(--amber); }
.metric-item small, .metric-item strong { display: block; }
.metric-item small { color: var(--muted); font-size: 11px; }
.metric-item strong { margin-top: 4px; overflow: hidden; text-overflow: ellipsis; font-size: 14px; white-space: nowrap; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; margin-top: 18px; }
.activation-panel form { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.activation-panel .button { min-width: 126px; }
.activation-foot { margin-top: 18px; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); font-size: 12px; }
.activation-foot span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.activation-foot strong { text-align: right; }
.quick-links { display: grid; gap: 9px; margin-top: 17px; }
.quick-link { min-height: 54px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); text-decoration: none; }
.quick-link:hover { border-color: #9ecbbf; background: #f2f8f5; }
.quick-link.disabled { cursor: not-allowed; opacity: .62; }
.quick-link.disabled:hover { border-color: var(--line); background: var(--surface-soft); }
.quick-link-icon { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 6px; background: var(--brand-soft); color: var(--brand); }
.quick-link>span:nth-child(2) { min-width: 0; flex: 1; }
.quick-link strong, .quick-link small { display: block; }
.quick-link strong { font-size: 13px; }
.quick-link small { color: var(--muted); font-size: 11px; }
.quick-link>svg:last-child { width: 16px; color: #899691; }
.section-title .text-link, .text-link:has(svg) { display: inline-flex; align-items: center; gap: 5px; }
.announcement-section { margin-top: 18px; }
.announcement-list { margin-top: 12px; }
.announcement-preview { padding: 16px 0; border-top: 1px solid var(--line); }
.announcement-preview:first-child { border-top: 0; }
.announcement-preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.announcement-preview h3 { margin: 0; font-size: 14px; }
.announcement-preview time { color: #8c9894; font-size: 11px; white-space: nowrap; }
.announcement-preview p { margin: 8px 0 0; color: #52615c; white-space: pre-line; }

.download-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.download-card { min-height: 268px; display: flex; flex-direction: column; gap: 14px; }
.download-card-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 7px; background: #edf1ef; color: #43534e; }
.download-card .download-title { display: flex; align-items: flex-start; gap: 12px; }
.download-card .download-title>div { min-width: 0; flex: 1; }
.download-card h2 { overflow-wrap: anywhere; }
.download-description { min-height: 40px; margin: 0; }
.download-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 11px; }
.download-meta span { max-width: 100%; display: inline-flex; align-items: center; gap: 5px; overflow-wrap: anywhere; word-break: break-word; }
.download-card .button { width: 100%; margin-top: auto; }
.access-badge { padding: 4px 8px; display: inline-flex; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 10px; font-weight: 800; white-space: nowrap; }
.empty-state { padding: 56px 24px; text-align: center; }
.empty-state .empty-icon { width: 46px; height: 46px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 8px; background: #edf1ef; color: #687773; }

.announcement-feed { border-top: 1px solid var(--line); }
.announcement-entry { padding: 24px 0; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 28px; border-bottom: 1px solid var(--line); }
.announcement-entry time { color: var(--muted); font-size: 12px; }
.announcement-entry h2 { margin: 0 0 10px; font-size: 18px; }
.announcement-content { color: #43514d; white-space: pre-line; }

.auth-body { min-height: 100vh; background: #eef2ee; }
.auth-topbar { height: 76px; padding: 16px 28px; display: flex; align-items: center; }
.auth-topbar .sidebar-brand { color: var(--ink); }
.auth-topbar .sidebar-brand small { color: var(--muted); }
.auth-page { max-width: 620px; padding-top: 38px; }
.auth-shell { min-height: calc(100vh - 190px); display: grid; place-items: center; }
.auth-panel { width: min(440px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 20px 50px rgba(25, 43, 37, .10); }
.auth-panel.wide { width: min(520px, 100%); }
.auth-panel.center { text-align: center; }
.auth-panel h1 { margin: 0; font-size: 25px; letter-spacing: 0; }
.auth-panel>.muted { margin: 8px 0 0; }
.auth-panel form { display: grid; gap: 15px; margin-top: 24px; }
.auth-panel .button.primary { width: 100%; }
.auth-header-icon { width: 42px; height: 42px; margin-bottom: 18px; display: grid; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.auth-panel.center .auth-header-icon { margin-inline: auto; }
.form-foot { margin: 22px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.form-foot a { color: var(--brand); font-weight: 800; text-decoration: none; }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.code-row .button { min-width: 118px; height: 44px; }
.device-details { margin: 22px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; text-align: left; }
.device-details div { padding: 11px 13px; display: flex; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); font-size: 12px; }
.device-details div:first-child { border-top: 0; }
.device-details span { color: var(--muted); }
.device-details strong { overflow-wrap: anywhere; text-align: right; }
.verify-actions { display: grid; gap: 10px; }
.success-mark { width: 52px; height: 52px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }

.table-panel { margin-top: 18px; }
.table-scroll { overflow: auto; }
table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 800; }
pre { border-radius: 6px; background: #111817; color: #dceae5; }
.resource-editor { box-shadow: none; }
.panel-actions { margin-top: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

@media (max-width: 1020px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-item:nth-child(2) { border-right: 0; }
    .metric-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .dashboard-columns { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(12, 18, 16, .48); }
    .sidebar-open .sidebar-backdrop { display: block; }
    .app-workspace { margin-left: 0; }
    .mobile-bar { height: 60px; padding: 0 16px; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
    .mobile-bar>a { justify-self: center; font-size: 16px; font-weight: 900; text-decoration: none; }
    .mobile-avatar { width: 30px; height: 30px; justify-self: end; font-size: 12px; }
    .page-shell { padding: 28px 18px 56px; }
    .grid.two, .download-grid { grid-template-columns: 1fr; }
    .page-heading, .hero-row { display: block; }
    .page-heading>.button, .hero-row>.button, .page-heading>.status-chip, .hero-row>.status-pill { margin-top: 14px; }
    .announcement-entry { grid-template-columns: 1fr; gap: 7px; }
}

@media (max-width: 560px) {
    .auth-topbar { height: 66px; padding: 13px 18px; }
    .auth-page { padding: 20px 14px 44px; }
    .auth-shell { min-height: calc(100vh - 150px); place-items: start center; }
    .auth-panel, .auth-panel.wide { width: 100%; padding: 23px 20px; }
    .page-heading h1, .hero-row h1 { font-size: 25px; }
    .metric-item { min-height: 96px; padding: 16px; }
    .activation-panel form { grid-template-columns: 1fr; }
    .activation-panel .button { width: 100%; }
    .code-row { grid-template-columns: 1fr; }
    .code-row .button { width: 100%; }
    .announcement-preview-head { display: block; }
    .announcement-preview time { display: block; margin-top: 4px; }
}
