/* Shared presentation only. Page forms, permissions and API contracts stay in PHP. */
:root {
    color-scheme: dark;
    --theme-bg: #151109;
    --theme-panel: #1e180f;
    --theme-raised: #282013;
    --theme-line: #514128;
    --theme-accent: #c6a765;
    --theme-accent-bg: #302614;
    --theme-text: #ede4cf;
    --theme-muted: #b3a58a;
    --theme-success: #82ca8b;
    --theme-success-bg: #19291b;
    --theme-warning: #dfbc6b;
    --theme-warning-bg: #332814;
    --theme-danger: #ee9280;
    --theme-danger-bg: #341e18;
    --theme-sidebar: 216px;
    /* Homepage legacy variables now use the shared palette. */
    --ink: var(--theme-text);
    --muted: var(--theme-muted);
    --paper: var(--theme-bg);
    --white: var(--theme-panel);
    --gold: var(--theme-accent);
    --green: var(--theme-success);
    --line: var(--theme-line);
    --night: var(--theme-bg);
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #79613b #19140d; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: #19140d; }
*::-webkit-scrollbar-thumb { background: #79613b; border: 2px solid #19140d; }
html { scroll-padding-top: 90px; }
body { margin: 0; background: var(--theme-bg); color: var(--theme-text); font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; font-size: 14px; line-height: 1.6; }
::selection { background: #75603a; color: #fff5dd; }
a { color: var(--theme-accent); text-underline-offset: 4px; }
a:hover { color: #f1d79f; }
h1, h2, h3, h4 { color: var(--theme-text); overflow-wrap: anywhere; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
input:not([type=hidden]):not([type=checkbox]):not([type=radio]), select, textarea {
    max-width: 100%; min-width: 0; min-height: 40px; padding: 10px 12px;
    background: var(--theme-bg); color: var(--theme-text); border: 1px solid var(--theme-line); border-radius: 0;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #a79779; opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--theme-accent); width: 16px; height: 16px; }
select[multiple] { min-height: 110px; padding: 6px; }
select option { background: var(--theme-panel); color: var(--theme-text); padding: 7px; }
input:autofill { background: var(--theme-bg); color: var(--theme-text); }
input:-webkit-autofill { -webkit-text-fill-color: var(--theme-text); box-shadow: 0 0 0 1000px var(--theme-bg) inset; }
input:focus, select:focus, textarea:focus { border-color: var(--theme-accent); }
:is(a, button, input, select, textarea, summary):focus-visible {
    outline: 2px solid var(--theme-accent); outline-offset: 3px;
}
body :is(.form-group, .application-field, .search-bar) :is(input, select, textarea):focus {
    outline: 2px solid var(--theme-accent); outline-offset: 2px; box-shadow: none;
}
button, .btn, .btn-action, .btn-login, .btn-logout, .nav-login {
    min-height: 36px; padding: 8px 14px; background: var(--theme-accent-bg); color: var(--theme-accent);
    border: 1px solid var(--theme-line); border-radius: 0; text-decoration: none; cursor: pointer;
    line-height: 1.5; font-weight: 600; transition: background .15s, border-color .15s;
}
button:hover, .btn:hover, .btn-action:hover, .btn-login:hover, .btn-logout:hover {
    background: #3b2e18; color: #f2dba9; border-color: var(--theme-accent);
}
.btn-primary, .btn-login, .application-submit { border: 1px solid var(--theme-accent); background: var(--theme-accent-bg); color: var(--theme-text); }
.btn-outline, .btn-ghost, .btn-logout { background: transparent; border: 1px solid var(--theme-line); color: var(--theme-accent); }
.btn-danger, button[value=reject] { background: var(--theme-danger-bg); color: var(--theme-danger); border: 1px solid #754239; }
.btn-danger:hover, button[value=reject]:hover { background: #46251c; color: #ffb6a8; border-color: var(--theme-danger); }
.btn-warn, .btn-action.warn { background: var(--theme-warning-bg); color: var(--theme-warning); border: 1px solid #725b31; }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { min-height: 32px; }
.card, .stat-card, .summary-item, .status-item, .strategy-card, .box, .login-box {
    border: 1px solid var(--theme-line); border-radius: 0; background: var(--theme-panel); box-shadow: none;
}
.card { min-width: 0; }
.card-header { padding: 16px 20px; gap: 12px; flex-wrap: wrap; background: #211a10; border-bottom: 1px solid var(--theme-line); }
.card-header h3 { font-size: 15px; letter-spacing: .03em; }
.card-header h3 i { padding: 0; background: transparent; border-radius: 0; color: var(--theme-accent); }
.card-body { min-width: 0; }
.stat-card, .stat-box, .summary-item { padding: 20px; }
.stat-card .value, .stat-box .value, .summary-value, .status-item .value { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .02em; }
.stat-card.flash { border-color: var(--theme-accent); box-shadow: inset 0 0 0 1px var(--theme-accent); }
.badge, .count-badge, .application-badge, .status-badge, .status-tag, .tag {
    border: 1px solid currentColor; border-radius: 0; padding: 3px 8px; font-size: 12px;
    line-height: 1.5; white-space: nowrap;
}
.status-badge i, .status-tag i { font-size: 7px; }
.status-badge.offline { color: var(--theme-muted); background: #262219; }
.alert, .alert-warn, .alert-success, .error-msg, .err, .msg, .notice, .credential-notice, .key-notice, .config-note {
    border-radius: 0; border-left: 3px solid currentColor; padding: 14px 16px; overflow-wrap: anywhere;
}
.theme-auth .msg, .notice { background: var(--theme-accent-bg); color: var(--theme-text); }
.theme-auth .err, .error-msg { background: var(--theme-danger-bg); color: var(--theme-danger); }
.api-key, code, pre { font-family: Consolas, "Courier New", monospace; border-radius: 0; }
.api-key { overflow-wrap: anywhere; }
.table-scroll { min-width: 0; max-width: 100%; overflow: auto; border-top: 0; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; font-size: 13px; border: 0; }
th, td { padding: 12px 16px; border: 0; border-bottom: 1px solid var(--theme-line); text-align: left; }
th, .table-scroll th { background: #282014; color: var(--theme-accent); font-size: 12px; white-space: nowrap; }
td { color: var(--theme-text); }
tr:hover td { background: #292114; }
.empty-state, .empty { color: var(--theme-muted); }
.empty-state i { opacity: .7; }
.pagination, nav.pages, .main > nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagination a, nav.pages a, .main > nav a { display: inline-flex; padding: 6px 12px; border: 1px solid var(--theme-line); text-decoration: none; }
.pages { flex-wrap: wrap; }
.key-row, .secret-row, .topbar-right, .header-actions, .action-group { flex-wrap: wrap; }
.key-row input, .secret-row input { min-width: 130px; }
.form-group, .form-row > *, .fields > *, .search-bar > *, .config-row { min-width: 0; }
.search-bar, .card-header form { flex-wrap: wrap; }
.search-bar input { min-width: min(200px, 100%); }

/* Persistent desktop navigation; mobile control progressively enhanced by theme.js. */
.theme-admin { display: flex; min-height: 100vh; }
.theme-admin .sidebar, .theme-admin > aside, .customer-sidebar {
    position: sticky; top: 0; align-self: flex-start; width: var(--theme-sidebar); flex: 0 0 var(--theme-sidebar);
    height: 100vh; min-height: 0; overflow-y: auto; padding: 0; background: #120f09;
    color: var(--theme-muted); border-right: 1px solid var(--theme-line);
}
.sidebar-header, .theme-admin > aside > h2, .customer-sidebar .sidebar-header {
    margin: 0; padding: 24px 18px; border-bottom: 1px solid var(--theme-line);
}
.sidebar-header h2, .theme-admin > aside > h2 { font-family: Georgia, "Songti SC", "SimSun", serif; font-size: 19px; letter-spacing: .04em; }
.sidebar-header h2 i { color: var(--theme-accent); font-size: 21px; }
.sidebar-nav, .theme-admin > aside > nav, .customer-sidebar nav { display: flex; flex-direction: column; gap: 5px; padding: 18px 10px; }
.nav-item, .theme-admin > aside > nav > a, .customer-sidebar a {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin: 0; font-size: 13px;
    color: var(--theme-muted); border: 1px solid transparent; border-radius: 0; text-decoration: none;
}
.nav-item.active, .theme-admin > aside a.active, .customer-sidebar a.active {
    color: var(--theme-text); background: var(--theme-accent-bg); border-color: var(--theme-accent);
}
.nav-item:hover, .theme-admin > aside a:hover, .customer-sidebar a:hover { color: var(--theme-text); background: var(--theme-raised); }
.nav-item.active i { color: var(--theme-accent); }
.theme-admin .main { flex: 1; min-width: 0; overflow: visible; }
.topbar { min-height: 72px; padding: 16px 24px; gap: 16px; flex-wrap: wrap; background: var(--theme-bg); border-bottom: 1px solid var(--theme-line); }
.page-title { font-size: 20px; }
.topbar-right { gap: 12px; }
.user-badge, .user-info { max-width: 100%; overflow-wrap: anywhere; border: 1px solid var(--theme-line); border-radius: 0; background: var(--theme-panel); font-size: 12px; }
.content { overflow: visible; padding: 24px; gap: 22px; }
.theme-admin > main:not(.main) { padding: 24px; }
.theme-admin > main:not(.main) > h1 { font-size: 22px; margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--theme-line); }
.theme-admin form.fields { margin: 18px 0; }
.theme-admin .summary-grid, .stats-grid, .status-grid { gap: 14px; }
.theme-nav-toggle { display: none; }
.strategy-catalog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.catalog-card { min-width: 0; padding: 18px; border: 1px solid var(--theme-line); background: var(--theme-panel); display: flex; flex-direction: column; gap: 16px; }
.catalog-card:hover { border-color: var(--theme-accent); background: #251d11; }
.catalog-title { display: flex; align-items: center; gap: 10px; }
.catalog-title i { border: 1px solid var(--theme-accent); color: var(--theme-accent); padding: 8px; }
.catalog-title h4 { margin: 0; font-size: 16px; font-family: Georgia, "Songti SC", "SimSun", serif; }
.catalog-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--theme-muted); font-size: 12px; }
.catalog-footer { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }

/* Customer workspace: same frame, strategy cards and a full-width account table. */
.theme-customer { padding-left: var(--theme-sidebar); }
.customer-sidebar { position: fixed; left: 0; z-index: 110; }
.customer-sidebar .sidebar-header { color: var(--theme-text); font-family: Georgia, "Songti SC", "SimSun", serif; font-size: 19px; }
.navbar { display: flex; align-items: center; justify-content: space-between; min-height: 72px; height: auto; padding: 14px 24px; flex-wrap: wrap; gap: 14px; background: var(--theme-bg); box-shadow: none; border-bottom: 1px solid var(--theme-line); z-index: 20; }
.logo { flex-wrap: wrap; }
.logo i { font-size: 22px; padding: 8px; background: transparent; border: 1px solid var(--theme-line); border-radius: 0; }
.logo h1 { font-size: 18px; }
.navbar .brand { color: var(--theme-text); font-size: 18px; font-weight: 600; }
.logo span { border-radius: 0; border: 1px solid var(--theme-line); }
.nav-right { flex-wrap: wrap; gap: 8px; }
.user-info { padding: 5px 10px; }
.theme-customer .container { max-width: 1640px; padding: 24px; }
.theme-customer .grid-2 { grid-template-columns: minmax(0, 1fr); }
.theme-customer .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.theme-customer .welcome { margin-bottom: 22px; }
.theme-customer .welcome h2 { font-size: 23px; }
.strategies-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.strategies-grid > .empty-state { grid-column: 1 / -1; }
.strategy-card, .strategy-card:last-child { margin-bottom: 0; padding: 18px; gap: 16px; }
.strategy-card .top-row { align-items: flex-start; flex-wrap: wrap; gap: 14px; }
.strategy-card .name { font-family: Georgia, "Songti SC", "SimSun", serif; font-size: 17px; overflow-wrap: anywhere; }
.strategy-card .meta { gap: 8px 16px; }
.strategy-card .strategy-actions { margin-top: auto; }
.application-intro { padding-bottom: 16px; border-bottom: 1px solid var(--theme-line); }
.account-add { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.application-footer { padding-top: 18px; }
.theme-customer main:not(.box) { width: 100%; max-width: 1400px; }

/* Authentication reference: restrained framed panel, gold labels, square fields. */
.theme-auth {
    min-height: 100vh; min-height: 100svh; display: flex; justify-content: center; align-items: center;
    padding: 32px 16px; background: radial-gradient(ellipse at 25% 10%, #312513 0, #19130b 42%, #100e09 100%);
}
.theme-auth .box, .theme-auth .login-box { width: min(100%, 500px); padding: 34px; border-color: #725a31; background: #1b150d; }
.theme-auth .box::before, .theme-auth .login-box::before {
    content: "EA / LICENSE CENTER"; display: block; padding-bottom: 22px; margin-bottom: 26px;
    border-bottom: 1px solid var(--theme-line); color: var(--theme-accent); font: 11px Georgia, serif; letter-spacing: .3em;
}
.theme-auth h1, .theme-auth h2 { margin: 0 0 10px; font-size: 25px; letter-spacing: .06em; }
.theme-auth .login-logo { text-align: left; margin-bottom: 26px; }
.theme-auth .login-logo > i { display: none; }
.theme-auth .login-logo h1 { margin: 0; }
.theme-auth label, .theme-auth .form-group label { color: var(--theme-accent); font-weight: 500; letter-spacing: .08em; }
.theme-auth input:not([type=hidden]), .theme-auth select { width: 100%; min-height: 46px; border-color: #796239; background: #17120b; padding: 12px; font-size: 15px; }
.theme-auth .btn-login, .theme-auth .submit { width: 100%; min-height: 50px; margin-top: 12px; letter-spacing: .18em; font-size: 17px; }
.theme-auth .btn { border: 1px solid var(--theme-accent); }
.theme-auth .code { grid-template-columns: minmax(0, 1fr) auto; }
.theme-auth .code button { white-space: nowrap; padding: 10px; margin: 0; }
.theme-auth .sub, .theme-auth .box > p, .theme-auth .foot { color: var(--theme-muted); }
.theme-auth form + form { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--theme-line); }
.theme-auth .foot { margin-top: 24px; }

/* Home retains its marketing content and canvas illustration. */
.theme-home .site-header, .theme-home .terminal, .theme-home .terminal-head, .theme-home .strategy-row,
.theme-home .strategy-list, .theme-home .step, .theme-home .steps { border-color: var(--theme-line); }
.theme-home .hero-shade { background: rgba(21, 17, 9, .45); }
.theme-home .terminal { background: #19140c; box-shadow: none; }
.theme-home .metric { background: #211a0f; }
.theme-home .license-summary { background: var(--theme-line); border-color: var(--theme-line); }
.theme-home .brand-mark, .theme-home .nav-login { border-color: var(--theme-accent); }
.theme-home h1, .theme-home h2 { font-family: Georgia, "Songti SC", "SimSun", serif; font-weight: 600; }
.theme-home .btn { border: 1px solid var(--theme-accent); color: var(--theme-text); }
.theme-home .btn-primary { background: var(--theme-accent-bg); }
.theme-home .trust, .theme-home .cta, .theme-home .capabilities { background: var(--theme-panel); }
.theme-home .operations { background: #100e09; }
.theme-home .section-kicker { color: var(--theme-accent); }
.theme-home footer { background: #100e09; border-top: 1px solid var(--theme-line); }
.theme-home .live:before { box-shadow: none; }

/* Dialog visibility and stacking are still controlled by the original page script. */
.modal { background: rgba(8, 6, 3, .82); z-index: 300; }
.modal-dialog { background: var(--theme-panel); border: 1px solid var(--theme-accent); border-radius: 0; box-shadow: 0 20px 70px #0008; }
.modal-head { background: #211a10; border-color: var(--theme-line); }
.modal-body { overflow-wrap: anywhere; }
.icon-btn, .copy-btn { padding: 0; min-height: 30px; border: 1px solid var(--theme-line); }
.copy-btn.done { background: var(--theme-success-bg); color: var(--theme-success); }
.config-value { color: var(--theme-text); }
.config-row { border-color: var(--theme-line); }
.standalone-content { padding: 24px; }
.standalone-content h1 { font-size: 24px; margin: 0; }
.standalone-content > p { margin: 14px 0 24px; }
.standalone-content .table-scroll { border: 1px solid var(--theme-line); margin-top: 20px; background: var(--theme-panel); }

@media (max-width: 1280px) {
    .strategy-catalog, .strategies-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .theme-admin .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    :root { --theme-sidebar: 188px; }
    .stats-grid, .status-grid, .theme-admin .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .theme-customer .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .strategy-catalog, .strategies-grid { grid-template-columns: minmax(0, 1fr); }
    .theme-admin .page-title { font-size: 18px; }
    .content, .theme-customer .container { padding: 18px; }
}
@media (max-width: 760px) {
    .theme-admin { display: block; }
    .theme-customer { padding-left: 0; }
    .theme-admin .sidebar, .theme-admin > aside, .customer-sidebar {
        position: static; width: 100%; height: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--theme-line);
    }
    .sidebar-header, .theme-admin > aside > h2, .customer-sidebar .sidebar-header { padding: 16px; }
    .theme-nav-toggle { display: block; width: 100%; text-align: left; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--theme-line); }
    .theme-nav-ready:not(.theme-nav-open) .sidebar, .theme-nav-ready:not(.theme-nav-open) > aside,
    .theme-nav-ready:not(.theme-nav-open) .customer-sidebar { display: none; }
    .sidebar-nav, .theme-admin > aside > nav, .customer-sidebar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
    .topbar, .navbar { position: static; padding: 16px; }
    .topbar, .nav-right { align-items: flex-start; }
    .content, .theme-customer .container, .theme-admin > main:not(.main), .standalone-content { padding: 16px; }
    .theme-admin .form-row, .account-add, .theme-customer .grid-3, .config-grid { grid-template-columns: minmax(0, 1fr); }
    .card-body, .card-header { padding: 16px; }
    .strategy-catalog { padding: 12px; }
    .application-footer { flex-direction: column; align-items: stretch; }
    .application-submit { justify-content: center; }
    .config-row { grid-template-columns: 90px minmax(0, 1fr) 32px; }
    .config-row:nth-child(odd) { border-right: 0; }
    .modal { padding: 10px; }
    .modal-body { padding: 14px; }
    .modal-dialog { max-height: 92vh; max-height: 92dvh; }
    .theme-auth { padding: 20px 12px; }
    .theme-auth .box, .theme-auth .login-box { padding: 26px 20px; }
    .theme-home .nav-links { background: var(--theme-bg); }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
