:root {
    --app-bg: #f3f6fb;
    --background: #ffffff;
    --foreground: #0f172a;
    --border: rgba(148, 163, 184, 0.22);
    --input: rgba(148, 163, 184, 0.18);
    --ring: rgba(59, 130, 246, 0.28);
    --muted: #f8fafc;
    --muted-foreground: #64748b;
    --primary: #0f172a;
    --primary-foreground: #ffffff;
    --secondary: #e2e8f0;
    --secondary-foreground: #0f172a;
    --accent: #eef2ff;
    --accent-foreground: #0f172a;
    --panel-bg: rgba(255, 255, 255, 0.92);
    --panel-border: rgba(148, 163, 184, 0.22);
    --panel-shadow: 0 20px 45px -28px rgba(15, 23, 42, 0.28);
    --panel-shadow-soft: 0 14px 30px -24px rgba(15, 23, 42, 0.18);
    --toolbar-chip: rgba(226, 232, 240, 0.72);
    --table-header-bg: #f8fafc;
    --table-row-hover: rgba(15, 23, 42, 0.032);
    --table-row-selected: rgba(15, 23, 42, 0.06);
    --radius-xs: 0.75rem;
    --radius-sm: 0.95rem;
    --radius-md: 1.1rem;
    --radius-lg: 1.15rem;
    --radius-xl: 1.6rem;
}

html,
body {
    height: 100%;
}

.dark {
    --app-bg: #020817;
    --background: #0f172a;
    --foreground: #f8fafc;
    --border: rgba(148, 163, 184, 0.16);
    --input: rgba(148, 163, 184, 0.18);
    --ring: rgba(96, 165, 250, 0.34);
    --muted: #111827;
    --muted-foreground: #94a3b8;
    --primary: #f8fafc;
    --primary-foreground: #020617;
    --secondary: #1e293b;
    --secondary-foreground: #f8fafc;
    --accent: #1e293b;
    --accent-foreground: #f8fafc;
    --panel-bg: rgba(15, 23, 42, 0.88);
    --panel-border: rgba(148, 163, 184, 0.16);
    --panel-shadow: 0 28px 50px -32px rgba(2, 6, 23, 0.85);
    --panel-shadow-soft: 0 18px 36px -26px rgba(2, 6, 23, 0.72);
    --toolbar-chip: rgba(30, 41, 59, 0.74);
    --table-header-bg: rgba(15, 23, 42, 0.98);
    --table-row-hover: rgba(148, 163, 184, 0.08);
    --table-row-selected: rgba(148, 163, 184, 0.12);
}

body.app-body {
    background:
        radial-gradient(circle at top left, rgba(148, 163, 184, 0.18), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(241, 245, 249, 0.96)),
        var(--app-bg);
}

.dark body.app-body {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 24%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(2, 8, 23, 1)),
        var(--app-bg);
}

.app-shell {
    gap: 1rem;
    padding: 1rem;
}

#sidebar,
.top-toolbar,
.desktop-overview,
#table-container,
.app-footer,
#compare-dialog > .compare-panel,
#actions-menu,
.mobile-overview,
.mobile-selection-bar {
    border-radius: var(--radius-lg) !important;
}

aside,
header,
footer {
    border-radius: var(--radius-lg) !important;
}

#sidebar label[for="file-upload"],
.sheet-item,
.desktop-stat-card,
.mobile-stat-card,
.mobile-selection-btn,
.quick-action-tile,
.drawer-mode-card,
.drawer-settings-card,
.search-shell,
#search-input,
.top-toolbar #search-mode-btn,
.top-toolbar .toolbar-actions > button,
.top-toolbar .toolbar-freeze-controls,
.top-toolbar .display-mode-group,
.drawer-segmented-control,
.drawer-number-input,
#compare-transpose-toggle,
#compare-mode-toggle {
    border-radius: var(--radius-sm) !important;
}

#theme-toggle,
#menu-toggle,
#actions-menu-toggle,
#close-compare-dialog,
.drawer-header__close,
.app-footer button,
#reset-btn {
    border-radius: var(--radius-xs) !important;
}

.top-toolbar .toolbar-freeze-controls input,
.top-toolbar .display-mode-group > button,
.drawer-segmented-control__item,
.top-toolbar .display-mode-slider,
.drawer-segmented-control__slider {
    border-radius: var(--radius-xs) !important;
}

#empty-state > div:first-child {
    border-radius: 999px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.08);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.45);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.72);
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes displayModeTextSlideIn {
    from {
        transform: translateY(0.5em);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes displayModeTextSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-0.5em);
        opacity: 0;
    }
}

.display-mode-text {
    display: inline-block;
    width: 100%;
}

.display-mode-text--in {
    animation: displayModeTextSlideIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.display-mode-text--out {
    animation: displayModeTextSlideOut 120ms ease-out forwards;
}

.toast {
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.exiting {
    animation: fadeOut 0.3s forwards;
}

body.drag-over::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    z-index: 9999;
    pointer-events: none;
    border: 4px dashed var(--primary);
}

.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.allow-select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

input,
textarea,
select {
    font-size: 16px;
}

@media (min-width: 641px) {
    input,
    textarea,
    select {
        font-size: inherit;
    }
}
