*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #090d18;
  --surface: #121827;
  --surface2: #1a2234;
  --border: #273249;
  --accent: #7c6cff;
  --accent-hover: #6b5be9;
  --text: #eef2ff;
  --text-muted: #96a0b5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 14px;
  --shadow: 0 24px 70px rgba(0,0,0,.3);
}

body {
  background:
    radial-gradient(circle at 18% -5%, rgba(124,108,255,.18), transparent 34rem),
    radial-gradient(circle at 92% 20%, rgba(34,211,238,.08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px 72px; }
.page-center { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

/* Card */
.card {
  background: rgba(18,24,39,.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 1px 0 rgba(255,255,255,.025) inset;
}

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 13px; }
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,108,255,.13); }
.form-control::placeholder { color: var(--text-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form .btn { flex: 0 0 auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: background .2s, opacity .2s, transform .2s, border-color .2s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #8274ff, #6657e8); color: #fff; box-shadow: 0 8px 22px rgba(108,99,255,.2); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #9084ff, #7062ef); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }
.btn-link-danger { background: transparent; color: #fca5a5; padding-left: 4px; padding-right: 4px; }
.btn-link-danger:hover:not(:disabled) { color: #fecaca; background: rgba(239,68,68,.08); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active { background: rgba(34,197,94,.15); color: var(--success); }
.badge-disabled { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-expired { background: rgba(245,158,11,.15); color: var(--warning); }

/* Progress bar */
.progress-wrap { margin-bottom: 12px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px; color: var(--text-muted); }
.progress-bar { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.progress-fill.warn { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }
.reset-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; opacity: 0.8; }

/* Alert */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.alert-info { background: rgba(14,165,233,.1); border: 1px solid rgba(14,165,233,.3); color: #7dd3fc; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: var(--surface2); }
tr:hover td { background: rgba(255,255,255,.02); }
td.mono { font-family: monospace; font-size: 13px; }

/* Navbar */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand { font-weight: 700; font-size: 16px; color: var(--text); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; line-height: 1; }
.modal-message { color: var(--text); font-size: 14px; line-height: 1.7; }
.modal-message.success { color: var(--success); font-weight: 600; }
.modal-intent {
  border: 1px solid rgba(245,158,11,.45);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  background: rgba(245,158,11,.1);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.modal-intent-new {
  border-color: rgba(59,130,246,.45);
  border-left-color: var(--info);
  background: rgba(59,130,246,.1);
}
.modal-intent-renew {
  border-color: rgba(245,158,11,.45);
  border-left-color: var(--warning);
  background: rgba(245,158,11,.1);
}
.modal-intent-label {
  display: inline-block;
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}
.modal-intent-new .modal-intent-label { color: #93c5fd; }
.modal-intent-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}
.modal-intent-desc {
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 6px;
  opacity: .92;
}
.preview-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-top: 12px;
}
.preview-label {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.preview-value {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}
.preview-muted {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 8px;
}
.key-output {
  display: block;
  width: 100%;
  color: var(--text);
  background: rgba(15,17,23,.72);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: normal;
  overflow-wrap: anywhere;
  user-select: all;
}
.key-copy-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.key-copy-row .key-output {
  flex: 1 1 auto;
}
.key-copy-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.key-copy-row .btn.copied {
  background: var(--success);
}

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-right { margin-left: auto; }
.search-input { width: 220px; }

/* Pagination */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; }
.page-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-btn.active { background: var(--accent); border-color: var(--accent); }

/* Batch bar */
.batch-bar {
  display: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 16px;
  margin-bottom: 12px;
  align-items: center;
  gap: 10px;
}
.batch-bar.visible { display: flex; }

/* Quota page specific */
.portal-topbar { position: sticky; top: 0; z-index: 120; border-bottom: 1px solid rgba(39,50,73,.75); background: rgba(9,13,24,.82); backdrop-filter: blur(18px); }
.portal-topbar-inner { max-width: 1120px; height: 66px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.portal-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); }
.portal-brand:hover { text-decoration: none; }
.portal-brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(145deg,#8c7fff,#5f51df); box-shadow: 0 8px 24px rgba(108,99,255,.3); font-size: 17px; font-weight: 900; }
.portal-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.portal-brand strong { font-size: 14px; letter-spacing: .01em; }
.portal-brand small { color: var(--text-muted); font-size: 10px; }
.portal-safe-note { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 11px; }
.portal-safe-note b { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: #86efac; background: rgba(34,197,94,.12); }
.portal-container { padding-top: 0; }
.quota-header { text-align: center; padding: 62px 0 28px; }
.quota-header h1 { max-width: 760px; margin: 10px auto 10px; font-size: clamp(30px, 5vw, 48px); font-weight: 820; letter-spacing: -.05em; line-height: 1.12; }
.quota-header p { max-width: 680px; margin: 0 auto; color: var(--text-muted); font-size: 15px; }
.portal-eyebrow { display: inline-flex; padding: 5px 11px; border: 1px solid rgba(124,108,255,.34); border-radius: 999px; color: #c8c1ff; background: rgba(124,108,255,.1); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.portal-journey { display: inline-flex; align-items: center; gap: 11px; margin-top: 24px; padding: 9px 14px; border: 1px solid rgba(39,50,73,.82); border-radius: 999px; background: rgba(18,24,39,.65); color: var(--text-muted); font-size: 11px; }
.portal-journey span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.portal-journey b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: #d9d5ff; background: rgba(124,108,255,.15); font-size: 10px; }
.portal-journey i { color: #5d6880; font-style: normal; }
.query-card, .entry-card { max-width: 760px; margin-left: auto; margin-right: auto; }
.query-card { box-shadow: var(--shadow); }
.portal-entry-panel { padding: 28px 30px; border-color: rgba(124,108,255,.32); background: linear-gradient(145deg,rgba(24,31,50,.98),rgba(14,19,32,.98)); }
.entry-panel-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 20px; }
.entry-panel-head h2 { font-size: 19px; line-height: 1.35; }
.entry-panel-head p { color: var(--text-muted); font-size: 12px; margin-top: 3px; }
.entry-step { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; color: #c8c1ff; background: rgba(124,108,255,.13); font-size: 10px; font-weight: 750; }
.query-label { display: block; color: var(--text-muted); font-size: 11px; font-weight: 650; margin-bottom: 7px; }
.query-form { gap: 10px; }
.key-input-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.key-input-wrap .form-control { height: 50px; padding-left: 52px; background: rgba(8,12,22,.68); font-family: ui-monospace,SFMono-Regular,Menlo,monospace; }
.key-input-prefix { position: absolute; z-index: 1; top: 50%; left: 13px; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: #c8c1ff; background: rgba(124,108,255,.13); font-size: 11px; font-weight: 800; }
.query-submit { min-width: 124px; justify-content: center; }
.query-helper { display: flex; align-items: center; gap: 6px; margin-top: 11px; color: var(--text-muted); font-size: 10px; }
.entry-redeem-wrap { max-width: 760px; margin: 13px auto 0; }
.entry-redeem-disclosure, .code-tools-card { border: 1px solid rgba(39,50,73,.8); border-radius: 12px; background: rgba(18,24,39,.68); overflow: hidden; }
.entry-redeem-disclosure summary, .code-tools-card summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; cursor: pointer; color: var(--text-muted); font-size: 12px; }
.entry-redeem-disclosure summary::-webkit-details-marker, .code-tools-card summary::-webkit-details-marker { display: none; }
.entry-redeem-disclosure summary b, .code-tools-card summary b { color: var(--text); }
.entry-redeem-disclosure summary small, .code-tools-card summary small { color: #bcb4ff; font-size: 10px; white-space: nowrap; }
.entry-redeem-disclosure[open] summary, .code-tools-card[open] summary { border-bottom: 1px solid rgba(39,50,73,.75); }
.entry-redeem-content, .code-tools-content { padding: 16px; }
.entry-redeem-content > p, .code-tools-content > p { color: var(--text-muted); font-size: 11px; margin-bottom: 12px; }
.entry-card { margin-top: 16px; }
.redeem-card { padding: 20px; }
.redeem-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.redeem-card-title span:first-child {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.redeem-mode-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.35);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
}
.redeem-mode-label {
  flex: 0 0 auto;
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.quota-result { max-width: 1060px; margin: 34px auto 0; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.info-item { background: var(--surface2); border-radius: 6px; padding: 12px 16px; }
.info-item .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.info-item .value { font-size: 15px; font-weight: 600; }
.quota-expire-note { color: var(--text-muted); font-size: 11px; font-weight: 500; margin-left: 4px; white-space: nowrap; }

/* Spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Select */
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892a4' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* Checkbox */
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* Responsive */
@media (max-width: 600px) {
  .info-grid { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
}

/* Toast animations */
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Notification badge & items */
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 50%; min-width: 18px; height: 18px;
  line-height: 18px; text-align: center; padding: 0 4px;
}
.notif-item { transition: background .15s; }
.notif-item:hover { background: var(--surface2); }
.notif-unread { border-left: 3px solid var(--accent); }
.notif-filter { background: transparent; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; }
.notif-filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Editable note styling */
.editable-note {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.2s;
}
.editable-note:hover {
  background: var(--surface2);
}

/* Quota banner */
.quota-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.result-identity-card { position: relative; overflow: hidden; border-color: rgba(124,108,255,.26); background: linear-gradient(135deg,rgba(31,39,62,.98),rgba(17,23,38,.98)); box-shadow: 0 18px 48px rgba(0,0,0,.2); }
.result-identity-card::after { content: ''; position: absolute; right: -60px; top: -90px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle,rgba(124,108,255,.17),transparent 68%); pointer-events: none; }
.result-identity-label { color: var(--text-muted); font-size: 10px; font-weight: 650; letter-spacing: .06em; margin-bottom: 3px; }
.quota-banner-key {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.quota-banner-plan {
  font-size: 14px;
  font-weight: 650;
}
.quota-banner-sep {
  color: var(--text-muted);
  margin: 0 6px;
}

/* Tabs */
.q-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin: 14px 0 0;
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  background: rgba(18,24,39,.9);
}
.q-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  background: none;
  border: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.q-tab:hover { color: var(--text); }
.q-tab.active {
  color: #dedaff;
  border-color: rgba(124,108,255,.28);
  background: rgba(124,108,255,.12);
}

/* Tab panels */
.q-tab-panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 24px;
}
.q-tab-panel.active { display: block; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2 { font-size: 18px; letter-spacing: -.02em; }
.panel-kicker { display: block; color: #aaa2ff; font-size: 10px; font-weight: 750; letter-spacing: .08em; margin-bottom: 3px; }
.panel-timezone { color: var(--text-muted); font-size: 10px; padding-top: 5px; }

/* Quota stat cards */
.quota-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.quota-stat-note { color: var(--text-muted); font-size: 11px; margin-top: 4px; line-height: 1.4; }
.fuel-stat-card { border-color: rgba(245,158,11,.34); background: linear-gradient(135deg, rgba(245,158,11,.08), rgba(26,29,39,.9)); }
.quota-stat-card {
  background: rgba(26,34,52,.86);
  border: 1px solid rgba(39,50,73,.65);
  border-radius: 11px;
  padding: 16px;
  text-align: left;
}
.quota-stat-primary { border-color: rgba(124,108,255,.42); background: linear-gradient(145deg,rgba(124,108,255,.13),rgba(26,34,52,.9)); }
.quota-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.quota-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

/* Quota progress section */
.quota-progress-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.quota-progress-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 0 10px; }
.quota-progress-heading strong { font-size: 13px; }
.quota-progress-heading span { color: var(--text-muted); font-size: 10px; }
.concurrency-hint { margin-bottom: 14px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--text-muted); background: rgba(26,34,52,.55); font-size: 11px; }

/* Direct renew / upgrade purchase */
.purchase-card {
  margin-top: 26px;
  padding: 28px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(28,36,57,.96), rgba(16,22,36,.99) 46%);
  box-shadow: var(--shadow);
}
.fuel-billing-settings { align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 18px; border: 1px solid rgba(245,158,11,.3); border-radius: 10px; background: rgba(245,158,11,.07); }
.fuel-billing-settings > div { flex: 1; min-width: 220px; }
.fuel-billing-settings .form-control { width: min(380px, 100%); }
.purchase-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.purchase-heading { min-width: 0; }
.purchase-kicker {
  display: inline-flex; align-items: center; padding: 3px 9px; margin-bottom: 8px;
  border: 1px solid rgba(108,99,255,.38); border-radius: 999px;
  color: #c4b5fd; background: rgba(108,99,255,.11); font-size: 11px; font-weight: 700;
}
.purchase-title { color: var(--text); font-size: 21px; font-weight: 750; letter-spacing: -.02em; line-height: 1.35; }
.purchase-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.purchase-catalog { min-width: 0; }
.purchase-support-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 14px; align-items: stretch; margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(39,50,73,.72); }
.purchase-section-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.purchase-section-title { color: var(--text); font-size: 14px; font-weight: 700; }
.purchase-section-note { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.store-account-binding {
  padding: 16px; border: 1px solid var(--border);
  border-radius: 12px; background: rgba(15,17,23,.5);
}
.store-account-binding.bound { border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.07); }
.store-account-head { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 11px; align-items: start; }
.store-account-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 10px; color: #c4b5fd; background: rgba(108,99,255,.14); border: 1px solid rgba(108,99,255,.28);
}
.store-account-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.store-account-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.store-account-label { color: var(--text); font-size: 13px; font-weight: 650; }
.store-account-badge { padding: 1px 7px; border-radius: 999px; color: var(--warning); background: rgba(245,158,11,.12); font-size: 10px; font-weight: 700; }
.store-account-binding.bound .store-account-badge { color: #86efac; background: rgba(34,197,94,.14); }
.store-account-text { color: var(--text-muted); font-size: 12px; line-height: 1.55; margin-top: 3px; overflow-wrap: anywhere; }
.store-account-hint { color: var(--text-muted); font-size: 11px; line-height: 1.55; margin-top: 12px; padding-top: 11px; border-top: 1px solid rgba(136,146,164,.16); }
.store-account-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.store-account-actions .btn { justify-content: center; }
.store-account-primary { flex: 1 1 100%; }
.btn-danger { color: #fff; background: #dc2626; border-color: #dc2626; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; }
.btn-danger:disabled { opacity: .55; cursor: not-allowed; }
.purchase-payment-card { padding: 18px; border: 1px solid rgba(124,108,255,.28); border-radius: 12px; background: linear-gradient(145deg,rgba(124,108,255,.08),rgba(10,14,24,.48)); }
.purchase-kicker-payment { margin-bottom: 10px; }
.purchase-loading, .purchase-empty { color: var(--text-muted); text-align: center; padding: 42px 12px; border: 1px dashed var(--border); border-radius: 12px; }
.purchase-products { display: block; }
.purchase-primary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.purchase-product {
  position: relative; width: 100%; min-height: 222px; text-align: left; color: var(--text); background: rgba(10,14,24,.52);
  border: 1px solid var(--border); border-radius: 12px; padding: 15px 16px; cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
.purchase-product:hover:not(:disabled) { border-color: rgba(108,99,255,.75); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.16); }
.purchase-product.selected { border-color: var(--accent); background: linear-gradient(135deg, rgba(108,99,255,.17), rgba(108,99,255,.07)); box-shadow: 0 0 0 1px rgba(108,99,255,.22), 0 12px 28px rgba(0,0,0,.16); }
.purchase-product.selected::after {
  content: '✓'; position: absolute; right: -1px; bottom: -1px; width: 24px; height: 24px;
  display: grid; place-items: center; border-radius: 12px 0 11px 0; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
}
.purchase-product:disabled { opacity: .5; cursor: not-allowed; }
.purchase-product-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.purchase-product-badge { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.purchase-product-badge.badge-renew { color: #86efac; background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.28); }
.purchase-product-badge.badge-upgrade { color: #ddd6fe; background: rgba(124,58,237,.2); border: 1px solid rgba(139,92,246,.36); }
.purchase-product-badge.badge-fuel { color: #67e8f9; background: rgba(6,182,212,.15); border: 1px solid rgba(34,211,238,.28); }
.purchase-product-price-wrap { display: flex; align-items: flex-end; flex-direction: column; white-space: nowrap; }
.purchase-product-price-wrap small { color: var(--text-muted); font-size: 10px; font-weight: 500; }
.purchase-product-price-wrap strong { color: #fbbf24; font-size: 24px; font-weight: 800; line-height: 1.15; }
.purchase-product-name { font-size: 14px; font-weight: 750; line-height: 1.45; margin-top: 10px; }
.purchase-change-grid { display: grid; grid-template-columns: 1fr; gap: 7px; margin-top: 13px; }
.purchase-change-item { min-width: 0; padding: 11px; border-radius: 9px; background: rgba(10,12,18,.48); border: 1px solid rgba(136,146,164,.16); }
.purchase-change-quota { border-color: rgba(139,92,246,.3); background: rgba(124,58,237,.09); }
.purchase-change-expiry { border-color: rgba(34,197,94,.24); background: rgba(34,197,94,.06); }
.purchase-change-label { display: block; color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.purchase-change-route { display: flex; align-items: center; flex-direction: row; flex-wrap: wrap; gap: 6px; margin-top: 7px; line-height: 1.25; }
.purchase-change-route strong { min-width: 0; color: var(--text); font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.purchase-change-route strong:last-child { color: #c4b5fd; }
.purchase-change-expiry .purchase-change-route strong:last-child { color: #86efac; }
.purchase-change-route b { color: var(--accent); font-size: 12px; line-height: 1; }
.purchase-change-note { display: block; color: var(--text-muted); font-size: 9px; line-height: 1.5; margin-top: 7px; }
.purchase-plan-route { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 7px; margin-top: 10px; color: var(--text-muted); font-size: 10px; }
.purchase-plan-route span:first-child { flex: 0 0 100%; font-size: 9px; }
.purchase-plan-route span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-plan-route span:last-child { color: #ddd6fe; font-weight: 700; }
.purchase-plan-route b { color: var(--accent); flex: 0 0 auto; }
.redeem-change-grid { margin: 0 0 12px; }
.redeem-change-grid .purchase-change-item { padding: 14px; }
.redeem-change-grid .purchase-change-route strong { font-size: 15px; }
.redeem-plan-route { margin-bottom: 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface2); }
.purchase-more { margin-top: 12px; border: 1px solid rgba(39,50,73,.82); border-radius: 12px; overflow: hidden; background: rgba(10,14,24,.34); }
.purchase-more-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 15px; border: 0; color: var(--text); background: transparent; cursor: pointer; text-align: left; }
.purchase-more-toggle:hover { background: rgba(124,108,255,.06); }
.purchase-more-toggle > span:first-child { min-width: 0; display: flex; flex-direction: column; }
.purchase-more-toggle b { font-size: 12px; }
.purchase-more-toggle small { color: var(--text-muted); font-size: 10px; margin-top: 2px; }
.purchase-more-action { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; color: #bdb5ff; font-size: 10px; }
.purchase-more-action i { font-size: 15px; font-style: normal; transition: transform .2s; }
.purchase-more-toggle[aria-expanded="true"] .purchase-more-action i { transform: rotate(180deg); }
.purchase-more-panel { padding: 0 12px 12px; }
.purchase-more-panel[hidden] { display: none; }
.purchase-more-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; padding-top: 12px; border-top: 1px solid rgba(39,50,73,.7); }
.purchase-product-compact { min-height: 190px; padding: 13px; }
.purchase-product-compact .purchase-product-price-wrap strong { font-size: 20px; }
.purchase-product-compact .purchase-change-item { padding: 9px; }
.purchase-product-compact .purchase-change-note, .purchase-product-compact .purchase-product-result, .purchase-product-compact .purchase-plan-route { display: none; }
.result-utility-section { margin-top: 15px; }
.code-tools-card { padding: 0; box-shadow: none; }
.purchase-product-benefit { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.purchase-product-benefit strong { color: var(--success); font-size: 16px; }
.purchase-product-upgrade .purchase-product-benefit strong { color: #c4b5fd; }
.purchase-product-fuel .purchase-product-benefit strong { color: #67e8f9; }
.purchase-product-benefit span { color: var(--text-muted); font-size: 11px; }
.purchase-product-result { color: var(--text-muted); font-size: 11px; line-height: 1.6; margin-top: 5px; }
.purchase-upgrade-formula { margin-top: 13px; padding: 12px; border-radius: 9px; background: rgba(10,12,18,.52); border: 1px solid rgba(139,92,246,.25); }
.purchase-formula-title { color: #ddd6fe; font-size: 12px; font-weight: 750; margin-bottom: 8px; }
.purchase-formula-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; color: var(--text-muted); font-size: 10px; line-height: 1.45; border-bottom: 1px dashed rgba(136,146,164,.14); }
.purchase-formula-row strong { color: var(--text); font-weight: 600; text-align: right; }
.purchase-formula-total { display: flex; justify-content: space-between; gap: 10px; padding-top: 8px; color: #c4b5fd; font-size: 11px; line-height: 1.5; }
.purchase-formula-total strong { text-align: right; }
.purchase-formula-note { margin-top: 9px; padding-top: 8px; color: var(--text-muted); font-size: 10px; line-height: 1.55; border-top: 1px solid rgba(136,146,164,.16); }
.purchase-formula-note b { color: #fbbf24; }
.purchase-product-stock { color: var(--danger); font-size: 12px; margin-top: 5px; }
.purchase-checkout { gap: 10px; margin-top: 12px; }
.purchase-checkout label { color: var(--text-muted); font-size: 12px; }
.purchase-security-note { display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--text-muted); font-size: 11px; text-align: center; }
.purchase-security-note span { color: var(--success); font-weight: 800; }
.purchase-checkout-placeholder { color: var(--text-muted); font-size: 12px; line-height: 1.6; margin-top: 12px; padding: 13px; border-radius: 8px; background: rgba(34,38,58,.52); text-align: center; }
.purchase-progress { align-items: center; gap: 12px; padding: 14px 16px; margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; background: rgba(15,17,23,.5); }
.purchase-progress-icon { width: 26px; color: var(--success); font-size: 20px; font-weight: 700; text-align: center; flex: 0 0 auto; }
.purchase-progress > div { min-width: 0; flex: 1; }
.purchase-progress-title { font-weight: 650; }
.purchase-progress-text { color: var(--text-muted); font-size: 12px; overflow-wrap: anywhere; }

/* Direct renew / upgrade purchase */
.purchase-card {
  margin-top: 22px;
  padding: 26px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(34,38,58,.92), rgba(26,29,39,.98) 42%);
  box-shadow: var(--shadow);
}
.purchase-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.purchase-heading { min-width: 0; }
.purchase-kicker {
  display: inline-flex; align-items: center; padding: 3px 9px; margin-bottom: 8px;
  border: 1px solid rgba(108,99,255,.38); border-radius: 999px;
  color: #c4b5fd; background: rgba(108,99,255,.11); font-size: 11px; font-weight: 700;
}
.purchase-title { color: var(--text); font-size: 21px; font-weight: 750; letter-spacing: -.02em; line-height: 1.35; }
.purchase-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.purchase-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .85fr); gap: 18px; align-items: start; }
.purchase-catalog { min-width: 0; }
.purchase-sidebar { display: grid; gap: 12px; min-width: 0; }
.purchase-section-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.purchase-section-title { color: var(--text); font-size: 14px; font-weight: 700; }
.purchase-section-note { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.store-account-binding {
  padding: 16px; border: 1px solid var(--border);
  border-radius: 12px; background: rgba(15,17,23,.5);
}
.store-account-binding.bound { border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.07); }
.store-account-head { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 11px; align-items: start; }
.store-account-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 10px; color: #c4b5fd; background: rgba(108,99,255,.14); border: 1px solid rgba(108,99,255,.28);
}
.store-account-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.store-account-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.store-account-label { color: var(--text); font-size: 13px; font-weight: 650; }
.store-account-badge { padding: 1px 7px; border-radius: 999px; color: var(--warning); background: rgba(245,158,11,.12); font-size: 10px; font-weight: 700; }
.store-account-binding.bound .store-account-badge { color: #86efac; background: rgba(34,197,94,.14); }
.store-account-text { color: var(--text-muted); font-size: 12px; line-height: 1.55; margin-top: 3px; overflow-wrap: anywhere; }
.store-account-hint { color: var(--text-muted); font-size: 11px; line-height: 1.55; margin-top: 12px; padding-top: 11px; border-top: 1px solid rgba(136,146,164,.16); }
.store-account-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.store-account-actions .btn { justify-content: center; }
.store-account-primary { flex: 1 1 100%; }
.purchase-payment-card { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: rgba(15,17,23,.5); }
.purchase-loading, .purchase-empty { color: var(--text-muted); text-align: center; padding: 42px 12px; border: 1px dashed var(--border); border-radius: 12px; }
.purchase-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.purchase-product {
  position: relative; width: 100%; min-height: 102px; text-align: left; color: var(--text); background: rgba(15,17,23,.46);
  border: 1px solid var(--border); border-radius: 12px; padding: 15px 16px; cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
.purchase-product:hover:not(:disabled) { border-color: rgba(108,99,255,.75); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.16); }
.purchase-product.selected { border-color: var(--accent); background: linear-gradient(135deg, rgba(108,99,255,.17), rgba(108,99,255,.07)); box-shadow: 0 0 0 1px rgba(108,99,255,.22), 0 12px 28px rgba(0,0,0,.16); }
.purchase-product.selected::after {
  content: '✓'; position: absolute; right: -1px; bottom: -1px; width: 24px; height: 24px;
  display: grid; place-items: center; border-radius: 12px 0 11px 0; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
}
.purchase-product:disabled { opacity: .5; cursor: not-allowed; }
.purchase-product-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.purchase-product-name { font-size: 14px; font-weight: 700; line-height: 1.45; }
.purchase-product-price { color: #fbbf24; font-size: 20px; font-weight: 750; line-height: 1.2; white-space: nowrap; }
.purchase-product-action { color: #c4b5fd; font-size: 12px; margin-top: 4px; }
.purchase-product-result { color: var(--text-muted); font-size: 12px; margin-top: 3px; }
.purchase-product-stock { color: var(--danger); font-size: 12px; margin-top: 5px; }
.purchase-checkout { gap: 10px; margin-top: 12px; }
.purchase-checkout label { color: var(--text-muted); font-size: 12px; }
.purchase-security-note { display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--text-muted); font-size: 11px; text-align: center; }
.purchase-security-note span { color: var(--success); font-weight: 800; }
.purchase-checkout-placeholder { color: var(--text-muted); font-size: 12px; line-height: 1.6; margin-top: 12px; padding: 13px; border-radius: 8px; background: rgba(34,38,58,.52); text-align: center; }
.purchase-progress { align-items: center; gap: 12px; padding: 14px 16px; margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; background: rgba(15,17,23,.5); }
.purchase-progress-icon { width: 26px; color: var(--success); font-size: 20px; font-weight: 700; text-align: center; flex: 0 0 auto; }
.purchase-progress > div { min-width: 0; flex: 1; }
.purchase-progress-title { font-weight: 650; }
.purchase-progress-text { color: var(--text-muted); font-size: 12px; overflow-wrap: anywhere; }

/* Logs filters */
.logs-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.form-control-sm {
  padding: 6px 10px;
  font-size: 12px;
}
select.form-control.form-control-sm {
  padding-right: 28px;
}

/* Logs table tweaks */
#logs-table-wrap th { font-size: 11px; }
#logs-table-wrap td { font-size: 12px; padding: 8px 10px; }
.token-breakdown { display: grid; grid-template-columns: repeat(2, max-content); gap: 2px 10px; line-height: 1.45; }
.token-breakdown span:nth-child(n+3) { color: var(--text-muted); }
.log-model { font-weight: 600; }
.log-type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}
.log-type-stream { background: rgba(59,130,246,.15); color: var(--info); }
.log-type-nonstream { background: rgba(139,92,246,.15); color: #a78bfa; }
.log-type-ws { background: rgba(245,158,11,.15); color: var(--warning); }
.log-cost { color: var(--warning); font-weight: 600; font-family: monospace; }
.log-duration { color: var(--text-muted); font-family: monospace; }
.log-tokens { font-family: monospace; font-size: 11px; }
.log-tokens-in { color: var(--info); }
.log-tokens-out { color: var(--success); }

/* Admin tabs */
.admin-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 56px;
  z-index: 99;
}
.admin-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (max-width: 820px) {
  .quota-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .purchase-primary-grid, .purchase-more-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .purchase-primary-grid .purchase-product-fuel { grid-column: 1 / -1; min-height: auto; }
  .purchase-support-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .container { padding: 0 14px 40px; }
  .portal-topbar-inner { height: 58px; padding: 0 14px; }
  .portal-safe-note { display: none; }
  .quota-header { padding: 38px 4px 22px; }
  .quota-header h1 { font-size: 31px; }
  .quota-header p { font-size: 13px; }
  .portal-journey { width: 100%; justify-content: center; gap: 7px; padding: 9px; overflow: hidden; }
  .portal-journey span { font-size: 10px; }
  .portal-journey span:last-child { display: none; }
  .portal-journey i:nth-last-of-type(1) { display: none; }
  .card { padding: 20px; }
  .portal-entry-panel { padding: 21px 18px; }
  .entry-panel-head { gap: 9px; }
  .entry-panel-head h2 { font-size: 17px; }
  .query-form { flex-direction: column; }
  .query-submit { width: 100%; min-height: 46px; }
  .quota-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .quota-stat-card { padding: 13px; }
  .quota-stat-value { font-size: 18px; }
  .logs-filters { grid-template-columns: 1fr; }
  .quota-banner { flex-direction: column; gap: 8px; align-items: flex-start; }
  .inline-form { flex-direction: column; }
  .inline-form .btn { width: 100%; justify-content: center; }
  .redeem-card-title { flex-direction: column; align-items: flex-start; gap: 2px; }
  .redeem-card-title span:last-child { text-align: left; }
  .modal { margin: 0 14px; padding: 22px; }
  .redeem-mode-hint { flex-direction: column; gap: 4px; }
  .key-copy-row { flex-direction: column; }
  .panel-heading { flex-direction: column; gap: 3px; }
  .q-tab-panel { padding: 17px; }
  .quota-progress-heading { align-items: flex-start; flex-direction: column; gap: 1px; }
  .purchase-card { padding: 20px 15px; }
  .purchase-header { align-items: center; }
  .purchase-header .btn { flex: 0 0 auto; }
  .purchase-title { font-size: 18px; }
  .purchase-subtitle { font-size: 12px; }
  .purchase-primary-grid, .purchase-more-grid { grid-template-columns: 1fr; }
  .purchase-primary-grid .purchase-product-fuel { grid-column: auto; }
  .purchase-product { min-height: auto; }
  .purchase-change-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .purchase-change-route { flex-direction: column; align-items: flex-start; gap: 2px; }
  .purchase-change-route b { transform: rotate(90deg); }
  .purchase-more-toggle { align-items: flex-start; }
  .purchase-formula-row, .purchase-formula-total { align-items: flex-start; flex-direction: column; gap: 2px; }
  .purchase-formula-row strong, .purchase-formula-total strong { text-align: left; }
  .store-account-actions .btn { flex: 1 1 auto; justify-content: center; }
  .store-account-actions .store-account-primary { flex-basis: 100%; }
  .purchase-checkout .btn { width: 100%; justify-content: center; }
  .purchase-progress { align-items: flex-start; flex-wrap: wrap; }
  .fuel-billing-settings { align-items: stretch; flex-direction: column; }
  .fuel-billing-settings .form-control, .fuel-billing-settings .btn { width: 100%; }
}

@media (max-width: 390px) {
  .purchase-header { align-items: flex-start; flex-direction: column; }
  .quota-stats { grid-template-columns: 1fr; }
  .purchase-change-grid { grid-template-columns: 1fr; }
}

/* Main-site visual language: api.tu-zi.com */
:root {
  --bg: #fff;
  --surface: #fff;
  --surface2: #f7f7f8;
  --border: #e7e7ea;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --text: #111113;
  --text-muted: #6f7076;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #2563eb;
  --radius: 14px;
  --shadow: 0 18px 50px -28px rgba(17, 17, 19, .28);
}

body {
  color: var(--text);
  background: #fff;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: #4f46e5; }

.portal-topbar {
  border-bottom: 1px solid rgba(231, 231, 234, .88);
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 0 rgba(17, 17, 19, .02);
  backdrop-filter: blur(18px) saturate(160%);
}

.portal-topbar-inner { height: 64px; }
.portal-brand { gap: 10px; color: var(--text); }
.portal-brand-mark {
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #eef6fb;
  box-shadow: none;
}
.portal-brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.portal-brand strong { color: #111113; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.portal-brand small { color: #8b8c92; font-size: 10px; letter-spacing: .02em; }
.portal-topbar-actions { display: flex; align-items: center; gap: 20px; }
.store-migration-notice {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 42px; padding: 8px 20px; color: #52525b; background: #f7f7f8;
  border-bottom: 1px solid #e7e7ea; font-size: 12px;
}
.store-migration-notice a { color: #4f46e5; font-weight: 700; }
.portal-main-link { color: #6f7076; font-size: 12px; font-weight: 500; }
.portal-main-link:hover { color: #111113; text-decoration: none; }
.portal-main-link span { display: inline-block; margin-left: 2px; transition: transform .2s ease; }
.portal-main-link:hover span { transform: translate(2px, -2px); }
.portal-safe-note { color: #8b8c92; }
.portal-safe-note b { color: #16a34a; background: #ecfdf3; }

.portal-container { position: relative; }
.portal-hero {
  position: relative;
  isolation: isolate;
  padding: 82px 0 34px;
}
.portal-hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  top: 0;
  left: 50%;
  width: 100vw;
  height: 380px;
  transform: translateX(-50%);
  background-image: radial-gradient(circle, rgba(17, 17, 19, .075) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 50% 0%, #000 25%, transparent 76%);
  mask-image: radial-gradient(ellipse 70% 75% at 50% 0%, #000 25%, transparent 76%);
  pointer-events: none;
}
.portal-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -70px;
  left: 50%;
  width: min(900px, 100vw);
  height: 440px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(99, 102, 241, .105), transparent 66%);
  pointer-events: none;
}
.quota-header h1 {
  max-width: 820px;
  margin-top: 14px;
  color: #0a0a0b;
  font-size: clamp(34px, 5.5vw, 54px);
  font-weight: 720;
  letter-spacing: -.035em;
}
.quota-header p { max-width: 620px; color: #6f7076; font-size: 16px; }
.portal-eyebrow {
  gap: 7px;
  align-items: center;
  padding: 6px 11px;
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, .18);
  background: rgba(99, 102, 241, .065);
  letter-spacing: .055em;
}
.portal-eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: #6366f1; box-shadow: 0 0 0 4px rgba(99, 102, 241, .1); }
.portal-journey {
  margin-top: 28px;
  padding: 5px;
  gap: 4px;
  color: #6f7076;
  border-color: #e7e7ea;
  background: rgba(247, 247, 248, .9);
  box-shadow: 0 1px 2px rgba(17, 17, 19, .03);
}
.portal-journey span { padding: 5px 9px; }
.portal-journey b { color: #fff; background: #111113; }
.portal-journey i { color: #b5b5ba; }

.card,
.entry-redeem-disclosure,
.code-tools-card,
.quota-banner,
.q-tabs,
.q-tab-panel {
  border-color: #e7e7ea;
  background: #fff;
}
.card { box-shadow: none; }
.portal-entry-panel {
  padding: 30px;
  border-color: #dedee3;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 24px 70px -38px rgba(17, 17, 19, .36), 0 1px 2px rgba(17, 17, 19, .04);
}
.entry-step,
.purchase-kicker {
  color: #4f46e5;
  border-color: rgba(99, 102, 241, .16);
  background: rgba(99, 102, 241, .07);
}
.entry-panel-head h2 { color: #111113; font-weight: 650; }
.entry-panel-head p,
.query-label,
.query-helper { color: #797a80; }
.key-input-wrap .form-control { background: #fafafa; }
.key-input-prefix { color: #4f46e5; background: rgba(99, 102, 241, .09); }

.form-control {
  color: #111113;
  border-color: #dedee3;
  border-radius: 10px;
  background-color: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.form-control:hover { border-color: #c9c9cf; }
.form-control:focus { border-color: #6366f1; background-color: #fff; box-shadow: 0 0 0 3px rgba(99, 102, 241, .1); }
.form-control::placeholder { color: #a3a4ab; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 550;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease, color .2s ease;
}
.btn-primary { color: #fff; border-color: #111113; background: #111113; box-shadow: none; }
.btn-primary:hover:not(:disabled) { border-color: #26262a; background: #26262a; box-shadow: 0 8px 24px rgba(17, 17, 19, .16); transform: translateY(-1px); }
.btn-ghost { color: #55565c; border-color: #dedee3; background: #fff; }
.btn-ghost:hover:not(:disabled) { color: #111113; border-color: #c9c9cf; background: #fafafa; }
.btn-link-danger { color: #dc2626; }
.btn-link-danger:hover:not(:disabled) { color: #b91c1c; background: #fef2f2; }
.spinner { border-color: rgba(17, 17, 19, .18); border-top-color: currentColor; }
.btn-primary .spinner { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

.entry-redeem-disclosure,
.code-tools-card { background: #fafafa; }
.entry-redeem-disclosure summary,
.code-tools-card summary { color: #6f7076; }
.entry-redeem-disclosure summary b,
.code-tools-card summary b { color: #111113; }
.entry-redeem-disclosure summary small,
.code-tools-card summary small { color: #4f46e5; }
.entry-redeem-disclosure[open] summary,
.code-tools-card[open] summary { border-bottom-color: #e7e7ea; }

.result-identity-card {
  border-color: #e2e2e6;
  background: #fff;
  box-shadow: 0 14px 40px -30px rgba(17, 17, 19, .32);
}
.result-identity-card::after { background: radial-gradient(circle, rgba(99, 102, 241, .09), transparent 68%); }
.result-identity-label,
.quota-banner-key { color: #8b8c92; }
.quota-banner-plan { color: #111113; }
.badge-active { color: #15803d; background: #ecfdf3; }
.badge-disabled { color: #dc2626; background: #fef2f2; }
.badge-expired { color: #b45309; background: #fffbeb; }

.q-tabs {
  gap: 3px;
  padding: 4px;
  background: #f7f7f8;
}
.q-tab { color: #6f7076; }
.q-tab:hover { color: #111113; }
.q-tab.active { color: #fff; border-color: #111113; background: #111113; box-shadow: 0 2px 8px rgba(17, 17, 19, .12); }
.q-tab-panel { box-shadow: 0 16px 44px -36px rgba(17, 17, 19, .28); }
.panel-heading h2 { color: #111113; font-weight: 650; }
.panel-kicker { color: #4f46e5; }
.panel-timezone { color: #8b8c92; }
.quota-stat-card {
  border-color: #e7e7ea;
  background: #fafafa;
  transition: transform .25s cubic-bezier(.16, 1, .3, 1), border-color .25s ease, box-shadow .25s ease;
}
.quota-stat-card:hover { border-color: #d7d7dc; box-shadow: 0 12px 30px -24px rgba(17, 17, 19, .35); transform: translateY(-1px); }
.quota-stat-primary { border-color: rgba(99, 102, 241, .28); background: rgba(99, 102, 241, .055); }
.fuel-stat-card { border-color: rgba(14, 165, 233, .25); background: rgba(14, 165, 233, .05); }
.quota-stat-label,
.quota-stat-note { color: #797a80; }
.quota-stat-value { color: #111113; }
.progress-bar { height: 7px; background: #eeeef0; }
.progress-fill { background: #6366f1; }
.concurrency-hint { color: #6f7076; border-color: #e7e7ea; background: #fafafa; }

.reset-time-stat-card { position: relative; }
.daily-limit-actions { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 5px; }
.reset-time-manage-link { align-items: center; padding: 3px 6px; border: 0; border-radius: 5px; color: #4f46e5; background: #eef2ff; font-size: 10px; cursor: pointer; }
.reset-time-manage-link:hover { color: #3730a3; background: #e0e7ff; }
.daily-limit-toggle-link.exempt { color: #b45309; background: #fffbeb; }
.daily-limit-toggle-link:disabled { color: #b9bac0; background: #f4f4f5; cursor: wait; }

/* Concurrency self-service: intentionally quiet until the user opens it. */
.concurrency-stat-card { position: relative; }
.concurrency-manage-link { position: absolute; top: 10px; right: 10px; padding: 3px 6px; border: 0; border-radius: 5px; color: #9a9ba1; background: transparent; font-size: 10px; cursor: pointer; }
.concurrency-manage-link:hover { color: #4f46e5; background: #f0f0f3; }
.concurrency-manage-link:disabled { color: #b9bac0; cursor: wait; }
.concurrency-manage-link.pending { color: #b45309; background: #fffbeb; }
.concurrency-modal { width: min(680px, calc(100vw - 28px)); max-width: 680px; max-height: calc(100vh - 40px); overflow-y: auto; }
.concurrency-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.concurrency-panel-head h3 { margin: 0 0 5px; color: #111113; font-size: 17px; }
.concurrency-panel-head p { margin: 0; color: #797a80; font-size: 12px; line-height: 1.65; }
.concurrency-head-actions { display: flex; align-items: center; gap: 10px; }
.concurrency-request-badge { flex: 0 0 auto; padding: 5px 10px; border-radius: 999px; color: #15803d; background: #ecfdf3; font-size: 11px; font-weight: 750; }
.concurrency-request-badge.pending { color: #b45309; background: #fffbeb; }
.concurrency-request-badge.unavailable { color: #6b7280; background: #f3f4f6; }
.concurrency-entitlement-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.concurrency-entitlement-grid > div { padding: 12px 14px; border: 1px solid #ececef; border-radius: 10px; background: #fafafa; }
.concurrency-entitlement-grid span { display: block; margin-bottom: 5px; color: #8b8c92; font-size: 10px; }
.concurrency-entitlement-grid strong { color: #111113; font-size: 17px; }
.concurrency-form { padding-top: 2px; }
.concurrency-input-row { display: grid; grid-template-columns: auto minmax(170px,240px) auto; align-items: center; gap: 12px; }
.concurrency-input-row > label { color: #45464c; font-size: 12px; font-weight: 650; }
.concurrency-number-wrap { position: relative; }
.concurrency-number-wrap input { padding-right: 66px; }
.concurrency-number-wrap span { position: absolute; right: 12px; top: 50%; color: #797a80; font-size: 11px; transform: translateY(-50%); pointer-events: none; }
.concurrency-decision-hint { margin: 9px 0 0; color: #6f7076; font-size: 11px; line-height: 1.55; }
.concurrency-decision-hint.success { color: #15803d; }
.concurrency-decision-hint.warning { color: #b45309; }
.concurrency-reason-wrap { margin-top: 15px; padding: 15px; border: 1px solid #fde5b0; border-radius: 11px; background: #fffbeb; }
.concurrency-reason-wrap label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: #713f12; font-size: 12px; font-weight: 700; }
.concurrency-reason-wrap label span { color: #b45309; font-size: 10px; }
.concurrency-reason-wrap textarea { min-height: 132px; resize: vertical; background: #fff; }
.concurrency-reason-count { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; color: #8a621f; font-size: 10px; }
.concurrency-reason-count strong { white-space: nowrap; color: #b45309; }
.concurrency-reason-count strong.complete { color: #15803d; }
.concurrency-pending { align-items: center; justify-content: space-between; gap: 16px; padding: 14px 15px; border: 1px solid #fde5b0; border-radius: 11px; background: #fffbeb; }
.concurrency-pending strong { display: block; margin-bottom: 3px; color: #713f12; font-size: 12px; }
.concurrency-pending span { color: #9a6b1d; font-size: 11px; }
.concurrency-safety-note { margin-top: 15px; padding-top: 13px; border-top: 1px solid #ececef; color: #8b8c92; font-size: 10px; line-height: 1.65; }

.daily-reset-modal { width: min(560px, calc(100vw - 28px)); max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; }
.daily-reset-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.daily-reset-head h3 { margin: 0 0 5px; color: #111113; font-size: 17px; }
.daily-reset-head p { margin: 0; color: #797a80; font-size: 12px; line-height: 1.65; }
.daily-reset-warning { margin-bottom: 18px; padding: 14px 16px; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b; background: #fef2f2; font-size: 12px; line-height: 1.65; }
.daily-reset-warning strong { display: block; margin-bottom: 6px; font-size: 13px; }
.daily-reset-warning ul { margin: 0; padding-left: 18px; }
.daily-reset-field { display: grid; grid-template-columns: minmax(0,1fr) minmax(150px,190px); align-items: center; gap: 16px; color: #45464c; font-size: 12px; font-weight: 650; }
.daily-reset-ack { display: flex; align-items: flex-start; gap: 9px; margin-top: 18px; padding: 12px 13px; border: 1px solid #fde68a; border-radius: 8px; color: #713f12; background: #fffbeb; font-size: 11px; line-height: 1.55; cursor: pointer; }
.daily-reset-ack input { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; accent-color: #dc2626; }
.daily-reset-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 640px) {
  .concurrency-panel-head { flex-direction: column; gap: 10px; }
  .concurrency-entitlement-grid { grid-template-columns: 1fr; }
  .concurrency-input-row { grid-template-columns: 1fr; }
  .concurrency-input-row .btn { width: 100%; }
  .concurrency-pending { align-items: stretch; flex-direction: column; }
  .daily-reset-field { grid-template-columns: 1fr; gap: 7px; }
  .daily-reset-actions .btn { flex: 1; }
}

.purchase-card {
  border-color: #dedee3;
  background: #fff;
  box-shadow: 0 24px 70px -42px rgba(17, 17, 19, .34);
}
.purchase-title,
.purchase-section-title { color: #111113; }
.purchase-title { font-weight: 680; }
.purchase-subtitle,
.purchase-section-note { color: #797a80; }
.purchase-support-grid { border-top-color: #e7e7ea; }
.fuel-billing-settings { border-color: rgba(245, 158, 11, .23); background: #fffbeb; }
.purchase-product {
  color: #111113;
  border-color: #e7e7ea;
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 17, 19, .025);
  transition: transform .3s cubic-bezier(.16, 1, .3, 1), border-color .25s ease, box-shadow .3s ease, background-color .25s ease;
}
.purchase-product:hover:not(:disabled) { border-color: rgba(99, 102, 241, .46); background: #fff; box-shadow: 0 14px 36px -24px rgba(17, 17, 19, .36); transform: translateY(-2px); }
.purchase-product.selected { border-color: #6366f1; background: rgba(99, 102, 241, .035); box-shadow: 0 0 0 2px rgba(99, 102, 241, .08), 0 14px 36px -26px rgba(79, 70, 229, .32); }
.purchase-product.selected::after { background: #6366f1; }
.purchase-product-price-wrap small { color: #8b8c92; }
.purchase-product-price-wrap strong { color: #111113; font-weight: 750; }
.purchase-product-badge { letter-spacing: .015em; }
.purchase-product-badge.badge-renew { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.purchase-product-badge.badge-upgrade { color: #4f46e5; border-color: #ddd6fe; background: #f5f3ff; }
.purchase-product-badge.badge-fuel { color: #0369a1; border-color: #bae6fd; background: #f0f9ff; }
.purchase-change-item { border-color: #e7e7ea; background: #fafafa; }
.purchase-change-quota { border-color: rgba(99, 102, 241, .19); background: rgba(99, 102, 241, .045); }
.purchase-change-expiry { border-color: rgba(22, 163, 74, .17); background: rgba(22, 163, 74, .035); }
.purchase-change-label,
.purchase-change-note,
.purchase-plan-route,
.purchase-product-result,
.purchase-product-benefit span { color: #797a80; }
.purchase-change-route strong,
.purchase-formula-row strong { color: #111113; }
.purchase-change-route strong:last-child,
.purchase-plan-route span:last-child { color: #4f46e5; }
.purchase-change-expiry .purchase-change-route strong:last-child { color: #15803d; }
.purchase-change-route b,
.purchase-plan-route b { color: #6366f1; }
.purchase-product-upgrade .purchase-product-benefit strong { color: #4f46e5; }
.purchase-product-fuel .purchase-product-benefit strong { color: #0284c7; }
.purchase-more { border-color: #e7e7ea; background: #fafafa; }
.purchase-more-toggle { color: #111113; }
.purchase-more-toggle:hover { background: rgba(99, 102, 241, .045); }
.purchase-more-toggle small { color: #797a80; }
.purchase-more-action { color: #4f46e5; }
.purchase-more-grid { border-top-color: #e7e7ea; }
.purchase-upgrade-formula { border-color: #ddd6fe; background: #faf9ff; }
.purchase-formula-title,
.purchase-formula-total { color: #4f46e5; }
.purchase-formula-row { color: #6f7076; border-bottom-color: #e7e7ea; }
.purchase-formula-note { color: #6f7076; border-top-color: #e7e7ea; }
.purchase-formula-note b { color: #b45309; }
.purchase-payment-card { border-color: #dedee3; background: #fafafa; }
.purchase-checkout-placeholder { color: #797a80; background: #f1f1f3; }
.purchase-security-note { color: #797a80; }
.store-account-binding,
.purchase-progress { border-color: #e7e7ea; background: #fff; }
.store-account-binding.bound { border-color: #bbf7d0; background: #f0fdf4; }
.store-account-icon { color: #4f46e5; border-color: #ddd6fe; background: #f5f3ff; }
.store-account-label { color: #111113; }
.store-account-badge { color: #b45309; background: #fffbeb; }
.store-account-binding.bound .store-account-badge { color: #15803d; background: #dcfce7; }
.store-account-text,
.store-account-hint,
.purchase-progress-text { color: #797a80; }
.store-account-hint { border-top-color: #e7e7ea; }

.alert-error { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.alert-success { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.alert-info { color: #0369a1; border-color: #bae6fd; background: #f0f9ff; }
.table-wrap { border: 1px solid #e7e7ea; border-radius: 10px; }
th, td { border-bottom-color: #e7e7ea; }
th { color: #6f7076; background: #fafafa; }
tr:hover td { background: #fafafa; }
.log-type-stream { color: #2563eb; background: #eff6ff; }
.log-type-nonstream { color: #6d28d9; background: #f5f3ff; }
.log-type-ws { color: #b45309; background: #fffbeb; }
.log-cost { color: #b45309; }
.page-btn { color: #111113; border-color: #e7e7ea; background: #fff; }
.page-btn.active { color: #fff; border-color: #111113; background: #111113; }

.modal-overlay { background: rgba(17, 17, 19, .48); backdrop-filter: blur(4px); }
.modal { border-color: #e7e7ea; background: #fff; box-shadow: 0 24px 80px rgba(17, 17, 19, .2); }
.modal-title,
.modal-message,
.modal-intent-title,
.modal-intent-desc,
.preview-value { color: #111113; }
.modal-close,
.preview-label,
.preview-muted { color: #797a80; }
.modal-intent { border-color: #fde68a; border-left-color: #f59e0b; background: #fffbeb; }
.modal-intent-new { border-color: #bfdbfe; border-left-color: #2563eb; background: #eff6ff; }
.modal-intent-label { color: #b45309; }
.modal-intent-new .modal-intent-label { color: #1d4ed8; }
.preview-box { border-color: #e7e7ea; background: #fafafa; }
.key-output { color: #111113; border-color: #dedee3; background: #fafafa; }

@media (max-width: 600px) {
  .store-migration-notice { align-items: flex-start; flex-direction: column; gap: 2px; padding: 9px 14px; }
  .portal-topbar-actions { gap: 10px; }
  .portal-main-link { font-size: 11px; }
  .portal-hero { padding: 54px 4px 26px; }
  .quota-header h1 { font-size: 34px; line-height: 1.16; }
  .quota-header p { font-size: 14px; }
  .portal-journey { background: rgba(247, 247, 248, .95); }
  .portal-entry-panel { padding: 22px 18px; }
}

@media (max-width: 390px) {
  .portal-main-link { display: none; }
}
