/* ==========================================================================
   SHAPE ENGINE - GLOBAL DESIGN SYSTEM (UTILITARIAN MINIMALISM)
   ========================================================================== */

:root {
    --bg-base: #f4f4f5;      
    --bg-surface: #ffffff;   
    --bg-panel: #fbfbfb;     
    --bg-hover: #e4e4e7;     
    
    --border-hard: #a1a1aa;  
    --border-light: #e4e4e7; 
    --border-dark: #18181b;  
    
    --text-main: #09090b;    
    --text-muted: #52525b;   
    
    --accent-text: #b45309;     
    --accent-bg: #facc15;       
    --status-good: #16a34a;     
    --status-error: #dc2626;    
    --status-neutral: #2563eb;  
    --status-ambient: #0d9488;  

    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
}

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

body { 
    background-color: var(--bg-base); 
    color: var(--text-main); 
    font-family: var(--font-ui); 
    font-size: 14px;
    padding: 2rem 1rem; 
    line-height: 1.6;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
.text-muted { color: var(--text-muted); }
.mono-text { font-family: var(--font-mono); }
.label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2;}
h1 { font-size: 2rem; margin-bottom: 0.25rem; text-transform: uppercase; }
h2 { font-size: 1.25rem; margin-bottom: 1rem; text-transform: uppercase; }
.value { font-family: var(--font-mono); font-size: 1.5rem; color: var(--text-main); margin-top: 0.25rem; }

/* ==========================================================================
   LAYOUTS
   ========================================================================== */
.sys-container { max-width: 900px; margin: 0 auto; }
.sys-main { max-width: 1400px; margin: 0 auto; }
.sys-header { border-bottom: 2px solid var(--border-dark); padding-bottom: 1.5rem; margin-bottom: 2rem; }
.header-content, .header-flex { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.sys-header p { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; margin-top: 0.25rem; }
.hidden { display: none !important; }
.brand-link { display: flex; align-items: center; gap: 1.25rem; color: inherit; text-decoration: none; }
.brand-group { display: flex; align-items: center; gap: 1.25rem; }
.brand-home { display: block; }
.brand-logo { height: 3.5rem; width: auto; display: block; }
.full-width { width: 100%; }
.section-spaced { margin-top: 1.5rem; }
.section-copy { margin-bottom: 1rem; }
.compact-copy { font-size: 0.85rem; }
.capitalize { text-transform: capitalize; }
.feature-list { margin-top: 1rem; padding-left: 1.25rem; line-height: 1.8; }
.feature-value { font-size: 1.25rem; font-weight: 700; margin-top: 0.5rem; }
.feature-copy { margin-top: 0.5rem; font-size: 0.85rem; }
.primary-cta { display: flex; justify-content: flex-end; gap: 0.75rem; margin: 2rem 0 4rem; }
.primary-cta .btn { font-size: 1rem; padding: 1rem 2rem; height: auto; }
.landing-eyebrow { display: block; margin-bottom: 0.75rem; }
.landing-hero h1 { font-size: clamp(2rem, 6vw, 3.25rem); max-width: 18ch; text-transform: none; }
.landing-lead { max-width: 68ch; margin-top: 1rem; font-size: 1rem; }
.landing-section-heading { margin-top: 0.4rem; }
.landing-copy-stack { display: grid; gap: 0.85rem; }
.landing-copy-stack a, .context-links a, .use-case-grid a { color: var(--text-main); text-underline-offset: 0.2em; }
.context-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin-top: 1rem; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.comparison-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shape-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.use-cases-heading { margin-top: 0.4rem; }
.use-case-grid { margin-top: 1rem; }
.use-case-grid h3 { font-size: 1rem; text-transform: uppercase; }
.use-case-grid a { display: inline-block; }

a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent-bg); outline-offset: 4px; }

.sys-alert { font-family: var(--font-mono); font-size: 0.85rem; text-transform: uppercase; padding: 1rem; border: 1px solid var(--border-hard); background: var(--bg-surface); color: var(--text-muted); margin-bottom: 1.5rem; }

/* ==========================================================================
   METERS & ALERTS
   ========================================================================== */
.date-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.custom-date-wrapper { display: flex; align-items: center; gap: 0.5rem; }
.view-mode-controls { margin-bottom: 1rem; }
.shape-averages-explainer { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; }
.shape-averages-explainer { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-hard); }
.usage-meter { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; }
.usage-warning { color: var(--accent-text); border-color: var(--accent-text); }
.usage-danger { color: var(--bg-surface); background: var(--status-error); border-color: var(--status-error); }
.usage-danger .text-muted { color: var(--bg-surface); opacity: 0.9; }

/* ==========================================================================
   MECHANICAL CARDS & 1PX GRIDS
   ========================================================================== */
.sys-card { background: var(--bg-surface); border: 1px solid var(--border-hard); padding: 1.5rem; margin-bottom: 1.5rem; }
.pitch h2 { margin-bottom: 1rem; font-size: 1.5rem; }
.article-card { display: block; text-decoration: none; transition: background 0.1s; cursor: pointer; border-color: var(--border-dark); }
.article-card:hover { background: var(--bg-hover); }
.article-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; flex-wrap: wrap; gap: 0.5rem; }
.article-heading h2 { margin: 0; color: var(--text-main); font-size: 1.25rem; }
.article-date { font-size: 0.75rem; }
.article-copy { font-size: 0.85rem; line-height: 1.6; margin-top: 0.5rem; }
.article-action { margin-top: 1rem; text-align: right; color: var(--status-neutral); }

/* Public navigation */
.site-footer { border-top: 2px solid var(--border-dark); padding-top: 1.5rem; margin-top: 4rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.site-footer--compact { margin-top: 2rem; }
.site-footer-brand { color: var(--text-main); }
.site-footer-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; }
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--text-main); }

/* Pricing configurator: discrete catalog-backed mechanical controls */
.pricing-plan-grid { grid-template-columns: repeat(2, 1fr); }
.pricing-free-plan { box-shadow: inset 0 3px 0 var(--accent-bg); }
.pricing-paid-preview { background: var(--bg-panel) !important; }
.pricing-plan-price, .pricing-price { font-family: var(--font-mono); font-weight: 700; font-size: 1.8rem; margin: 0.5rem 0; }
.pricing-plan-copy { margin-top: 0.75rem; }
.pricing-plan-cta { margin-top: 1.25rem; }
.pricing-control { padding: 1.25rem 0; border-bottom: 1px dashed var(--border-hard); }
.pricing-control label { display: block; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; }
.pricing-control output { display: block; font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; margin: 0.35rem 0 0.75rem; }
.pricing-range { width: 100%; accent-color: var(--border-dark); cursor: pointer; }
.pricing-range:focus-visible { outline: 3px solid var(--accent-bg); outline-offset: 4px; }
.pricing-range-labels { display: flex; justify-content: space-between; gap: 0.25rem; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; margin-top: 0.4rem; }
.pricing-selection { padding-top: 1.5rem; }
.pricing-account-guidance { margin-top: 0.35rem; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; }
.pricing-account-guidance a { color: inherit; font-weight: 700; text-underline-offset: 0.2em; }
.pricing-preview { margin-top: 1.25rem; margin-bottom: 0; }
.pricing-billing-status { min-height: 1.5rem; margin-top: 0.75rem; font-family: var(--font-mono); font-size: 0.75rem; }
.pricing-footer { margin-top: 2rem; }

@media (max-width: 620px) {
    .pricing-plan-grid { grid-template-columns: 1fr; }
    .comparison-grid, .shape-overview-grid { grid-template-columns: 1fr; }
    .pricing-paid-preview .pricing-plan-price, .pricing-price { font-size: 1.25rem; white-space: nowrap; }
    .pricing-range-labels { font-size: 0.52rem; }
    .pricing-range-labels span:nth-child(even) { display: none; }
}

/* 1px Mechanical Grids */
.sys-grid, .summary-grid, .shape-grid { 
    display: grid; 
    gap: 1px; 
    background-color: var(--border-hard); 
    border: 1px solid var(--border-hard); 
    margin-bottom: 1rem; 
}

/* FORCE grid children to snap perfectly and ignore any inherited card margins/borders */
.sys-grid > div, .summary-grid > div, .shape-grid > div { 
    background: var(--bg-surface); 
    padding: 1.5rem; 
    margin: 0 !important; 
    border: none !important; 
    height: 100%;
}

.sys-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.sys-grid.comparison-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sys-grid.shape-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shape-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border-top: none; }
.shape-card .value { font-size: 1.1rem; }
.table-result-note { margin: 0 0 0.75rem; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; }

/* Settings Grid (Different layout, not 1px segment lines) */
.settings-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 1.5rem; padding: 1.5rem; background: var(--bg-panel); }
.settings-group { display: flex; flex-direction: column; gap: 0.5rem; }
.settings-status { grid-column: 1 / -1; font-family: var(--font-mono); font-size: 0.75rem; padding-top: 1rem; border-top: 1px dashed var(--border-hard); display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.status-dot { width: 8px; height: 8px; background-color: var(--status-good); display: inline-block; }

/* ==========================================================================
   DOMAIN CARDS (ACCOUNT TERMINAL)
   ========================================================================== */
.domain-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-hard);
    display: flex;
    flex-direction: column;
}

.account-console-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; margin-top: 1.5rem; }
.account-console-actions .btn-accent { min-width: 250px; }
.account-logout { background: transparent; }
.account-domains h2 { margin-bottom: 0.75rem; }
.account-domains-grid { display: flex; flex-direction: column; gap: 1.25rem; width: 100%; max-width: 780px; }
.account-empty { max-width: 780px; margin-bottom: 0; }
.account-empty p { margin: 0.75rem 0 1rem; }
.billing-domain-card { padding-bottom: 0; }
.billing-domain-details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; padding: 0.8rem 1rem; }
.billing-domain-detail { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.billing-domain-detail strong { display: block; margin-top: 0.15rem; color: var(--text-main); overflow-wrap: anywhere; }
.analytics-capabilities-control { display: flex; align-items: center; }
.analytics-capabilities-info { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; line-height: 1; cursor: pointer; }
.analytics-capabilities-info:hover { color: var(--text-main); text-decoration: underline; text-underline-offset: 0.15em; }
.analytics-capabilities-info:focus:not(:focus-visible) { outline: none; }
.analytics-capabilities-info:focus-visible { outline: 1px dashed var(--border-dark); outline-offset: 1px; }
.billing-domain-notice { margin: 0 1rem 0.75rem; padding: 0.75rem; }
.billing-domain-notice:last-of-type { margin-bottom: 0.75rem; }
.domain-keys { border-top: 1px solid var(--border-hard); }
.domain-key + .domain-key { border-top: 1px solid var(--border-hard); }
.domain-analytics-action { width: 100%; height: 38px; border-inline: 0; }
.domain-utility-actions { display: grid; gap: 1px; background: var(--border-hard); border-top: 1px solid var(--border-hard); }
.domain-action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
        "deployment-top plan-top stop-top"
        "deployment-bottom plan-bottom stop-bottom";
}
.action-deployment-top { grid-area: deployment-top; }
.action-deployment-bottom { grid-area: deployment-bottom; }
.action-plan-top { grid-area: plan-top; }
.action-plan-bottom { grid-area: plan-bottom; }
.action-stop-top { grid-area: stop-top; }
.action-stop-bottom { grid-area: stop-bottom; }
.billing-portal-status { min-height: 1.25rem; margin: 0.75rem 1.25rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.billing-portal-status:empty { display: none; }
.billing-warning { border-color: var(--status-error); color: var(--status-error); }
.reader-access { border-top: 1px solid var(--border-hard); padding: 0.75rem 1rem; }
.reader-access-heading { margin-bottom: 0.45rem; }
.reader-access-list { font-family: var(--font-mono); font-size: 0.75rem; }
.reader-access-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-bottom: 1px dashed var(--border-light); }
.reader-access-row a { color: var(--text-main); overflow-wrap: anywhere; }
.reader-access-remove { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-family: var(--font-ui); font-size: 0.65rem; font-weight: 700; padding: 0.2rem; }
.reader-access-remove:hover:not(:disabled) { color: var(--text-main); }
.reader-access-add { height: 30px; margin-top: 0.55rem; padding: 0.35rem 0.7rem; background: transparent; }
.reader-access-status { min-height: 1rem; margin: 0.45rem 0 0; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.68rem; }
.reader-access-status:empty { display: none; }
.internal-preview { border-top: 1px solid var(--border-hard); padding: 0.75rem 1rem; }
.internal-preview-heading { margin-bottom: 0.45rem; }
.internal-preview-toggle { display: flex; align-items: center; gap: 0.65rem; width: fit-content; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; color: var(--text-main); cursor: pointer; }
.internal-preview-toggle input { accent-color: var(--accent); cursor: pointer; }
.internal-preview-toggle input:disabled { cursor: wait; }
.internal-preview-status { margin: 0.4rem 0 0; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.66rem; }

@media (max-width: 600px) {
    .account-console-actions { margin-top: 1.25rem; }
    .account-console-actions .btn-accent { width: 100%; min-width: 0; }
    .domain-action-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "deployment-top"
            "deployment-bottom"
            "plan-top"
            "plan-bottom"
            "stop-top"
            "stop-bottom";
    }
    .billing-domain-details { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; }
}

.domain-card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.domain-card-heading { min-width: 0; }
.domain-card-statuses { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.domain-operational-status { font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700; color: var(--status-good); letter-spacing: 0.05em; }
.billing-state-label { font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700; text-transform: uppercase; }
.billing-state-warning { color: var(--status-error); }

.domain-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    overflow-wrap: anywhere;
}

.key-copy-row {
    padding: 0.6rem 1rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-hard);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: background 0.1s, color 0.1s;
}
.key-copy-identity { display: flex; align-items: center; min-width: 0; gap: 0.6rem; }
.key-copy-label { margin-left: 1rem; font-family: var(--font-ui); font-size: 0.65rem; font-weight: 700; color: var(--text-muted); }
.key-copy-row:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}
.key-copy-row.copied {
    background: var(--accent-bg);
    color: #000;
    font-weight: 700;
}

.key-label {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--status-good);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.5rem;
}

.card-actions-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border-hard);
    border-bottom: 1px solid var(--border-hard);
}
.card-actions-split .btn,
.domain-utility-actions .btn {
    width: 100%;
    min-width: 0;
    border: none;
    background: var(--bg-surface);
    color: #000;
    height: 36px;
    padding: 0.4rem 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: uppercase;
    text-decoration: none;
}
.card-actions-split .btn:hover:not(:disabled),
.domain-utility-actions .btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: #000;
}
.card-actions-split .btn:focus-visible,
.domain-utility-actions .btn:focus-visible {
    background: var(--bg-hover);
    color: #000;
    outline: 2px solid var(--border-dark);
    outline-offset: -2px;
}

.domain-analytics-action { font-size: 0.85rem; }

/* ==========================================================================
   INPUTS & BUTTONS
   ========================================================================== */
.mono-input { font-family: var(--font-mono); font-size: 0.85rem; background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border-hard); padding: 0.75rem; border-radius: 0; width: 100%; margin-bottom: 1rem; color-scheme: light; }
.mono-input:focus { outline: none; border-color: var(--border-dark); box-shadow: inset 0 0 0 1px var(--border-dark); }
.input-group { display: flex; }
.input-group .mono-input { border-right: none; margin-bottom: 0; }

.control-bar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: flex-start; margin-bottom: 0.5rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-ui); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border-hard); padding: 0.75rem 1.5rem; cursor: pointer; text-transform: uppercase; text-align: center; text-decoration: none; white-space: nowrap; height: 38px; transition: all 0.1s; }
.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-accent { color: #000000; background: var(--accent-bg); border-color: var(--border-dark); }
.btn-accent:hover:not(:disabled) { background: #eab308; }
.btn-danger { color: var(--status-error); border-color: var(--status-error); background: transparent; }
.btn-danger:hover { background: var(--status-error); color: var(--bg-surface); }

.toggle-label { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; color: var(--text-muted); cursor: pointer; text-transform: uppercase; }
.toggle-label:hover { color: var(--text-main); }
.mono-checkbox { accent-color: var(--border-dark); cursor: pointer; width: 14px; height: 14px; }
.input-no-margin { margin-bottom: 0; }

/* Account and authentication */
.auth-card { width: 100%; max-width: 500px; margin-inline: auto; }
.auth-copy { font-size: 0.85rem; margin-bottom: 1.5rem; }
.auth-copy--email { margin-bottom: 1rem; }
.auth-secondary { margin-top: 1rem; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; }
.auth-secondary a { color: inherit; font-weight: 700; text-underline-offset: 0.2em; white-space: nowrap; }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.5rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--border-hard); flex: 1; }
.auth-verifying { text-align: center; padding: 2rem 0; }
.auth-verifying p { margin-top: 1rem; }
.reader-login-status { min-height: 1.25rem; margin: 1rem 0 0; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; }
.warning-accent { border-color: var(--accent-text); color: var(--accent-text); }
.dashboard-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.dashboard-control-group { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.tier-row { display: flex; align-items: center; gap: 0.5rem; }
.tier-label { color: var(--text-main); font-size: 0.75rem; letter-spacing: 0.05em; }
.tier-label--paid { color: var(--status-good); }
.pricing-link { font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-decoration: none; }
.button-row { display: flex; gap: 0.5rem; }
.zone-list, .stack { display: flex; flex-direction: column; gap: 0.5rem; }
.signup-container { max-width: 600px; }
.turnstile-wrap { display: flex; justify-content: center; margin-bottom: 1rem; }
.success-card { border-color: var(--border-dark); }
.success-title { color: var(--status-good); }
.error-card { border-color: var(--status-error); }
.error-title { color: var(--status-error); }
.state-copy { margin-bottom: 1.5rem; }

/* ==========================================================================
   DETAILS / ACCORDIONS & DROPDOWNS
   ========================================================================== */
.sys-details { border: 1px solid var(--border-hard); margin-bottom: 1rem; background: var(--bg-surface); display: block; }
.sys-details summary { padding: 0.75rem 1rem; cursor: pointer; user-select: none; background: var(--bg-panel); list-style: none; display: flex; align-items: center; font-family: var(--font-ui); font-size: 0.65rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.1em; }
.sys-details summary::-webkit-details-marker { display: none; }
.sys-details summary::before { content: "[+]"; font-family: var(--font-mono); margin-right: 0.75rem; color: var(--text-main); font-weight: 700; font-size: 0.85rem; letter-spacing: normal; text-transform: none; }
.sys-details[open] summary::before { content: "[-]"; }
.sys-details[open] summary { border-bottom: 1px solid var(--border-hard); color: var(--text-main); }
.sys-details summary:hover { color: var(--text-main); }

/* ==========================================================================
   SHAPE GUIDE (ANALYTICS)
   ========================================================================== */
.guide-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--border-hard);
}

@media (min-width: 900px) {
    .guide-content {
        grid-template-columns: 1fr 1fr;
    }
}

.guide-block {
    background: var(--bg-surface);
    padding: 1.5rem;
}

.guide-block-wide {
    grid-column: 1 / -1;
}

.guide-intro {
    grid-column: 1 / -1;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 1rem 1.5rem;
}

.guide-block h4 {
    margin-bottom: 0.75rem;
}

.guide-block p {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.guide-block ul {
    list-style-type: square;
    margin-left: 1.25rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.guide-block li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.ambient-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0 !important;
}

.dropdown { position: relative; }
.dropdown-content { position: absolute; left: 0; top: 100%; margin-top: 0.25rem; background: var(--bg-surface); border: 1px solid var(--border-hard); padding: 0.75rem; width: 200px; max-height: 300px; overflow-y: auto; z-index: 50; display: flex; flex-direction: column; gap: 0.5rem; box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.05); }
.dropdown-content label { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.75rem; cursor: pointer; color: var(--text-muted); }
.dropdown-content label:hover { color: var(--text-main); }

.filter-dropdown { position: absolute; background: var(--bg-surface); border: 1px solid var(--border-dark); box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.1); z-index: 100; min-width: 150px; max-height: 250px; overflow-y: auto; font-family: var(--font-mono); font-size: 0.75rem; display: flex; flex-direction: column; }
.filter-item { padding: 0.5rem 1rem; cursor: pointer; color: var(--text-main); border-bottom: 1px solid var(--border-light); }
.filter-item:hover { background: var(--bg-hover); }
.filter-item:last-child { border-bottom: none; }
.filter-item.active { background: var(--bg-panel); font-weight: bold; border-left: 3px solid var(--accent-text); padding-left: calc(1rem - 3px); }

/* ==========================================================================
   OUTPUT / TERMINAL BLOCKS
   ========================================================================== */
.json-output { background: var(--bg-panel); border: 1px solid var(--border-dark); padding: 1.5rem; font-family: var(--font-mono); font-size: 0.8rem; overflow-x: auto; color: var(--text-main); margin-bottom: 0; }
.json-key { color: var(--accent-text); }

/* ==========================================================================
   TABLE ENGINE
   ========================================================================== */
.table-wrapper { max-height: 70vh; overflow-x: auto; overflow-y: auto; border: 1px solid var(--border-hard); background: var(--bg-surface); margin-top: 0; margin-bottom: 2rem; }
.sys-table { width: 100%; border-collapse: collapse; text-align: left; font-family: var(--font-mono); font-size: 0.8rem; background: var(--bg-surface); margin-bottom: 0; }
.sys-table th { position: sticky; top: 0; background: var(--bg-panel); z-index: 10; padding: 0.75rem; color: var(--text-muted); font-family: var(--font-ui); font-size: 0.65rem; font-weight: 700; text-transform: uppercase; border-bottom: 2px solid var(--border-dark); border-right: 1px solid var(--border-hard); vertical-align: middle; }
.sys-table td { padding: 0.75rem; border-bottom: 1px solid var(--border-light); border-right: 1px solid var(--border-hard); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-table th:last-child, .sys-table td:last-child { border-right: none; }
.sys-table tr:hover td { background: var(--bg-hover); }

.th-wrapper { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 1rem; }
.th-title { color: var(--text-muted); font-family: var(--font-ui); font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 0.35rem; user-select: none; flex: 1; overflow: hidden; }
.th-title:hover { color: var(--text-main); }
.sort-icon { display: inline-block; font-size: 0.6rem; color: var(--accent-text); }
.th-filter-btn { cursor: pointer; padding: 0.15rem; color: var(--border-hard); transition: color 0.1s; display: flex; align-items: center; justify-content: center; }
.th-filter-btn:hover { color: var(--text-main); }
.th-filter-btn.active { color: var(--accent-text); }
.col-center { text-align: center; width: 60px; }

/* Column Resizer */
.resizer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    user-select: none;
    z-index: 15;
}
.resizer:hover, .resizer.dragging {
    background-color: var(--border-dark);
}
body.is-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}

/* Status Badges */
.shape-badge { display: inline-block; padding: 0.15rem 0.4rem; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; white-space: nowrap; border: 1px solid; background: transparent; }
.badge-steady { color: var(--status-good); border-color: var(--status-good); }
.badge-burst { color: var(--accent-text); border-color: var(--accent-text); }
.badge-drift { color: var(--status-neutral); border-color: var(--status-neutral); }
.badge-chaotic { color: var(--status-error); border-color: var(--status-error); }
.badge-flat { color: var(--text-muted); border-color: var(--border-hard); }
.badge-ambient { color: var(--status-ambient); border-color: var(--status-ambient); } 
.badge-undetermined { color: #000000; background: var(--accent-bg); border-color: var(--border-dark); }

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(244, 244, 245, 0.9); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: var(--bg-surface); border: 2px solid var(--border-dark); width: 400px; box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.15); display: flex; flex-direction: column; max-width: 90vw; }
.modal-content h4 { padding: 1rem; border-bottom: 1px solid var(--border-hard); background: var(--bg-panel); margin: 0;}
.modal-body { padding: 1.5rem 1rem; }
.modal-actions { padding: 1rem; border-top: 1px solid var(--border-hard); display: flex; justify-content: flex-end; gap: 0.5rem; background: var(--bg-panel); }
.modal-medium { width: 500px; }
.modal-wide { width: 750px; max-width: 95vw; }
.modal-diagnostic { width: 600px; max-width: 95vw; }
.modal-copy { margin: 0 0 1rem; font-size: 0.85rem; }
.modal-secondary-action { margin-top: 0.75rem; font-size: 0.75rem; }
.modal-title-row { display: flex; justify-content: space-between; align-items: center; }
.modal-close-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; }
.analytics-capabilities-dialog { width: min(440px, calc(100vw - 2rem)); max-width: none; max-height: calc(100vh - 2rem); margin: auto; padding: 0; overflow: auto; color: var(--text-main); background: var(--bg-surface); border: 2px solid var(--border-dark); box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.15); }
.analytics-capabilities-dialog::backdrop { background: rgba(244, 244, 245, 0.9); }
.analytics-capabilities-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-hard); background: var(--bg-panel); }
.analytics-capabilities-dialog-header h2 { margin: 0; }
.analytics-capabilities-close { width: 44px; height: 44px; flex: 0 0 44px; font-size: 1.5rem; line-height: 1; }
.analytics-capabilities-close:focus-visible { outline: 3px solid var(--accent-bg); outline-offset: -3px; }
.analytics-capabilities-dialog-body { display: grid; gap: 1rem; padding: 1rem; }
.analytics-capabilities-dialog-body p { margin-top: 0.3rem; color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; }
.modal-scroll-body { overflow-y: auto; max-height: 75vh; padding-top: 1rem; }
.wizard-step { margin-bottom: 2rem; }
.wizard-label { color: var(--text-main); font-size: 0.75rem; }
.wizard-copy { margin: 0.5rem 0 1rem; font-size: 0.85rem; }
.proxy-buttons { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.proxy-btn { padding: 0.25rem 0.75rem; color: var(--text-muted); background: transparent; border-color: var(--border-hard); }
.proxy-btn.active { color: var(--text-main); background: var(--bg-surface); border-color: var(--text-main); }
.proxy-instructions { background: var(--bg-panel); border: 1px solid var(--border-dark); padding: 1.5rem; }
.proxy-copy { margin-bottom: 1rem; font-size: 0.85rem; }
.copy-icon { margin-right: 0.75rem; opacity: 0.7; }
.key-copy-row--start { justify-content: flex-start; }
.card-actions-three { grid-template-columns: repeat(3, 1fr); }
.reload-icon { vertical-align: middle; cursor: pointer; margin-left: 4px; transition: color 0.1s; }
.wizard-copy-button { margin-top: 1rem; }
.wizard-verification { margin-top: 2rem; border-top: 1px dashed var(--border-hard); padding-top: 1.5rem; }
.wizard-verification p { margin-top: 0.5rem; font-size: 0.85rem; }
.escape-hatch { text-align: center; margin-top: 2.5rem; }
.escape-hatch a { font-size: 0.7rem; text-decoration: underline; }
.legal-modal-body { padding-bottom: 0.5rem; }
.legal-link { display: block; text-decoration: none; transition: background 0.1s; margin-bottom: 1rem; cursor: pointer; }
.legal-back-nav { margin-bottom: 1rem; }
.legal-link .label { color: var(--text-main); font-size: 0.85rem; }

/* Legal documents */
.legal-page { max-width: 800px; }
.legal-document h2 { margin-top: 2rem; border-bottom: 1px solid var(--border-light); padding-bottom: 0.5rem; }
.legal-document p, .legal-document li { margin-bottom: 1rem; color: var(--text-muted); }
.legal-document ul { padding-left: 1.25rem; }
.legal-date { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

/* Analytics layout; runtime-calculated table/filter dimensions remain in JS. */
.analytics-container { max-width: 1400px; }
.analytics-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; }
.analytics-return { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); text-decoration: none; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.15rem; display: inline-block; }
.analytics-title { font-size: 1.5rem; margin: 0; }
.analytics-header-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.analytics-context { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.shape-guide { margin-top: 1rem; }
.table-controls { margin: 1rem 0; }

/* ==========================================================================
   DIAGNOSTIC TERMINAL
   ========================================================================== */
.terminal-window {
    background-color: #050505;
    color: #00ff41;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 1rem;
    height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-dark);
    line-height: 1.5;
    text-shadow: 0 0 3px rgba(0, 255, 65, 0.4);
}

.terminal-window::-webkit-scrollbar {
    width: 8px;
}
.terminal-window::-webkit-scrollbar-track {
    background: #050505;
}
.terminal-window::-webkit-scrollbar-thumb {
    background: #333;
}

.terminal-line {
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 1em;
    background-color: #00ff41;
    vertical-align: text-bottom;
    animation: terminal-blink 1s step-end infinite;
    margin-left: 4px;
    box-shadow: 0 0 3px rgba(0, 255, 65, 0.4);
}

@keyframes terminal-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.terminal-error { color: #ff003c; text-shadow: 0 0 3px rgba(255, 0, 60, 0.4); }
.terminal-success { color: #00ff41; }
.terminal-system { color: #00d0ff; text-shadow: 0 0 3px rgba(0, 208, 255, 0.4); }

/* ==========================================================================
   MOBILE OPTIMIZATIONS
   ========================================================================== */
@media (max-width: 600px) {
    .sys-grid.comparison-grid, .sys-grid.shape-overview-grid { grid-template-columns: 1fr; }
    .header-content, .header-flex { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .header-content .btn, .header-flex .btn { width: 100%; margin-top: 0.5rem; }
    .date-controls { width: 100%; flex-direction: column; align-items: flex-start; }
    .date-controls select { width: 100%; }
    .custom-date-wrapper { width: 100%; flex-direction: column; align-items: stretch; }
    .custom-date-wrapper .btn { margin-top: 0; }
    .analytics-header-controls { width: 100%; flex-direction: column; align-items: stretch; }
    .analytics-context { align-items: flex-start; }
    
    .sys-table { display: block; overflow-x: auto; }
    .table-wrapper { border-left: none; border-right: none; margin: 0 -1rem 2rem -1rem; width: calc(100% + 2rem); }
    .summary-grid { grid-template-columns: 1fr 1fr; }
    .summary-grid > div { padding: 1rem; }
    .summary-grid .label { font-size: 0.68rem; white-space: nowrap; }
    .settings-grid { grid-template-columns: 1fr; }
    .primary-cta, .button-row { flex-direction: column; }
    .primary-cta .btn, .button-row .btn { width: 100%; }
    .header-flex > .button-row { width: 100%; flex-direction: row; gap: 0.5rem; }
    .header-flex > .button-row .btn { flex: 1 1 0; min-width: 0; width: auto; margin-top: 0; }
    .landing-header > .button-row { flex-direction: column; }
    .landing-header > .button-row .btn { width: 100%; }
    .articles-header > .btn { width: auto; align-self: flex-end; margin-top: 0; }
    .site-footer { align-items: flex-start; }
    .site-footer-nav { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem 1rem; }

    .landing-page { padding-block: 1.6rem; }
    .landing-page .sys-header { padding-bottom: 1.2rem; margin-bottom: 1.6rem; }
    .landing-page .sys-card { padding: 1.2rem; margin-bottom: 1.2rem; }
    .landing-page .section-spaced { margin-top: 1.2rem; }
    .landing-page .sys-grid > div { padding: 1.2rem; }
    .landing-page .json-output { padding: 1.2rem; font-size: 0.75rem; }
    .landing-page .primary-cta { margin: 1.6rem 0 3.2rem; }
    .landing-page .site-footer { padding-top: 1.2rem; margin-top: 3.2rem; }
}
