/* Along admin — one neutral charcoal palette, restrained gold actions. */
:root, body.embed {
  color-scheme: dark;
  --bg: #121212;
  --card: #1b1b1b;
  --card2: #222222;
  --hover: #292929;
  --input: #161616;
  --line: #333333;
  --line-strong: #494949;
  --txt: #ededed;
  --muted: #a0a0a0;
  --dim: var(--muted);
  --gold: #738fd1;
  --gold-hover: #89a2de;
  --gold-soft: #1e232d;
  --gold-line: #384663;
  --purple: var(--gold);
  --acc: var(--gold);
  --acc2: var(--gold-hover);
  --ok: #83c8a2;
  --green: var(--ok);
  --success-soft: #202e26;
  --warn: #819ed9;
  --amber: var(--warn);
  --warning-soft: #1e2431;
  --err: #e69b95;
  --red: var(--err);
  --danger-soft: #322322;
  --shadow: none;
  --overlay: #0009;
  --elevation: 0 18px 60px #0006;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
html, body { margin: 0; }
body, body.embed { background: var(--bg) !important; color: var(--txt) !important; font-family: 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif; font-size: 14px; line-height: 1.65; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; font-weight: 500; box-shadow: none !important; transform: none !important; filter: none !important; transition: background .15s, border-color .15s, color .15s; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible, [role=button]:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.hidden, [hidden] { display: none !important; }
h1, h2, h3, h4 { color: var(--txt); font-weight: 600; letter-spacing: -.3px; }
a { color: var(--gold); text-underline-offset: 3px; }
.muted, .dim, .ov-sub { color: var(--muted) !important; }
.mono { color: var(--muted) !important; font-family: 'Cascadia Code', Consolas, monospace; font-size: 12px; word-break: break-all; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea, body.embed input:not([type=checkbox]):not([type=radio]), body.embed select, body.embed textarea {
  background: var(--input) !important; color: var(--txt) !important; border: 1px solid var(--line-strong) !important; border-radius: 7px; padding: 9px 11px; min-height: 38px; min-width: 0; max-width: 100%; font-size: 13px; outline: none; box-shadow: none;
}
input::placeholder, textarea::placeholder { color: var(--muted) !important; opacity: .8; }
input:focus, select:focus, textarea:focus { border-color: var(--gold) !important; box-shadow: 0 0 0 2px var(--gold-soft) !important; }
input[type=checkbox], input[type=radio] { accent-color: var(--gold); min-width: 0; }
input[type=date] { min-width: 138px; padding-right: 29px; }
select { appearance: auto; background-image: none !important; padding-right: 8px !important; }
textarea { line-height: 1.8; resize: vertical; }
.field, .cfg-field { min-width: 0; }
.field label, .cfg-field label, .form-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 7px; }
.field input, .field select, .field textarea, .cfg-field input:not([type=checkbox]), .cfg-field select, .cfg-field textarea { width: 100%; }
.btn, button:not(.nav-btn):not(.console-search):not(.command-item):not(.quick-link):not(.queue-row):not(.metric-button):not(.stat-filter):not(.sort-button), body.embed button:not(.tab) {
  background: var(--card2); color: var(--txt); border: 1px solid var(--line-strong); border-radius: 7px; min-height: 36px; padding: 7px 13px; font-size: 13px;
}
.btn:hover, button:hover, body.embed button:hover { background: var(--hover); border-color: var(--muted); }
.btn.ghost, button.ghost, body.embed button.ghost { background: var(--card) !important; color: var(--txt) !important; border: 1px solid var(--line-strong) !important; }
.btn.ghost:hover, button.ghost:hover, body.embed button.ghost:hover { background: var(--hover) !important; border-color: var(--muted) !important; }
.btn.primary, button.primary, body.embed button.primary { background: var(--gold) !important; color: var(--bg) !important; border: 1px solid var(--gold) !important; font-weight: 600; }
.btn.primary:hover, button.primary:hover, body.embed button.primary:hover { background: var(--gold-hover) !important; border-color: var(--gold-hover) !important; }
.btn.danger, button.danger, body.embed button.danger { background: var(--danger-soft) !important; color: var(--err) !important; border: 1px solid var(--danger-soft) !important; }
.btn.warn, button.warn, body.embed button.warn { background: var(--warning-soft) !important; color: var(--warn) !important; border: 1px solid var(--warning-soft) !important; }
.small, body.embed button.small { padding: 4px 9px !important; min-height: 28px; font-size: 12px !important; }
.icon-button { width: 32px; height: 32px; min-height: 32px; display: grid; place-items: center; padding: 6px !important; }
.icon-button svg { width: 17px; height: 17px; }
.msg { color: var(--muted); font-size: 12px; line-height: 1.8; min-height: 0; margin: 8px 0; overflow-wrap: anywhere; }
.msg:empty { margin: 0; }
.msg.err, .cp-error { color: var(--err) !important; }
.msg.ok { color: var(--ok) !important; }

/* Navigation and application shell. */
.app { display: flex; height: 100dvh; overflow: hidden; }
.sidebar { width: 224px; flex-shrink: 0; display: flex; flex-direction: column; padding: 23px 12px 14px; overflow-y: auto; background: var(--bg); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 26px; }
.brand-icon { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; background: transparent; border: 0; flex-shrink: 0; box-shadow: none; }
.brand-icon img, .login-signature img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.brand b { color: var(--txt); font-size: 15px; font-weight: 600; }
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .5px; margin-top: 2px; }
.nav-group { margin-bottom: 11px; }
.nav-label { color: var(--muted); font-size: 11px; font-weight: 400; padding: 9px 12px 6px; }
.nav-btn { width: 100%; display: flex; align-items: center; gap: 11px; text-align: left; padding: 8px 12px; min-height: 37px; margin: 3px 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 400; font-size: 13px; }
.nav-btn:hover { background: var(--card2); color: var(--txt); border-color: transparent; }
.nav-btn.active { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); }
.nav-ico { width: 19px; height: 20px; flex-shrink: 0; display: grid; place-items: center; color: inherit; }
.nav-ico svg { width: 18px; height: 18px; }
.nav-count { margin-left: auto; border-radius: 4px; padding: 0 5px; min-width: 20px; background: var(--gold-soft); color: var(--gold); text-align: center; font-size: 11px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar-account { display: flex; gap: 10px; align-items: center; padding: 6px 8px; margin-bottom: 6px; }
.account-avatar { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--card2); color: var(--txt); font-size: 12px; }
.sidebar-account b { display: block; font-size: 12px; font-weight: 500; color: var(--txt); }
.sidebar-account small { display: block; color: var(--muted); font-size: 10px; }
.sidebar-foot .nav-btn { font-size: 12px; }
.sidebar-footer-line { padding: 10px 8px 0; color: var(--muted); font-size: 9px; letter-spacing: .5px; }
.work { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 28px; flex-shrink: 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-heading, .top-actions, .breadcrumb { display: flex; align-items: center; gap: 12px; min-width: 0; }
.breadcrumb { gap: 13px; font-size: 12px; }
.breadcrumb-root, .breadcrumb-separator { color: var(--muted); }
.crumb { color: var(--txt); font-size: 12px; font-weight: 500; white-space: nowrap; }
.console-search { width: 238px; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px; text-align: left; background: var(--card); color: var(--muted); font-size: 12px; }
.console-search .nav-ico svg { width: 15px; height: 15px; }
.console-search kbd { margin-left: auto; padding: 1px 4px; border: 1px solid var(--line-strong); border-radius: 4px; font: 10px 'Segoe UI', sans-serif; color: var(--muted); }
.top-actions .btn { font-size: 12px; min-height: 32px; padding: 5px 10px; }
.top-actions .status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.status:before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.status[data-state=loading]:before { background: var(--warn); }
.status[data-state=error]:before { background: var(--err); }
.content { flex: 1; min-height: 0; overflow: auto; background: var(--bg); padding: 25px 28px 28px; }
.panel { display: none; height: auto; min-height: 100%; }
.panel.active { display: block; }
#panel-frame { height: 100%; min-height: 0; }
.frame-wrap { height: 100%; position: relative; background: var(--bg); }
.frame-wrap iframe, #adminFrame { display: block; width: 100%; height: 100%; border: 0; background: var(--bg) !important; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--muted); z-index: 2; }
.loading:before { content: ''; position: absolute; top: calc(50% - 45px); width: 25px; height: 25px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Overview: one title, four metrics, orders and a small action rail. */
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.welcome h2 { font-size: 26px; font-weight: 600; margin: 0 0 6px; }
.welcome p { color: var(--muted); font-size: 12px; margin: 0; }
.overview-kicker { color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.primary-actions { display: flex; gap: 9px; align-items: center; }
.primary-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; }
.primary-actions svg { width: 16px; height: 16px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.card { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 20px; box-shadow: none; }
.cards > .card { padding: 19px 20px; position: relative; min-height: 126px; }
.cards > .card > span { color: var(--muted); font-size: 12px; }
.cards > .card > b { display: block; margin-top: 6px; color: var(--txt); font-size: 31px; line-height: 1.3; font-weight: 600; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.cards > .card.needs-attention { border-color: var(--gold-line); background: var(--card); }
.cards > .card.needs-attention > b { color: var(--gold); }
.metric-icon { position: absolute; right: 18px; top: 18px; color: var(--muted); }
.metric-icon svg { width: 18px; height: 18px; }
.needs-attention .metric-icon { color: var(--gold); }
.ov-sub { display: block; font-size: 10px; margin-top: 8px; }
.metric-button { position: absolute; right: 14px; bottom: 12px; background: transparent; border: 0; color: var(--muted); font-size: 16px; padding: 2px 5px; }
.metric-button:hover { background: var(--hover); color: var(--gold); border-radius: 4px; }
.overview-layout { display: grid; grid-template-columns: minmax(0,1fr) 284px; gap: 18px; align-items: start; }
.console-panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.console-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.console-panel-head h3 { color: var(--txt); font-size: 15px; margin: 0; font-weight: 600; }
.console-panel-head span, .console-panel-head a { font-size: 11px; color: var(--muted); }
.console-panel-head a { text-decoration: none; }
.console-panel-head a:hover { color: var(--gold); }
.overview-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 15px; }
.overview-tabs button { min-height: 30px; padding: 4px 10px; background: var(--card) !important; border-color: var(--line) !important; color: var(--muted) !important; font-size: 11px; }
.overview-tabs button.active { color: var(--gold) !important; border-color: var(--gold-line) !important; background: var(--gold-soft) !important; }
.overview-tabs b { font-size: 10px; margin-left: 5px; font-weight: 400; }
.overview-orders .table-scroll { background: transparent; border: 0; border-radius: 0; max-height: none; }
.overview-orders table { font-size: 12px; }
.overview-orders table th { padding: 9px 10px !important; font-size: 11px; }
.overview-orders table td { padding: 12px 10px !important; font-size: 12px; }
.overview-orders td small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.overview-orders th:last-child, .overview-orders td:last-child { position: static; box-shadow: none; }
.overview-side { display: grid; gap: 18px; }
.queue-row { width: 100%; display: flex; align-items: center; gap: 11px; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--txt); text-align: left; padding: 13px 0; }
.queue-row:last-child { border: 0; }
.queue-row:hover { background: transparent; color: var(--gold); }
.queue-dot { width: 5px; height: 5px; background: var(--gold); border-radius: 50%; flex-shrink: 0; }
.queue-row:last-child .queue-dot { background: var(--muted); }
.queue-row div { flex: 1; }
.queue-row b { display: block; font-size: 12px; font-weight: 500; }
.queue-row small { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
.queue-row strong { color: var(--gold); font-size: 22px; font-weight: 500; }
.queue-row:last-child strong { color: var(--txt); }
.queue-row > span:last-child { color: var(--muted); }
.quick-links { display: grid; gap: 0; }
.quick-link { display: flex; gap: 11px; align-items: center; padding: 11px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--txt); text-align: left; font-size: 12px; }
.quick-link:last-child { border: 0; }
.quick-link:hover { background: transparent; color: var(--gold); }
.quick-link svg { width: 17px; height: 17px; color: var(--muted); }
.quick-link small { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
.quick-link:after { content: '›'; margin-left: auto; color: var(--muted); font-size: 18px; }
.console-note { color: var(--muted); font-size: 10px; line-height: 1.9; margin: 16px 0 0; }
.overview-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 13px; margin-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.overview-footer button { font-size: 11px; min-height: 29px; padding: 4px 9px; }
.overview-bottom-line { display: flex; align-items: center; gap: 7px; margin-top: 18px; color: var(--muted); font-size: 10px; }
.overview-bottom-line svg { width: 12px; height: 12px; }
.overview-sync-error { color: var(--err); font-size: 12px; margin: 8px 0; }

/* Module headers and continuous list surfaces. */
.section-head, .module-heading, .pricing-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 22px; }
.section-head h2, .module-heading h2, .pricing-header h2 { color: var(--txt); font-size: 23px; font-weight: 600; margin: 0 0 5px; }
.section-head p, .module-heading p, .pricing-header p { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 0; max-width: 720px; }
.module-label, .pricing-tag { display: none; }
.heading-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.grid2, .grid, .grid3 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.grid3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grid2 > *, .grid > * { min-width: 0; }
.toolbar, .row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.row label { color: var(--muted); font-size: 12px; }
.list-surface { background: var(--card); border: 1px solid var(--line); border-radius: 9px; min-width: 0; overflow: hidden; }
.console-filter, .account-toolbar { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px !important; margin: 0 0 14px !important; }
.account-toolbar .console-filter { margin: 0 !important; border: 0; padding: 0 !important; }
.list-surface > .console-filter, .list-surface > .account-toolbar { margin: 0 !important; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.console-filter input[type=date] { width: 140px; flex: 0 0 auto; }
.console-filter .search-input { width: 200px; min-width: 140px; }
.console-filter > label, .console-filter > span { color: var(--muted); font-size: 11px; }
.filter-reset { min-height: 30px !important; padding: 5px 9px !important; font-size: 11px !important; }
.filter-more { margin-left: auto; }
.date-filter { border: 0; margin: 0; padding: 0; }
.date-filter > summary { display: none; }
.date-filter-fields { display: flex; align-items: center; gap: 9px; }
.date-filter-fields > label { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 11px; color: var(--muted); }
.date-filter-fields > label > span { font-size: 11px; white-space: nowrap; }
.stats, .compact-stats, #codeStats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 0 0 18px; }
.stat { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; min-width: 0; padding: 13px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.stat b, body.embed .stat b { color: var(--txt) !important; font-size: 24px; font-weight: 600; line-height: 1.3; }
.stat span, body.embed .stat span { color: var(--muted) !important; font-size: 12px; }
.metric-strip.stats, .metric-strip.compact-stats, .metric-strip#codeStats { gap: 0; margin: 0 !important; border-bottom: 1px solid var(--line); }
.metric-strip > .card, .metric-strip > .stat { position: relative; display: flex; align-items: center; justify-content: space-between; flex-direction: row; gap: 10px; min-height: 67px; padding: 16px 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: var(--card); box-shadow: none; cursor: pointer; }
.metric-strip > :last-child { border-right: 0; }
.metric-strip > .card > b, .metric-strip > .stat > b { font-size: 24px; margin: 0; color: var(--txt); line-height: 1.3; }
.metric-strip > .stat > b { order: 2; }
.metric-strip > .card > span, .metric-strip > .stat > span { font-size: 12px; color: var(--muted); }
.metric-strip > .selected { background: var(--gold-soft) !important; }
.metric-strip > .selected:after { content: ''; position: absolute; bottom: 0; left: 18px; right: 18px; height: 2px; background: var(--gold); }
.metric-strip > .selected > span, .metric-strip > .selected > b { color: var(--gold) !important; }
.metric-strip > :hover { background: var(--hover); }
.stat-filter { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 0; background: transparent; color: inherit; border: 0; text-align: inherit; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 1.7; text-align: left; }
table th, body.embed table th { position: sticky; top: 0; z-index: 1; padding: 11px 13px !important; background: var(--card2) !important; color: var(--muted) !important; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; white-space: nowrap; }
td { padding: 11px 13px !important; background: var(--card); color: var(--txt); border-bottom: 1px solid var(--line) !important; vertical-align: middle !important; font-size: 12px; }
td b { color: var(--txt); font-size: 12px; font-weight: 600; }
tr:hover td, body.embed tr:hover td { background: var(--card2) !important; }
tbody tr:last-child td { border-bottom: 0 !important; }
table td small { font-size: 10px; color: var(--muted); }
.table-scroll, .table-wrap { width: 100%; overflow: auto; max-height: calc(100dvh - 310px); border: 1px solid var(--line); border-radius: 8px; background: var(--card); overscroll-behavior: contain; }
.list-surface > .table-scroll, .list-surface > .table-wrap { border: 0; border-radius: 0; max-height: calc(100dvh - 330px); }
.table-wrap > .table-scroll { border: 0; max-height: none; }
th:last-child, td:last-child { position: sticky; right: 0; background: var(--card); z-index: 1; box-shadow: -1px 0 var(--line); }
th:last-child { z-index: 2; }
table .mono { font-size: 11px; max-width: 170px; overflow-wrap: anywhere; }
#clientTbody td:nth-child(7) { max-width: 150px; }
#clientTbody td:nth-child(8), #formalClientBody td:nth-child(5), #formalClientBody td:nth-child(6) { white-space: nowrap; font-size: 10px; color: var(--muted); }
#clientTbody td:last-child { min-width: 128px; }
#formalClientBody .mono { max-width: 150px; display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
#ordersBody td { min-width: 95px; }
#ordersBody td:last-child { min-width: 138px; }
#ordersBody td:first-child { min-width: 168px; }
#ordersBody td:nth-child(3) { max-width: 160px; min-width: 105px; }
#ordersBody td:nth-child(5) { overflow-wrap: anywhere; max-width: 180px; font-size: 11px; }
.order-contact { color: var(--muted); font-size: 10px; line-height: 1.7; max-width: 165px; overflow-wrap: anywhere; margin-top: 4px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge, body.embed .badge { display: inline-block; background: var(--card2) !important; color: var(--muted) !important; border: 1px solid var(--line); padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 400; white-space: nowrap; }
.badge.ok, .badge.done, .badge.completed, .badge.b-ok, body.embed .badge.completed, body.embed .badge.b-ok { background: var(--success-soft) !important; color: var(--ok) !important; border-color: var(--success-soft); }
.badge.pending, .badge.review, .badge.confirmed, .badge.payment_confirmed, body.embed .badge.review, body.embed .badge.confirmed { background: var(--warning-soft) !important; color: var(--warn) !important; border-color: var(--warning-soft); }
.badge.rev, .badge.rejected, .badge.refunded, .badge.b-rev, body.embed .badge.b-rev { background: var(--danger-soft) !important; color: var(--err) !important; border-color: var(--danger-soft); }
.empty { color: var(--muted) !important; text-align: center; padding: 32px !important; }
.table-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
.table-footer .pagination { display: flex; align-items: center; gap: 7px; }
.table-footer select { min-height: 29px; padding: 4px 8px; font-size: 11px; }
.table-footer button { min-height: 29px; padding: 4px 9px; font-size: 11px; }
button.sort-button, body.embed button.sort-button { display: flex; align-items: center; gap: 6px; padding: 0 !important; min-height: 0; color: inherit !important; background: transparent !important; border: 0 !important; box-shadow: none; font-weight: 500; font-size: 12px !important; }
.sort-button:after { content: '↕'; color: var(--muted); font-size: 10px; opacity: .6; }
.sort-button[aria-sort=ascending]:after { content: '↑'; color: var(--gold); opacity: 1; }
.sort-button[aria-sort=descending]:after { content: '↓'; color: var(--gold); opacity: 1; }
.row-more { min-height: 28px; padding: 4px 9px; font-size: 12px; }
.row-more svg { width: 13px; height: 13px; vertical-align: middle; margin-left: 3px; }
.row-menu { position: fixed; width: 185px; margin: 0; max-height: 80vh; overflow: auto; padding: 6px; background: var(--card2); color: var(--txt); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--elevation); }
.row-menu::backdrop { background: transparent; }
.row-menu button { display: block; width: 100%; margin: 2px 0; min-height: 34px; text-align: left; font-size: 12px; background: transparent !important; border: 0 !important; color: var(--txt) !important; }
.row-menu button:hover { background: var(--hover) !important; }
.row-menu button.danger { color: var(--err) !important; }

/* Embedded modules, settings and the existing plan editor. */
body.embed { padding: 0 !important; }
body.embed .top, body.embed .tabs { display: none !important; }
body.embed .wrap { max-width: none; }
body.embed #mainBox, body.embed #mainBox > .box { background: transparent; border: 0; border-radius: 0; padding: 0; box-shadow: none; margin: 0; }
body.embed .box { background: var(--card); color: var(--txt); border-color: var(--line); border-radius: 9px; }
body.embed .card { background: var(--card); border-color: var(--line); border-radius: 9px; padding: 20px; }
.card h4, body.embed .card h4 { color: var(--txt); font-size: 15px; font-weight: 600; margin: 0 0 16px; }
.cfg-field { margin-bottom: 12px; }
.quota-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap: 12px; }
.quota-item { min-width: 0; padding: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 7px; }
.quota-item label { color: var(--muted); font-size: 12px; }
.quota-item label > .dim { display: none; }
.quota-item input { width: 100%; margin-top: 5px; }
.quota-tag { color: var(--gold); border-color: var(--gold-line); }
.quota-guide { font-size: 11px !important; line-height: 1.9; }
.quota-inheritance { color: var(--muted); font-size: 10px; }
.quota-search { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.quota-search input { min-width: 200px; }
.quota-search span { color: var(--muted); font-size: 11px; }
.limit-toggle-box, .limit-toggle-head { color: var(--muted); background: var(--card2); border-color: var(--line); }
.slider { background: var(--line-strong); }
input:checked + .slider { background: var(--gold); }
.advanced-settings { padding: 14px 16px; margin: 16px 0; border: 1px solid var(--line); border-radius: 7px; background: var(--card2); }
.advanced-settings summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.advanced-settings .grid2 { margin-top: 16px; }
.save-bar { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-top: 18px; }
.save-bar span { color: var(--muted); font-size: 11px; }
.save-bar button { margin-left: auto; }
.console-payment-group { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 20px; margin-bottom: 16px; }
.qr-preview { background: #fff; border: 1px solid var(--line); padding: 7px; border-radius: 7px; }
.pricing-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 13px 16px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.pricing-actions .msg { flex: 1; margin: 0; font-size: 12px; }
.pricing-actions > div { display: flex; gap: 7px; flex-wrap: wrap; }
.pricing-actions button { margin: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 15px; }
.plan, body.embed .plan { background: var(--card) !important; border-color: var(--line) !important; border-radius: 9px; padding: 22px; min-width: 0; }
.plan h4 { color: var(--txt); font-size: 18px; }
.plan .price, body.embed .price { color: var(--gold) !important; font-size: 30px; font-weight: 600; }
.cp-kind, .cp-meta, .cp-description, .cp-benefits, .plan .dim { color: var(--muted); font-size: 12px; line-height: 1.8; }
.cp-state { color: var(--muted); border-color: var(--line-strong); font-size: 10px; }
.cp-badge { color: var(--gold); }
.cp-actions { border-color: var(--line); }
.cp-danger { color: var(--err) !important; }
.plan.custom-plan { position: relative; padding: 20px !important; }
.plan.custom-plan h4 { margin: 10px 0 3px; }
.cp-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: 12px 0; }
.cp-benefits { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; max-height: 5.4em; margin: 10px 0; }
.plan.custom-plan .cp-actions { justify-content: space-between; padding-top: 13px; }
.plan-more { position: relative; }
.plan-more > summary { display: flex; align-items: center; gap: 7px; padding: 7px 10px; min-height: 36px; border: 1px solid var(--line-strong); border-radius: 7px; list-style: none; color: var(--txt); font-size: 12px; cursor: pointer; }
.plan-more > summary::-webkit-details-marker { display: none; }
.plan-more svg { width: 13px; height: 13px; }
.plan-more-items { position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 4; width: 140px; padding: 6px; background: var(--card2); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--elevation); }
.plan-more-items button { display: block; width: 100%; padding: 8px 10px; text-align: left; background: transparent !important; border: 0 !important; }
.plan-more-items button:hover { background: var(--hover) !important; }
.cp-empty { color: var(--muted); background: var(--card); border-color: var(--line-strong); }
.cp-editor { color: var(--txt); background: var(--card); border-color: var(--line-strong); box-shadow: var(--elevation); }
.cp-editor form { padding: 24px; }
.cp-editor-footer { background: var(--card); border-color: var(--line); }
.cp-editor .cp-note { color: var(--muted); background: var(--card2); font-size: 12px; }
.cp-editor details { border-color: var(--line); }
.cp-field { color: var(--muted); }
.cp-editor small { color: var(--muted); font-size: 11px; }
.cp-subheading { color: var(--txt); }
.cp-editor::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }

/* Drawers, dialogs and login share the same surfaces. */
.modal { background: var(--overlay); backdrop-filter: blur(2px); z-index: 1000; }
.modal-card, .modal .box, body.embed .modal .box { background: var(--card) !important; color: var(--txt) !important; border: 1px solid var(--line-strong); border-radius: 12px; padding: 24px; max-height: 90dvh; overflow: auto; box-shadow: var(--elevation); }
.modal h3 { font-size: 19px; margin: 0 0 20px; }
.modal-actions { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 17px; gap: 9px; }
#usageBox, #credBox, #editBox, #reviewBox { background: var(--card); color: var(--txt); border: 1px solid var(--line-strong); border-radius: 12px; padding: 24px !important; max-height: 90dvh !important; overflow: auto !important; box-shadow: 0 0 0 100vmax var(--overlay), var(--elevation); }
#usageBox h4, #credBox h4, #editBox h4 { color: var(--txt); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 2200; padding: 12px 17px; background: var(--card2); color: var(--txt); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--elevation); font-size: 13px; }
.ops-drawer { inset: 0 0 0 auto; margin: 0; width: 480px; max-width: 100vw; height: 100dvh; max-height: 100dvh; padding: 0; border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; background: var(--card); color: var(--txt); box-shadow: var(--elevation); }
.ops-drawer::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.drawer-heading h3 { color: var(--txt); margin: 0; font-size: 19px; }
.drawer-heading button { min-height: 30px; padding: 1px 9px; font-size: 21px; color: var(--muted); }
.drawer-content { padding: 22px 24px; }
.drawer-content > .card { background: transparent; border: 0; padding: 0 !important; box-shadow: none; }
.drawer-content .grid3, .drawer-content .grid2 { grid-template-columns: 1fr; }
.drawer-content .row { display: block; }
.drawer-content .row > label { display: block; margin: 13px 0 7px; }
.drawer-content .row > input { width: 100% !important; margin-bottom: 6px; }
.drawer-content .row > button { margin: 17px 8px 0 0; }
.drawer-content .toolbar { margin-top: 18px; gap: 10px; }
.drawer-content .msg { overflow-wrap: anywhere; font-size: 12px; }
.drawer-content h4 { color: var(--muted); font-size: 14px; margin-bottom: 15px; }
.drawer-content p, .drawer-content .dim { font-size: 12px; line-height: 1.9; }
.drawer-content .quota-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.drawer-content #codeGenMsg .mono { white-space: pre-wrap; }
.copy-generated { display: block; margin-top: 12px; }
.login { display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: var(--bg) !important; }
.login-card { width: 440px; max-width: 100%; padding: 34px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--elevation); }
.login-signature { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; }
.login-signature > span { display: block; width: 36px; height: 36px; padding: 0; background: transparent; border: 0; }
.login-signature b { color: var(--txt); font-size: 14px; font-weight: 500; }
.login-card .tag { display: inline-block; color: var(--gold); background: var(--gold-soft); border-radius: 4px; padding: 4px 8px; font-size: 10px; letter-spacing: .8px; }
.login-card h1 { color: var(--txt); font-size: 26px; margin: 17px 0 10px; font-weight: 600; }
.login-card p { color: var(--muted); font-size: 12px; line-height: 1.9; margin-bottom: 25px; }
.login-card .btn { min-height: 42px; margin-top: 12px; }
.login-footnote { color: var(--muted); font-size: 10px; text-align: center; margin-top: 19px; }
.console-command { width: 570px; max-width: calc(100vw - 30px); max-height: 80dvh; padding: 20px; background: var(--card); color: var(--txt); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--elevation); }
.console-command::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.console-command label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.console-command input { width: 100%; font-size: 14px !important; }
.command-results { display: grid; gap: 4px; margin-top: 14px; max-height: 50dvh; overflow: auto; }
.command-item { display: flex; align-items: center; gap: 11px; text-align: left; padding: 11px 12px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--txt); font-size: 13px; }
.command-item:hover, .command-item:focus { background: var(--gold-soft); border-color: var(--gold-line); outline: none; }
.command-item svg { width: 17px; height: 17px; color: var(--muted); }
.command-item small { margin-left: auto; color: var(--muted); font-size: 10px; }
.command-hint { color: var(--muted); font-size: 10px; margin: 14px 0 0; }

/* Responsive navigation and list density. */
body.compact td, body.embed.compact td { padding: 7px 11px !important; }
body.compact .card { padding: 15px; }
body.compact .table-footer { padding-top: 9px; padding-bottom: 9px; }
.sidebar-backdrop { display: none; }
.sidebar-collapsed .sidebar { width: 68px; padding: 23px 9px; }
.sidebar-collapsed .brand { padding: 0 0 26px; justify-content: center; }
.sidebar-collapsed .brand > div:last-child, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-btn > span:not(.nav-ico), .sidebar-collapsed .sidebar-account > div, .sidebar-collapsed .sidebar-footer-line { display: none; }
.sidebar-collapsed .nav-btn { justify-content: center; padding: 10px 0; }
.sidebar-collapsed .nav-group { margin-bottom: 12px; }
.sidebar-collapsed .sidebar-account { justify-content: center; padding: 8px 0; }
@media (min-width:1700px) {
  .content { padding: 30px 40px; }
  .topbar { padding: 0 40px; }
  .overview-layout { grid-template-columns: minmax(0,1fr) 320px; }
  .sidebar { width: 238px; }
  .nav-btn { min-height: 40px; }
}
@media (max-width:1190px) {
  .sidebar { width: 208px; padding-left: 10px; padding-right: 10px; }
  .brand { padding-left: 5px; gap: 9px; }
  .brand b { font-size: 14px; }
  .content { padding: 22px; }
  .topbar { padding: 0 22px; }
  .console-search { width: 185px; }
  .top-actions .status { display: none; }
  .overview-layout { grid-template-columns: minmax(0,1fr) 252px; }
  .console-panel { padding: 17px; }
  .cards { gap: 11px; }
  .metric-strip > .card, .metric-strip > .stat { padding: 15px; }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width:980px) {
  .brand > div { display: block; }
  .brand > .brand-icon { display: grid; }
  .nav-btn span:last-child, .nav-label, .sidebar-foot span { display: initial; }
  .brand, .nav-btn { justify-content: flex-start; }
  .top-actions #densityToggle { display: none; }
  .overview-layout { grid-template-columns: 1fr; }
  .overview-side { grid-template-columns: 1fr 1fr; }
  .metric-icon { display: none; }
  .grid2, .grid { grid-template-columns: 1fr; }
  .primary-actions { flex-wrap: wrap; }
  .breadcrumb-root, .breadcrumb-separator { display: none; }
}
@media (max-width:760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: 232px !important; height: 100dvh; transform: translateX(-100%) !important; transition: transform .2s; }
  .sidebar-open .sidebar { transform: translateX(0) !important; }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: var(--overlay); }
  .sidebar-collapsed .sidebar .brand > div:last-child, .sidebar-collapsed .sidebar .nav-label, .sidebar-collapsed .sidebar .nav-btn > span, .sidebar-collapsed .sidebar .sidebar-account > div { display: initial; }
  .sidebar-collapsed .sidebar .nav-btn { justify-content: flex-start; }
  .sidebar .sidebar-foot { display: block !important; }
  .sidebar .nav-label { display: block !important; }
  .sidebar .sidebar-account { display: flex; }
  .sidebar .nav-btn { display: flex; width: 100%; }
  .sidebar .brand { padding-bottom: 18px; }
  .app { height: 100dvh; min-height: 0; overflow: hidden; }
  .work { width: 100%; }
  .topbar { height: 54px; padding: 0 14px; position: static; }
  .top-heading { gap: 10px; }
  .crumb { font-size: 13px; }
  .top-actions { gap: 7px; }
  .console-search { width: 32px; padding: 6px; justify-content: center; }
  .console-search > span:not(.nav-ico), .console-search kbd { display: none; }
  .top-actions .refresh-button { padding: 5px 8px; font-size: 11px; }
  .content { padding: 20px 14px; overflow: auto; }
  .welcome { flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 19px; }
  .welcome h2 { font-size: 23px; }
  .welcome p { font-size: 11px; }
  .primary-actions { width: 100%; gap: 8px; }
  .primary-actions button { flex: 1; padding: 8px 10px; font-size: 12px; }
  .cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 17px; }
  .cards > .card { padding: 15px; min-height: 115px; }
  .cards > .card > b { font-size: 29px; }
  .overview-layout { gap: 16px; }
  .overview-side { grid-template-columns: 1fr; }
  .console-panel { padding: 16px; }
  .overview-tabs { gap: 5px; }
  .overview-tabs button { padding: 4px 8px; font-size: 10px; }
  .overview-orders table { min-width: 0; }
  .overview-orders thead { display: none; }
  .overview-orders tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 3px; border-bottom: 1px solid var(--line); padding: 12px 0; }
  .overview-orders tbody tr:last-child { border: 0; }
  .overview-orders table td { display: block; padding: 3px 0 !important; border: 0 !important; position: static; background: transparent !important; box-shadow: none; }
  .overview-orders tbody td:first-child { grid-column: 1/-1; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .overview-orders tbody td:first-child .mono { font-size: 10px; }
  .overview-orders tbody td:first-child small { font-size: 9px; }
  .overview-orders tbody td:nth-child(3), .overview-orders tbody td:last-child { text-align: right; }
  .overview-orders table .empty { grid-column: 1/-1; width: 100%; }
  .section-head, .module-heading, .pricing-header { flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
  .section-head h2, .module-heading h2, .pricing-header h2 { font-size: 21px; }
  .section-head p, .module-heading p, .pricing-header p { font-size: 11px; }
  .section-head > .btn { min-height: 34px; font-size: 12px; }
  .stats, .compact-stats, #codeStats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-strip > .card, .metric-strip > .stat { padding: 12px 13px; min-height: 58px; border-bottom: 1px solid var(--line); }
  .metric-strip > :nth-child(2n) { border-right: 0; }
  .metric-strip > :nth-child(n+3) { border-bottom: 0; }
  .metric-strip > .card > b, .metric-strip > .stat > b { font-size: 22px; }
  .metric-strip > .card > span, .metric-strip > .stat > span { font-size: 11px; }
  .console-filter { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: center; gap: 8px; padding: 12px !important; }
  .console-filter > label, .console-filter > span { display: none; }
  .console-filter input.search-input, .console-filter > select { grid-column: 1/-1; width: 100% !important; min-width: 0 !important; }
  .console-filter input[type=date] { width: 100% !important; min-width: 0 !important; }
  .console-filter > button { width: 100%; white-space: nowrap; }
  .console-filter .filter-more { margin-left: 0; }
  .console-filter .date-filter { width: 100%; }
  .date-filter > summary { display: block; list-style: none; background: var(--card); border: 1px solid var(--line-strong); border-radius: 7px; color: var(--txt); padding: 7px 10px; font-size: 12px; text-align: center; cursor: pointer; }
  .date-filter > summary:after { content: '⌄'; margin-left: 6px; }
  .date-filter[open] { grid-column: 1/-1; }
  .date-filter[open] > summary:after { content: '⌃'; }
  .date-filter-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; padding-top: 12px; }
  .date-filter-fields > label { display: grid; gap: 5px; }
  .date-filter-fields > label > span { color: var(--muted); font-size: 11px; }
  .date-filter-fields > button { grid-column: 1/-1; }
  .table-scroll, .table-wrap, .list-surface > .table-scroll, .list-surface > .table-wrap { max-height: 56dvh; }
  table { min-width: 650px; }
  #clientTbody td:last-child button { white-space: nowrap; flex-shrink: 0; }
  .table-footer { flex-wrap: wrap; gap: 9px; padding: 11px 12px; }
  .table-footer .pagination { width: 100%; gap: 5px; justify-content: space-between; }
  .table-footer select, .table-footer button { font-size: 10px; padding: 4px 6px; }
  .plans { grid-template-columns: 1fr !important; }
  .pricing-actions { padding: 12px; }
  .pricing-actions .msg { min-width: 100%; font-size: 11px; }
  .pricing-actions > div { width: 100%; }
  .pricing-actions button { flex: 1; min-height: 34px; font-size: 11px; }
  body.embed .card { padding: 16px; }
  .save-bar { padding: 11px 13px; }
  .save-bar span { font-size: 10px; max-width: 145px; }
  .save-bar button { font-size: 12px; }
  .ops-drawer { width: 100%; max-width: 100vw; }
  .drawer-heading, .drawer-content { padding: 19px; }
  .drawer-content table { min-width: 0; }
  .console-command { padding: 18px; }
  .quota-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .quota-item { padding: 10px; }
  .cp-fields { grid-template-columns: 1fr; }
  .cp-editor form { padding: 18px; }
  .cp-option { grid-template-columns: 1fr 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
