/* app.css -- Hedgehog front page styles */

/* --- Design Tokens --- */
:root {
    --hh-border-subtle: rgba(255, 255, 255, 0.06);
    --hh-border-grid: rgba(255, 255, 255, 0.08);
    --hh-border-strong: rgba(255, 255, 255, 0.1);
    --hh-text-primary: #e2e8f0;
    --hh-text-secondary: #94a3b8;
    --hh-text-muted: #64748b;
    --hh-text-heading: #f1f5f9;
    --hh-bg-base: #0f1724;
    --hh-bg-surface: #1a2332;
    --hh-bg-header: #141d2b;
    --hh-bg-hover: rgba(74, 158, 255, 0.08);
    --hh-accent: #4a9eff;
    --hh-accent-hover: #3b8de6;
    --hh-error: #ef4444;
    --hh-font-size-xs: 11px;
    --hh-font-size-sm: 12px;
    --hh-font-size-base: 13px;
    --hh-font-size-md: 14px;
    --hh-radius-sm: 4px;
    --hh-radius-md: 6px;
    --hh-radius-lg: 8px;
    --hh-font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #e2e8f0;
    background: #0f1724;
}

a { color: #4a9eff; text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
    margin: 0 0 0.5em;
    font-weight: 600;
    color: #f1f5f9;
}

/* --- Header --- */
.hh-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    background: #1a2332;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.hh-header-left {
    display: flex;
    align-items: center;
}

.hh-header-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hh-header-link {
    color: var(--hh-text-secondary);
    font-size: var(--hh-font-size-sm);
    text-decoration: none;
    transition: color 0.15s;
}
.hh-header-link:hover {
    color: var(--hh-text-primary);
    text-decoration: none;
}

.hh-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hh-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #f1f5f9;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hh-logo:hover {
    text-decoration: none;
    color: #fff;
}

.hh-logo-icon {
    flex-shrink: 0;
}

/* --- Buttons --- */
.hh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.hh-btn:hover { text-decoration: none; }

.hh-btn-primary {
    background: #4a9eff;
    color: #fff;
    border-color: #4a9eff;
}

.hh-btn-primary:hover {
    background: #3b8de6;
    border-color: #3b8de6;
}

.hh-btn-secondary {
    background: transparent;
    color: #cbd5e1;
    border-color: #334155;
}

.hh-btn-secondary:hover {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

.hh-btn-lg {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: 8px;
}

.hh-btn-login {
    background: #fff;
    color: #1a2332;
    font-weight: 600;
    border-color: #fff;
}

.hh-btn-login:hover {
    background: #e2e8f0;
    border-color: #e2e8f0;
}

/* --- User Menu --- */
.hh-user-menu {
    position: relative;
}

.hh-avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #cbd5e1;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.15s ease;
}

.hh-avatar-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.hh-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #4a9eff;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.hh-user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hh-chevron {
    flex-shrink: 0;
    opacity: 0.6;
}

/* Dropdown */
.hh-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    z-index: 200;
}

.hh-dropdown.open {
    display: block;
    animation: hh-dropdown-in 0.15s ease;
}

@keyframes hh-dropdown-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.hh-dropdown-info {
    padding: 12px 16px;
}

.hh-dropdown-name {
    font-weight: 600;
    color: #f1f5f9;
    font-size: 13px;
}

.hh-dropdown-email {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
    word-break: break-all;
}

.hh-dropdown-divider {
    height: 1px;
    background: #334155;
}

.hh-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: #cbd5e1;
    text-align: left;
    transition: background 0.1s ease;
}

.hh-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}

/* --- Layout --- */
.hh-layout {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* --- Sidebar --- */
.hh-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--hh-bg-header);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
}

.hh-sidebar-header {
    padding: 20px 20px 0;
}

.hh-sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.hh-sidebar-filters {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hh-filter-row {
    display: flex;
    gap: 8px;
}

.hh-filter-row .hh-filter-select {
    flex: 1;
    min-width: 0;
}

.hh-filter-select,
.hh-search-input {
    display: block;
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid #334155;
    border-radius: 6px;
    background: #1a2332;
    color: #e2e8f0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hh-filter-select:focus,
.hh-search-input:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.15);
}

.hh-filter-select option {
    background: #1a2332;
    color: #e2e8f0;
}

/* Document list */
.hh-document-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px;
}

.hh-document-list::-webkit-scrollbar {
    width: 6px;
}

.hh-document-list::-webkit-scrollbar-track {
    background: transparent;
}

.hh-document-list::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.hh-doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s ease;
    text-decoration: none;
    color: #cbd5e1;
}

.hh-doc-item:hover,
.hh-doc-item:focus-visible {
    background: rgba(74, 158, 255, 0.08);
    color: #f1f5f9;
    text-decoration: none;
}

.hh-doc-item:focus-visible {
    outline: 2px solid var(--hh-accent);
    outline-offset: -2px;
}

.hh-doc-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    object-fit: contain;
    image-rendering: auto;
}

.hh-doc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.hh-doc-name {
    flex: 1;
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hh-doc-time {
    flex-shrink: 0;
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
}

/* Sidebar footer */
.hh-sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hh-download-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s ease;
}

.hh-download-hint:hover {
    color: #4a9eff;
    text-decoration: none;
}

/* --- Loading state --- */
.hh-loading {
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

.hh-empty {
    padding: 20px;
    text-align: center;
    color: #475569;
    font-size: 13px;
}

/* --- Main Content --- */
.hh-main {
    flex: 1;
    min-width: 0;
}

/* --- Hero (logged-out) --- */
.hh-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px);
    padding: 40px;
}

.hh-hero-inner {
    text-align: center;
    max-width: 560px;
}

.hh-hero-logo {
    margin-bottom: 24px;
}

.hh-hero-title {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #f1f5f9;
    margin-bottom: 16px;
}

.hh-hero-tagline {
    font-size: 18px;
    line-height: 1.6;
    color: #94a3b8;
    margin: 0 0 32px;
}

.hh-hero-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

/* --- Dashboard (logged-in) --- */
.hh-dashboard {
    padding: 40px;
    max-width: 720px;
}

.hh-welcome {
    margin-bottom: 32px;
}

.hh-welcome-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.hh-welcome-subtitle {
    font-size: 15px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.5;
}

/* Cards */
.hh-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.hh-card {
    background: #1a2332;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 24px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hh-card:hover {
    border-color: rgba(74, 158, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hh-card-icon {
    margin-bottom: 16px;
}

.hh-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.hh-card-desc {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 16px;
    line-height: 1.5;
}

.hh-card-note {
    font-size: 12px;
    color: #475569;
    margin: 8px 0 0;
}

/* --- Toast Notifications --- */
.hh-toast-area {
    position: fixed;
    top: 68px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.hh-toast {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: hh-toast-in 0.25s ease;
    max-width: 360px;
}

.hh-toast-success {
    background: #166534;
    color: #fff;
}

.hh-toast-error {
    background: #991b1b;
    color: #fff;
}

.hh-toast-info {
    background: #1e40af;
    color: #fff;
}

@keyframes hh-toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Summary Cards --- */
.hh-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.hh-summary-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #1a2332;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hh-summary-card:hover,
.hh-summary-card:focus-visible {
    border-color: rgba(74, 158, 255, 0.25);
    background: #1e2a3a;
}

.hh-summary-card:focus-visible {
    outline: 2px solid var(--hh-accent);
    outline-offset: -2px;
}

.hh-summary-icon {
    flex-shrink: 0;
    image-rendering: auto;
}

.hh-summary-info {
    display: flex;
    flex-direction: column;
}

.hh-summary-count {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.2;
}

.hh-summary-label {
    font-size: 12px;
    color: #64748b;
}

/* --- Recent Activity --- */
.hh-section-heading {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px;
}

.hh-recent-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hh-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s ease;
    color: #cbd5e1;
}

.hh-recent-item:hover,
.hh-recent-item:focus-visible {
    background: rgba(74, 158, 255, 0.08);
    color: #f1f5f9;
}

.hh-recent-item:focus-visible {
    outline: 2px solid var(--hh-accent);
    outline-offset: -2px;
}

.hh-recent-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.hh-recent-type {
    font-size: 11px;
    color: #475569;
    flex-shrink: 0;
}

.hh-recent-time {
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
}

/* --- Dashboard Download --- */
.hh-dashboard-download {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Document Detail Panel --- */
.hh-doc-detail {
    padding: 40px;
    max-width: 720px;
}

.hh-doc-detail:has(.hh-dashboard-preview) {
    max-width: none;
}

.hh-detail-back {
    margin-bottom: 24px;
}

.hh-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: none;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #94a3b8;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hh-back-btn:hover {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

.hh-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.hh-detail-icon {
    flex-shrink: 0;
    image-rendering: auto;
}

.hh-detail-name {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    color: #f1f5f9;
}

.hh-detail-type {
    font-size: 13px;
    color: #64748b;
}

.hh-detail-desc {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.6;
    margin: 0 0 20px;
}

.hh-detail-meta {
    margin-bottom: 24px;
}

.hh-meta-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.hh-meta-label {
    font-size: 13px;
    color: #64748b;
    width: 120px;
    flex-shrink: 0;
}

.hh-meta-value {
    font-size: 13px;
    color: #e2e8f0;
}

.hh-detail-actions {
    display: flex;
    gap: 12px;
}

/* --- Active Document Item --- */
.hh-doc-item--active {
    background: rgba(74, 158, 255, 0.12);
    border-left: 3px solid #4a9eff;
    padding-left: 7px;
    color: #f1f5f9;
}

/* --- Table Preview --- */
.hh-table-preview {
    margin-top: 24px;
}

.hh-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--hh-border-subtle);
    border-radius: var(--hh-radius-lg);
}

.hh-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--hh-font-size-base);
    line-height: 1.4;
}

.hh-preview-th {
    padding: 8px 12px;
    font-size: var(--hh-font-size-sm);
    font-weight: 600;
    color: var(--hh-text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--hh-border-strong);
    white-space: nowrap;
    user-select: none;
}

.hh-preview-td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--hh-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.hh-cell-number {
    font-variant-numeric: tabular-nums;
}

.hh-cell-error {
    color: var(--hh-error);
    font-style: italic;
}

.hh-cell-sparkline svg {
    width: 100%;
    height: 24px;
    display: block;
}

.hh-preview-truncated {
    padding: 12px 0;
    font-size: var(--hh-font-size-sm);
    color: var(--hh-text-muted);
    text-align: center;
}

.hh-preview-truncated-link {
    color: var(--hh-accent);
}

.hh-preview-truncated-link:hover {
    text-decoration: underline;
}

.hh-preview-empty {
    padding: 24px;
    text-align: center;
    color: #475569;
    font-size: var(--hh-font-size-base);
}

.hh-preview-error {
    padding: 16px;
    color: var(--hh-error);
    font-size: var(--hh-font-size-base);
}

.hh-preview-unsupported {
    padding: 16px;
    color: var(--hh-text-muted);
    font-size: var(--hh-font-size-base);
    font-style: italic;
}

/* --- Spreadsheet Preview --- */
.hh-spreadsheet-scroll {
    overflow-x: auto;
    border: 1px solid var(--hh-border-subtle);
    border-radius: var(--hh-radius-lg);
}

.hh-spreadsheet-grid {
    border-collapse: collapse;
    font-size: var(--hh-font-size-base);
    line-height: 1.4;
    background: #fff;
}

.hh-spreadsheet-grid--gridlines td {
    border: 1px solid #d4d4d4;
}

.hh-spreadsheet-header {
    padding: 4px 8px;
    font-size: var(--hh-font-size-sm);
    font-weight: 600;
    color: var(--hh-text-muted);
    background: var(--hh-bg-header);
    text-align: center;
    white-space: nowrap;
    user-select: none;
    border-bottom: 1px solid var(--hh-border-strong);
    border-right: 1px solid #d4d4d4;
}

.hh-spreadsheet-rownum {
    padding: 4px 8px;
    font-size: var(--hh-font-size-sm);
    color: var(--hh-text-muted);
    background: var(--hh-bg-header);
    text-align: center;
    white-space: nowrap;
    user-select: none;
    border-right: 1px solid var(--hh-border-strong);
    min-width: 40px;
}

.hh-spreadsheet-cell {
    padding: 4px 8px;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.hh-spreadsheet-corner {
    background: var(--hh-bg-header);
    border-bottom: 1px solid var(--hh-border-strong);
    border-right: 1px solid var(--hh-border-strong);
}

/* Sheet tabs */
.hh-spreadsheet-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 4px;
    border-top: 1px solid var(--hh-border-subtle);
}

.hh-spreadsheet-tab {
    padding: 4px 12px;
    font-size: var(--hh-font-size-sm);
    color: var(--hh-text-muted);
    background: transparent;
    border-radius: var(--hh-radius-sm);
    cursor: default;
}

.hh-spreadsheet-tab--active {
    color: var(--hh-text-primary);
    background: var(--hh-bg-surface);
}

/* --- Calculation Preview --- */
.hh-calc-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--hh-border-subtle);
    border-radius: var(--hh-radius-lg);
    overflow: hidden;
}

.hh-calc-entry {
    padding: 10px 14px;
    border-bottom: 1px solid var(--hh-border-subtle);
}

.hh-calc-entry:last-child {
    border-bottom: none;
}

.hh-calc-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.hh-calc-index {
    font-size: var(--hh-font-size-sm);
    color: var(--hh-text-muted);
    font-family: var(--hh-font-mono);
}

.hh-calc-varname {
    font-size: var(--hh-font-size-sm);
    color: var(--hh-accent);
    font-family: var(--hh-font-mono);
}

.hh-calc-input {
    font-family: var(--hh-font-mono);
    font-size: var(--hh-font-size-base);
    color: var(--hh-text-primary);
    padding: 4px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.hh-calc-result {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    color: var(--hh-text-secondary);
}

.hh-calc-arrow {
    color: var(--hh-text-muted);
    font-size: var(--hh-font-size-sm);
    flex-shrink: 0;
}

.hh-calc-result .hh-cell-number {
    color: var(--hh-text-primary);
}

.hh-calc-result .hh-cell-sparkline {
    max-width: 200px;
}

.hh-calc-assign {
    color: var(--hh-accent);
    font-family: var(--hh-font-mono);
    font-size: var(--hh-font-size-sm);
    flex-shrink: 0;
}

.hh-calc-time {
    font-size: var(--hh-font-size-xs, 11px);
    color: var(--hh-text-muted);
    margin-left: auto;
}

.hh-calc-error {
    font-size: var(--hh-font-size-sm);
    color: #ef4444;
    padding: 2px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Skeleton loading */
.hh-preview-skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 0;
}

.hh-skeleton-row {
    display: flex;
    gap: 12px;
}

.hh-skeleton-cell {
    height: 16px;
    flex: 1;
    background: linear-gradient(90deg, #1a2332 25%, #1e293b 50%, #1a2332 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: hh-shimmer 1.5s ease-in-out infinite;
}

@keyframes hh-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Custom Metric Preview --- */
.hh-metric-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hh-metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hh-metric-signature {
    font-family: var(--hh-font-mono);
    font-size: var(--hh-font-size-md);
    color: var(--hh-text-heading);
}

.hh-metric-flags {
    display: flex;
    gap: 6px;
}

.hh-metric-flag {
    font-size: var(--hh-font-size-xs);
    color: var(--hh-text-secondary);
    background: rgba(74, 158, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.hh-metric-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hh-metric-section-title {
    font-size: var(--hh-font-size-sm);
    font-weight: 600;
    color: var(--hh-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hh-metric-param-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--hh-font-size-base);
}

.hh-metric-param-table th {
    text-align: left;
    font-size: var(--hh-font-size-xs);
    font-weight: 600;
    color: var(--hh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 12px;
    border-bottom: 1px solid var(--hh-border-strong);
}

.hh-metric-param-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--hh-border-subtle);
}

.hh-metric-param-type {
    font-family: var(--hh-font-mono);
    color: var(--hh-accent);
    font-size: var(--hh-font-size-sm);
}

.hh-metric-param-name {
    font-family: var(--hh-font-mono);
    color: var(--hh-text-primary);
}

.hh-metric-param-default {
    font-family: var(--hh-font-mono);
    color: var(--hh-text-muted);
    font-size: var(--hh-font-size-sm);
}

.hh-metric-param-req {
    color: var(--hh-text-secondary);
    font-size: var(--hh-font-size-sm);
}

/* Code block -- override Prism.js theme to match our dark UI */
.hh-metric-code {
    background: var(--hh-bg-header) !important;
    border: 1px solid var(--hh-border-subtle);
    border-radius: var(--hh-radius-md);
    padding: 14px 16px !important;
    margin: 0 !important;
    font-family: var(--hh-font-mono) !important;
    font-size: var(--hh-font-size-base) !important;
    line-height: 1.6 !important;
    overflow-x: auto;
    tab-size: 4;
}

.hh-metric-code code {
    font-family: inherit !important;
    font-size: inherit !important;
    background: none !important;
    padding: 0 !important;
}

/* Documentation */
.hh-metric-doc-block {
    font-size: var(--hh-font-size-base);
    color: var(--hh-text-primary);
    line-height: 1.5;
}

.hh-metric-doc-block + .hh-metric-doc-block {
    margin-top: 12px;
}

.hh-metric-doc-label {
    font-size: var(--hh-font-size-xs);
    font-weight: 600;
    color: var(--hh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.hh-metric-doc-params {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
}

.hh-metric-doc-params dt {
    font-family: var(--hh-font-mono);
    font-size: var(--hh-font-size-sm);
    color: var(--hh-accent);
}

.hh-metric-doc-params dd {
    margin: 0;
    color: var(--hh-text-secondary);
    font-size: var(--hh-font-size-sm);
}

.hh-metric-example {
    display: block;
    font-family: var(--hh-font-mono);
    font-size: var(--hh-font-size-sm);
    color: var(--hh-text-primary);
    background: var(--hh-bg-header);
    border: 1px solid var(--hh-border-subtle);
    border-radius: var(--hh-radius-sm);
    padding: 6px 10px;
    margin-top: 4px;
    word-break: break-word;
}

.hh-metric-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hh-metric-tag {
    font-size: var(--hh-font-size-xs);
    color: var(--hh-text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--hh-border-subtle);
    border-radius: 10px;
    padding: 2px 10px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .hh-sidebar {
        width: 260px;
    }

    .hh-dashboard {
        padding: 24px;
    }

    .hh-hero {
        padding: 24px;
    }

    .hh-hero-title {
        font-size: 36px;
    }
}

/* ---- Chart preview ---- */
.hh-chart-preview {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
}

.hh-chart-container {
    flex: 1;
    min-height: 350px;
    width: 100%;
}

/* ---- Dashboard preview ---- */

.hh-dashboard-preview {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hh-dashboard-page {
    background: var(--hh-bg-surface);
    border: 1px solid var(--hh-border-strong);
    border-radius: var(--hh-radius-md);
    overflow: hidden;
}

.hh-dashboard-page-inner {
    position: relative;
    width: 100%;
}

.hh-dashboard-widget-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hh-dashboard-widget {
    position: absolute;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--hh-border-subtle);
    border-radius: var(--hh-radius-sm);
    overflow: hidden;
    background: var(--hh-bg-base);
}

.hh-dashboard-widget-title {
    flex: 0 0 auto;
    padding: 3px 8px;
    font-size: var(--hh-font-size-xs);
    font-weight: 600;
    color: var(--hh-text-secondary);
    background: var(--hh-bg-surface);
    border-bottom: 1px solid var(--hh-border-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hh-dashboard-widget-content {
    flex: 1 1 0;
    overflow: hidden;
    min-height: 0;
}

.hh-dashboard-widget-content .hh-chart-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 80px;
}

.hh-dashboard-widget-content .hh-chart-preview {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.hh-dashboard-widget-content .hh-spreadsheet-scroll,
.hh-dashboard-widget-content .hh-table-scroll {
    max-height: 100%;
}

.hh-dashboard-text-content {
    padding: 6px 8px;
    font-size: var(--hh-font-size-sm);
    color: var(--hh-text-primary);
    overflow: auto;
    height: 100%;
}

.hh-dashboard-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---- Dashboard tabs ---- */

.hh-dashboard-tabs {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--hh-border-strong);
    background: var(--hh-bg-surface);
    border-radius: 0 0 var(--hh-radius-md) var(--hh-radius-md);
    overflow-x: auto;
}

.hh-dashboard-tab {
    flex: 0 0 auto;
    padding: 6px 16px;
    font-size: var(--hh-font-size-sm);
    color: var(--hh-text-secondary);
    cursor: pointer;
    border-right: 1px solid var(--hh-border-subtle);
    user-select: none;
    white-space: nowrap;
}

.hh-dashboard-tab:hover,
.hh-dashboard-tab:focus-visible {
    color: var(--hh-text-primary);
    background: var(--hh-bg-hover);
}

.hh-dashboard-tab:focus-visible {
    outline: 2px solid var(--hh-accent);
    outline-offset: -2px;
}

.hh-dashboard-tab--active {
    color: var(--hh-accent);
    border-bottom: 2px solid var(--hh-accent);
}

@media (max-width: 640px) {
    .hh-sidebar {
        display: none;
    }

    .hh-header {
        padding: 0 16px;
    }
}
