/* ===========================================
   Bilinear Labs — Frontend Styles
   =========================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-50: #eff6ff;
    --bg: #ffffff;
    --surface: #f8fafc;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --warning: #f59e0b;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Courier New', monospace;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --max-w: 1200px;
    --transition: 150ms ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 3rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; font-weight: 500; line-height: 1.4; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }

/* --- Nav --- */
.nav { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--border); height: 60px; }
.nav-inner { display: flex; align-items: center; height: 100%; position: relative; }
.nav-logo { font-weight: 700; font-size: 21px; color: var(--text); display: flex; align-items: center; gap: 10px; white-space: nowrap; cursor: pointer; }
.nav-logo:hover { text-decoration: none; color: var(--text); }
.nav-logo-img { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; }
.nav-links { display: flex; gap: 6px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-link { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: var(--radius); font-size: 15px; font-weight: 500; color: var(--text-2); transition: background var(--transition), color var(--transition); }
.nav-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-light); color: var(--primary); }
.nav-link svg { flex-shrink: 0; }
.nav-auth { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-auth .nav-link { font-size: 15px; }
.nav-auth .btn { font-size: 15px; padding: 8px 20px; }
.user-menu { position: relative; }
.user-menu-trigger { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius); font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer; border: 1px solid var(--border); background: var(--bg); transition: border-color var(--transition); }
.user-menu-trigger:hover { border-color: var(--border-dark); }
.user-menu-chevron { font-size: 10px; }
.user-menu-dropdown { display: none; position: absolute; right: 0; top: calc(100% + 4px); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); min-width: 180px; padding: 4px; z-index: 200; }
.user-menu-dropdown.show { display: block; }
.user-menu-item { display: block; width: 100%; padding: 8px 12px; font-size: 14px; color: var(--text-2); border: none; background: none; text-align: left; cursor: pointer; border-radius: 4px; transition: background var(--transition); }
.user-menu-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.user-menu-item.danger { color: var(--error); }
.user-menu-item.danger:hover { background: var(--error-bg); }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; font-size: 14px; font-weight: 500; font-family: var(--font); border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; transition: all var(--transition); white-space: nowrap; line-height: 1.4; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-dark); background: var(--surface); }
.btn-ghost { background: none; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.btn-danger { background: var(--bg); color: var(--error); border-color: var(--border); }
.btn-danger:hover:not(:disabled) { background: var(--error-bg); border-color: var(--error); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn svg { flex-shrink: 0; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-input { width: 100%; padding: 9px 12px; font-size: 14px; font-family: var(--font); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.form-input::placeholder { color: var(--text-3); }
.form-textarea { resize: vertical; min-height: 80px; font-family: var(--mono); font-size: 13px; }
.form-error-msg { color: var(--error); font-size: 13px; margin-top: 8px; }
.form-hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* --- Cards --- */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }

/* --- Tables --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; background: var(--surface); border-bottom: 2px solid var(--border); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-2); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
tr:hover td { background: var(--surface); }
.addr { color: var(--primary); }

/* --- Hero --- */
.hero { padding: 48px 0 56px; background: linear-gradient(180deg, var(--primary-50) 0%, var(--bg) 100%); }
.hero-inner { text-align: center; }
.hero-content { max-width: 700px; margin: 0 auto; }
.hero-badge { display: inline-block; padding: 5px 14px; background: var(--primary-light); color: var(--primary); border-radius: 20px; font-size: 13px; font-weight: 500; margin-bottom: 20px; }
.hero-title { margin-bottom: 16px; }
.hero-title span { color: var(--primary); }
.hero-subtitle { font-size: 19px; color: var(--text-2); line-height: 1.6; margin-bottom: 32px; }

/* --- Hero Stats --- */
.hero-stats { display: flex; justify-content: center; gap: 56px; margin-bottom: 40px; flex-wrap: wrap; }
.hero-stat { display: flex; align-items: center; gap: 14px; text-align: left; }
.hero-stat-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hero-stat-icon svg { width: 22px; height: 22px; }
.hero-stat-value { font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.hero-stat-label { font-size: 14px; color: var(--text-3); margin-top: 1px; }

/* --- Query Builder --- */
.qb-wrap { max-width: 900px; margin: 0 auto; text-align: left; display: flex; flex-direction: column; gap: 16px; }
.qb-selects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.qb-select { width: 100%; padding: 11px 36px 11px 14px; font-size: 14px; font-weight: 500; font-family: var(--font); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; appearance: none; cursor: pointer; outline: none; color: var(--text); transition: border-color var(--transition), box-shadow var(--transition); }
.qb-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.qb-select:disabled { background-color: var(--surface); color: var(--text-3); cursor: default; }
.qb-select-active { border-color: var(--primary) !important; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12) !important; }

/* Contract info card */
.qb-info { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); box-shadow: var(--shadow-sm); }
.qb-info-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.qb-info-row + .qb-info-row { border-top: 1px solid var(--border); }
.qb-info-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.qb-info-icon svg { width: 14px; height: 14px; }
.qb-info-label { font-size: 11px; font-weight: 600; color: #1e293b; text-transform: uppercase; letter-spacing: 0.3px; }
.qb-info-value { font-size: 14px; color: #1e293b; }
.qb-info-addr { font-family: var(--mono); font-size: 13px; color: #1e293b; word-break: break-all; }
.qb-info-addr a { color: var(--primary); }
.qb-info-addr a:hover { text-decoration: underline; }
.qb-info-sig { font-family: var(--mono); font-size: 13px; color: #1e293b; }

/* SQL Query card */
.qb-card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); box-shadow: var(--shadow-sm); }
.qb-editor-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.qb-editor-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.qb-editor-body { position: relative; }
.qb-textarea { display: block; width: 100%; border: none; outline: none; padding: 20px; font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace; font-size: 15px; font-weight: 450; line-height: 1.7; min-height: 180px; resize: vertical; color: #0f172a; background: var(--bg); -webkit-font-smoothing: auto; }
.qb-textarea::placeholder { color: var(--text-3); }
.qb-editor-actions { display: flex; gap: 6px; }

/* Results card */
.qb-results-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.qb-status { font-size: 13px; color: var(--text-3); }
.qb-tabs { display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.qb-tab { display: flex; align-items: center; gap: 4px; padding: 5px 12px; font-size: 12px; font-weight: 500; font-family: var(--font); color: var(--text-3); background: none; border: none; cursor: pointer; transition: all var(--transition); }
.qb-tab:hover { color: var(--text-2); }
.qb-tab.active { background: var(--primary-light); color: var(--primary); }
.qb-tab svg { flex-shrink: 0; }
/* Chart controls */
.qb-chart-controls { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.qb-chart-controls-row { display: flex; align-items: center; gap: 12px; }
.qb-axis-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.qb-axis-select { padding: 5px 28px 5px 10px; font-size: 13px; font-family: var(--font); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center; appearance: none; cursor: pointer; outline: none; color: var(--text); }
.qb-axis-select:focus { border-color: var(--primary); }
.qb-title-input { padding: 5px 10px; font-size: 13px; font-family: var(--font); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); outline: none; width: 160px; }
.qb-title-input:focus { border-color: var(--primary); }
.qb-title-input::placeholder { color: var(--text-3); }
.qb-chart-controls-row .btn { margin-left: auto; }
.qb-chart-wrap { padding: 20px; height: 380px; }
.qb-results { max-height: 400px; overflow: auto; }
.qb-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 24px; color: var(--text-3); }
.qb-placeholder-icon { opacity: 0.3; margin-bottom: 12px; }
.qb-placeholder-icon svg { width: 48px; height: 48px; }
.qb-placeholder p { font-size: 14px; }
.rate-limit-info { font-size: 12px; color: var(--text-3); text-align: right; }

/* --- Explore Section --- */
.section-explore { padding: 48px 0; border-top: 1px solid var(--border); }
.section-header { margin-bottom: 24px; }
.section-header-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.section-icon { color: var(--text-2); display: flex; }
.section-desc { color: var(--text-2); font-size: 14px; }
.explore-filters { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.explore-filter { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; font-size: 13px; font-weight: 500; font-family: var(--font); color: var(--text-2); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all var(--transition); }
.explore-filter:hover { border-color: var(--border-dark); }
.explore-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.explore-filter svg { flex-shrink: 0; }
.explore-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.explore-card { display: block; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); transition: all var(--transition); cursor: pointer; color: var(--text); text-decoration: none; }
.explore-card:hover { border-color: var(--border-dark); box-shadow: var(--shadow-md); text-decoration: none; }
.explore-card-icon { color: var(--primary); margin-bottom: 12px; display: flex; }
.explore-card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.explore-card-desc { font-size: 13px; color: var(--text-2); margin-bottom: 12px; line-height: 1.5; }
.explore-card-meta { display: flex; gap: 6px; }
.explore-badge { display: inline-flex; padding: 2px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: 11px; font-weight: 500; color: var(--text-2); text-transform: capitalize; }

/* --- Pricing Section --- */
.section-pricing { padding: 48px 0; border-top: 1px solid var(--border); }
.section-pricing h2 { margin-bottom: 4px; }
.section-pricing .section-desc { margin-bottom: 32px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 900px; margin: 0 auto; }
.pricing-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; position: relative; background: var(--bg); box-shadow: var(--shadow-sm); }
.pricing-card.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.pricing-popular { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: 12px; font-weight: 500; padding: 3px 14px; border-radius: 20px; white-space: nowrap; }
.pricing-card-head { margin-bottom: 16px; }
.pricing-card-head h3 { font-size: 1.125rem; font-weight: 500; margin-bottom: 2px; }
.pricing-card-head p { font-size: 13px; color: var(--text-2); }
.pricing-price { margin-bottom: 20px; }
.pricing-amount { font-size: 2rem; font-weight: 700; }
.pricing-period { font-size: 14px; color: var(--text-3); }
.pricing-features { list-style: none; margin-bottom: 24px; flex: 1; }
.pricing-features li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); padding: 4px 0; }
.pricing-features svg { flex-shrink: 0; color: var(--primary); }
.pricing-cta { width: 100%; text-align: center; margin-top: auto; }

/* --- API Section --- */
.section-api { padding: 48px 0; border-top: 1px solid var(--border); }
.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.api-content h2 { margin-bottom: 12px; }
.api-content > p { color: var(--text-2); font-size: 14px; line-height: 1.6; margin-bottom: 20px; }
.api-features { list-style: none; margin-bottom: 24px; }
.api-features li { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 5px 0; color: var(--text); }
.api-dot { color: var(--primary); display: flex; flex-shrink: 0; }
.api-code { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.api-code-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--text-2); }
.api-code-header svg { flex-shrink: 0; }
.api-code-block { margin: 0; padding: 20px; background: #1e293b; color: #e2e8f0; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; }
.api-code-block code { font-family: inherit; }

/* --- Docs Section --- */
.section-docs { padding: 48px 0; border-top: 1px solid var(--border); }
.section-docs h2 { margin-bottom: 4px; }
.section-docs .section-desc { margin-bottom: 32px; }
.docs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.docs-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; transition: all var(--transition); cursor: pointer; }
.docs-card:hover { border-color: var(--border-dark); box-shadow: var(--shadow-md); }
.docs-card-icon { color: var(--text-2); margin-bottom: 12px; }
.docs-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.docs-card p { font-size: 13px; color: var(--text-2); line-height: 1.5; }

/* --- Auth Pages --- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 56px); padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow); }
.auth-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 4px; text-align: center; }
.auth-subtitle { color: var(--text-2); font-size: 14px; text-align: center; margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-2); }

/* --- Page Layout --- */
.page { max-width: 800px; margin: 0 auto; padding: 32px 24px 64px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 4px; }
.page-title { font-size: 1.5rem; width: 100%; margin-bottom: 8px; }
.page-desc { font-size: 14px; color: var(--text-2); }

/* --- Dashboard Cards --- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.dash-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; background: var(--bg); transition: box-shadow var(--transition); }
.dash-card:hover { box-shadow: var(--shadow-md); }
.dash-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.dash-slug { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.dash-query-preview { font-family: var(--mono); font-size: 12px; color: var(--text-2); background: var(--surface); padding: 8px 10px; border-radius: 4px; margin: 12px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.dash-badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; }
.dash-badge.public { background: var(--success-bg); color: var(--success); }
.dash-badge.private { background: var(--surface-2); color: var(--text-3); }
.dash-actions { display: flex; gap: 4px; }

/* --- Settings Cards --- */
.settings-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); margin-bottom: 20px; }
.settings-card-header { display: flex; align-items: center; gap: 8px; padding: 16px 20px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--border); color: var(--text); }
.settings-card-header svg { color: var(--text-2); flex-shrink: 0; }
.settings-card-body { padding: 20px; }

/* --- Token List --- */
.token-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.token-item + .token-item { border-top: 1px solid var(--border); }
.token-name { font-weight: 600; font-size: 14px; }
.token-info { font-size: 12px; color: var(--text-2); margin-top: 2px; font-family: var(--mono); }
.tok-del-btn { color: var(--text-3); }
.tok-del-btn:hover { color: var(--error); }
.tok-warning { background: #fef9c3; border: 1px solid #fde68a; border-radius: var(--radius); padding: 12px 16px; font-size: 13px; color: #92400e; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.tok-secret-row { display: flex; align-items: stretch; gap: 8px; }
.tok-secret-value { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.tok-code-wrap { position: relative; }
.tok-copy-btn { position: absolute; top: 10px; right: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; cursor: pointer; color: var(--text-3); transition: all var(--transition); display: flex; align-items: center; justify-content: center; z-index: 1; }
.tok-copy-btn:hover { color: var(--text); border-color: var(--border-dark); }
.tok-code-block { margin: 0; padding: 16px 20px; padding-right: 48px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); font-family: var(--mono); font-size: 13px; line-height: 1.7; overflow-x: auto; color: var(--text); }
.tok-code-block code { font-family: inherit; }
.tok-cmd { color: var(--primary); font-weight: 600; }
.tok-str { color: #16a34a; }
.tok-cta { margin-top: 16px; padding: 16px; background: var(--primary-50); border: 1px solid var(--primary-light); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tok-cta p { font-size: 14px; color: var(--text-2); margin: 0; }

/* --- Modal --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-3); cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }

/* --- Account & Billing --- */
.info-grid { display: grid; grid-template-columns: 140px 1fr; gap: 12px 16px; font-size: 14px; align-items: center; }
.info-label { color: var(--text-3); font-weight: 500; }
.info-value { color: var(--text); text-align: right; }
.plan-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.plan-badge.free { background: var(--surface-2); color: var(--text-2); }
.plan-badge.paid { background: var(--primary-light); color: var(--primary); }

/* Billing plan comparison */
.billing-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.billing-plan-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; position: relative; }
.billing-plan-card.current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.billing-plan-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: 12px; font-weight: 500; padding: 3px 14px; border-radius: 20px; white-space: nowrap; }
.billing-plan-top { margin-bottom: 8px; }
.billing-plan-top h3 { font-size: 16px; font-weight: 600; }
.billing-plan-top p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.billing-plan-price { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.billing-plan-amount { font-size: 2rem; font-weight: 700; }
.billing-plan-period { font-size: 14px; color: var(--text-3); }
.billing-plan-features { list-style: none; flex: 1; margin-bottom: 16px; }
.billing-plan-features li { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 5px 0; color: var(--text); }
.billing-plan-features svg { color: var(--success); flex-shrink: 0; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty-icon { margin-bottom: 12px; opacity: 0.3; }
.empty-text { font-size: 15px; margin-bottom: 8px; font-weight: 500; color: var(--text-2); }

/* --- Create Form --- */
.create-form { border: 1px solid var(--primary-light); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; background: var(--primary-50); }
.create-form-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

/* --- Toast --- */
#toast-container { position: fixed; top: 68px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius); font-size: 14px; box-shadow: var(--shadow-md); animation: toastIn 0.2s ease; max-width: 360px; }
.toast-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.toast-error { background: var(--error-bg); color: #991b1b; border: 1px solid #fecaca; }
.toast-info { background: var(--primary-50); color: var(--primary-hover); border: 1px solid var(--primary-light); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* --- Spinner --- */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Success --- */
.success-card { text-align: center; padding: 12px 0; }
.success-icon { font-size: 48px; margin-bottom: 12px; color: var(--success); }

/* --- Chart --- */
.chart { padding: 20px; }
.chart-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 16px; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding: 0 4px; }
.chart-bar { flex: 1; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 4px; position: relative; transition: opacity 0.2s; cursor: default; }
.chart-bar:hover { opacity: 0.75; }
.chart-val { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-3); white-space: nowrap; display: none; }
.chart-bar:hover .chart-val { display: block; }
.chart-labels { display: flex; gap: 3px; padding: 6px 4px 0; }
.chart-label { flex: 1; text-align: center; font-size: 10px; color: var(--text-3); }

/* --- Line Chart --- */
.line-chart { padding: 20px; }
.line-chart svg { width: 100%; height: auto; }

/* --- Footer --- */
.footer { border-top: 1px solid var(--border); padding: 24px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-3); }
.footer-brand { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--text); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-3); font-size: 13px; }
.footer-links a:hover { color: var(--text-2); text-decoration: none; }

/* --- Utilities --- */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* --- Responsive --- */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    .hero { padding: 32px 0 40px; }
    .hero-stats { gap: 32px; }
    .qb-selects { grid-template-columns: 1fr; }
    .qb-info-row { flex-direction: column; gap: 8px; }
    .pricing-grid { grid-template-columns: 1fr; max-width: 400px; }
    .api-grid { grid-template-columns: 1fr; }
    .docs-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-links { display: none; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .dash-grid { grid-template-columns: 1fr; }
    .footer-inner { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
    .hero-stats { flex-direction: column; align-items: center; }
    .docs-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 20px; }
    .token-item { flex-direction: column; align-items: flex-start; gap: 8px; }
    .billing-plans { grid-template-columns: 1fr; }
    .explore-grid { grid-template-columns: 1fr; }
}
