/* ================================================================
   StackQuest — 2026 Dark Glass UI
   Modern design system: glassmorphism, fluid typography, mobile-first
   ================================================================ */

/* ================================== */
/* 1. DESIGN TOKENS                   */
/* ================================== */
:root {
    /* Core Palette */
    --background: #09090b;
    --foreground: #fafafa;

    --card: rgba(14, 14, 20, 0.7);
    --card-solid: #0e0e14;
    --card-foreground: #fafafa;

    --popover: #111118;
    --popover-foreground: #fafafa;

    /* Violet Primary */
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-foreground: #fafafa;
    --primary-glow: rgba(124, 58, 237, 0.20);
    --primary-subtle: rgba(124, 58, 237, 0.08);

    /* Secondary */
    --secondary: #18181b;
    --secondary-foreground: #fafafa;

    /* Muted */
    --muted: #1c1c22;
    --muted-foreground: #a1a1aa;

    /* Accent */
    --accent: #1c1c22;
    --accent-foreground: #fafafa;

    /* Semantic */
    --destructive: #dc2626;
    --destructive-bg: rgba(220, 38, 38, 0.12);
    --destructive-foreground: #fafafa;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);

    /* Surfaces */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --input: rgba(255, 255, 255, 0.06);
    --ring: #7c3aed;

    /* Radius */
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;

    /* Typography */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 120ms var(--ease-out);
    --transition-base: 200ms var(--ease-out);
    --transition-slow: 350ms var(--ease-out);

    /* Layout */
    --header-height: 4rem;
    --bottom-nav-height: 4.75rem;
    --sidebar-width: 240px;
    --content-max: 1280px;
}

/* ================================== */
/* 1b. THEME: LIGHT / DARK / SYSTEM   */
/* ================================== */
/* Default :root = dark. data-theme on <html> set by JS. */
html[data-theme="light"] {
    --background: #fafafa;
    --foreground: #09090b;
    --card: rgba(255, 255, 255, 0.85);
    --card-solid: #f4f4f5;
    --card-foreground: #09090b;
    --popover: #ffffff;
    --popover-foreground: #09090b;
    --secondary: #f4f4f5;
    --secondary-foreground: #18181b;
    --muted: #e4e4e7;
    --muted-foreground: #71717a;
    --accent: #e4e4e7;
    --accent-foreground: #18181b;
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --input: rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px var(--primary-glow);
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="system"] {
    color-scheme: light dark;
}

@media (prefers-color-scheme: light) {
    html[data-theme="system"] {
        --background: #fafafa;
        --foreground: #09090b;
        --card: rgba(255, 255, 255, 0.85);
        --card-solid: #f4f4f5;
        --card-foreground: #09090b;
        --popover: #ffffff;
        --popover-foreground: #09090b;
        --secondary: #f4f4f5;
        --secondary-foreground: #18181b;
        --muted: #e4e4e7;
        --muted-foreground: #71717a;
        --accent: #e4e4e7;
        --accent-foreground: #18181b;
        --border: rgba(0, 0, 0, 0.08);
        --border-hover: rgba(0, 0, 0, 0.15);
        --input: rgba(0, 0, 0, 0.08);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
        --shadow-glow: 0 0 20px var(--primary-glow);
    }
}

/* ================================== */
/* 2. RESET & BASE                    */
/* ================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    border-color: var(--border);
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    color-scheme: dark; /* default; overridden by [data-theme="light"] and [data-theme="system"] + media */
}

body {
    background-color: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.6;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* Subtle background texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(124, 58, 237, 0.08), transparent),
        radial-gradient(ellipse 60% 50% at 80% 50%, rgba(59, 130, 246, 0.04), transparent);
    pointer-events: none;
    z-index: 0;
}

/* ================================== */
/* 3. ACCESSIBILITY                   */
/* ================================== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    z-index: 9999;
    transition: top var(--transition-base);
    text-decoration: none;
}

.skip-link:focus {
    top: 1rem;
}

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ================================== */
/* 4. TYPOGRAPHY                      */
/* ================================== */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--foreground);
    line-height: 1.3;
}

h1 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p { margin: 0; }

a { color: inherit; text-decoration: none; }

/* ================================== */
/* 5. LAYOUT                          */
/* ================================== */
.app-container {
    position: relative;
    z-index: 1;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 1rem 1.25rem;
    padding-bottom: calc(var(--bottom-nav-height) + 2rem);
}

@media (min-width: 768px) {
    .app-container {
        padding: 1.5rem 2rem;
        padding-bottom: calc(var(--bottom-nav-height) + 2rem);
    }
}

main {
    position: relative;
}

/* ================================== */
/* 6. HEADER                          */
/* ================================== */
header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

@media (min-width: 768px) {
    header {
        margin-left: -2rem;
        margin-right: -2rem;
        padding-left: 2rem;
        padding-right: 2rem;
        padding: 1rem 2rem;
        margin-bottom: 2rem;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cycle-selector-wrap {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
.cycle-selector-wrap .cycle-select,
.cycle-select {
    min-width: 8rem;
    max-width: 12rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
    border-radius: var(--radius);
}
.cycle-selector-wrap #btn-new-cycle {
    padding: 0.35rem 0.5rem;
    min-width: 2rem;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .logo { font-size: 1.5rem; }
}

.gamification-strip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}
.streak-display {
    white-space: nowrap;
}
.level-display {
    white-space: nowrap;
    font-weight: 500;
    color: var(--foreground);
}

.achievement-card { border-left: 3px solid var(--muted); }
.achievement-rarity-common { border-left-color: var(--muted-foreground); }
.achievement-rarity-rare { border-left-color: #3b82f6; }
.achievement-rarity-epic { border-left-color: #8b5cf6; }
.achievement-rarity-legendary { border-left-color: #f59e0b; }

.user-status {
    display: none;
}

@media (min-width: 640px) {
    .user-status {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
}

/* Theme switcher (header) */
.theme-switcher-wrap {
    display: flex;
    align-items: center;
    margin-left: auto;
}
.theme-select {
    min-width: 6rem;
    max-width: 8rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
    height: auto;
}

/* Logout button */
.btn-logout {
    margin-left: 0.5rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.logout-icon {
    width: 16px;
    height: 16px;
    display: none;
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .btn-logout {
        padding: 0;
        width: 2rem;
        height: 2rem;
        justify-content: center;
        border-radius: var(--radius-sm);
    }
    .logout-icon {
        display: block;
    }
    .logout-text {
        display: none;
    }
}

/* ================================== */
/* 7. BOTTOM NAVIGATION (all screens) */
/* ================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    height: var(--bottom-nav-height);
    background: rgba(9, 9, 11, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border);
    padding: 0.5rem 0.25rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    gap: 0.25rem;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
    max-width: 6rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius);
    color: var(--muted-foreground);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: all var(--transition-base);
    cursor: pointer;
    background: none;
    border: none;
}

.bottom-nav-link:hover,
.bottom-nav-link:active {
    color: var(--foreground);
}

.bottom-nav-link.active {
    color: var(--primary);
}

.bottom-nav-link.active .bottom-nav-icon {
    background: var(--primary-subtle);
    color: var(--primary);
}

.bottom-nav-link.nav-disabled,
.bottom-nav-link:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.bottom-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.bottom-nav-icon svg {
    width: 20px;
    height: 20px;
}

.bottom-nav-label {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
    line-height: 1.35;
    padding-bottom: 0.05em;
}

@media (min-width: 640px) {
    .bottom-nav-link {
        font-size: 0.6875rem;
        padding: 0.4rem 0.5rem;
    }
    .bottom-nav-link .bottom-nav-icon {
        width: 2.25rem;
        height: 2.25rem;
    }
    .bottom-nav-link .bottom-nav-icon svg {
        width: 22px;
        height: 22px;
    }
}

@media (min-width: 1024px) {
    .bottom-nav-link {
        max-width: 8rem;
        font-size: 0.75rem;
    }
}

/* ================================== */
/* 9. CARDS                           */
/* ================================== */
.card,
.shadcn-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--card-foreground);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.shadcn-card:hover {
    border-color: var(--border-hover);
}

.shadcn-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.shadcn-card-title,
.shadcn-title {
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

.shadcn-card-desc,
.shadcn-desc {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    line-height: 1.5;
}

.shadcn-card-content {
    padding-top: 0;
}

/* ================================== */
/* 10. BUTTONS                        */
/* ================================== */
.btn,
.shadcn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    height: 2.25rem;
    padding: 0 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
}

.btn:active,
.shadcn-btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.shadcn-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-lg {
    height: 2.75rem;
    padding: 0 1.5rem;
    font-size: 0.9375rem;
    border-radius: var(--radius);
}

.btn-sm {
    height: 1.75rem;
    padding: 0 0.625rem;
    font-size: 0.75rem;
}

.btn-primary,
.shadcn-btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 0 0 0 var(--primary-glow);
}

.btn-primary:hover,
.shadcn-btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 16px var(--primary-glow);
}

.btn-secondary,
.shadcn-btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}

.btn-secondary:hover,
.shadcn-btn-secondary:hover {
    background: var(--muted);
    border-color: var(--border-hover);
}

.btn-danger,
.shadcn-btn-destructive {
    background: var(--destructive-bg);
    color: var(--destructive);
    border-color: rgba(220, 38, 38, 0.2);
}

.btn-danger:hover,
.shadcn-btn-destructive:hover {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.shadcn-btn-ghost {
    background: transparent;
    color: var(--muted-foreground);
}

.shadcn-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--foreground);
}

.shadcn-btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--foreground);
}

.shadcn-btn-outline:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-hover);
}

/* ================================== */
/* 11. FORM INPUTS                    */
/* ================================== */
.form-input,
.form-select,
.shadcn-input,
textarea {
    display: flex;
    width: 100%;
    height: 2.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--foreground);
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

textarea {
    min-height: 2.5rem;
    height: auto;
    resize: vertical;
}

.form-input:hover,
.form-select:hover,
.shadcn-input:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
}

.form-input:focus,
.form-select:focus,
.shadcn-input:focus,
textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(255, 255, 255, 0.04);
}

.form-input::placeholder,
.shadcn-input::placeholder {
    color: var(--muted-foreground);
    opacity: 0.6;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label,
.shadcn-label {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--foreground);
}

.form-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Color input override */
input[type="color"] {
    padding: 0.25rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

/* Date input — follow theme for native picker */
input[type="date"] {
    color-scheme: dark;
}
html[data-theme="light"] input[type="date"] {
    color-scheme: light;
}
@media (prefers-color-scheme: light) {
    html[data-theme="system"] input[type="date"] {
        color-scheme: light;
    }
}

/* ================================== */
/* 12. CUSTOM CHECKBOX                */
/* ================================== */
input[type='checkbox'] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 1.5px solid var(--muted-foreground);
    border-radius: 4px;
    background: transparent;
    display: inline-grid;
    place-content: center;
    margin: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
    vertical-align: middle;
    flex-shrink: 0;
}

input[type='checkbox']:hover {
    border-color: var(--primary);
}

input[type='checkbox']:checked {
    background: var(--primary);
    border-color: var(--primary);
}

input[type='checkbox']::before {
    content: '';
    width: 0.65rem;
    height: 0.65rem;
    transform: scale(0);
    transition: 120ms transform var(--ease-spring);
    box-shadow: inset 1em 1em var(--primary-foreground);
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type='checkbox']:checked::before {
    transform: scale(1);
}

input[type='checkbox']:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* ================================== */
/* 13. CUSTOM SELECT                  */
/* ================================== */
select.shadcn-select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.shadcn-select-wrapper {
    position: relative;
    width: 100%;
}

.shadcn-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 2.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--foreground);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.shadcn-select-trigger:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
}

.shadcn-select-trigger:focus,
.shadcn-select-trigger:active {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.shadcn-select-content {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 10rem;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    background: var(--popover);
    color: var(--popover-foreground);
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: none;
    animation: selectOpen 0.15s var(--ease-out);
    padding: 0.25rem;
}

@keyframes selectOpen {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.shadcn-select-content.open {
    display: block;
}

.shadcn-select-item {
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.shadcn-select-item:hover,
.shadcn-select-item.highlighted {
    background: rgba(255, 255, 255, 0.06);
}

.shadcn-select-item.selected {
    background: var(--primary-subtle);
    color: var(--primary);
}

.shadcn-select-label {
    padding: 0.5rem 0.625rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chevron-down {
    width: 14px;
    height: 14px;
    opacity: 0.5;
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

.shadcn-select-trigger[aria-expanded="true"] .chevron-down {
    transform: rotate(180deg);
}

/* Custom scrollbar for select */
.shadcn-select-content::-webkit-scrollbar {
    width: 6px;
}

.shadcn-select-content::-webkit-scrollbar-track {
    background: transparent;
}

.shadcn-select-content::-webkit-scrollbar-thumb {
    background: var(--muted-foreground);
    border-radius: 3px;
    opacity: 0.3;
}

/* ================================== */
/* 14. BADGES                         */
/* ================================== */
.shadcn-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    border: 1px solid transparent;
    padding: 0.125rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all var(--transition-fast);
    white-space: nowrap;
    background: var(--primary-subtle);
    color: var(--primary);
    border-color: rgba(124, 58, 237, 0.2);
}

.shadcn-badge.success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}

.shadcn-badge.warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

/* ================================== */
/* 15. LOGIN OVERLAY                  */
/* ================================== */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--background);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* Decorative gradient behind login */
.login-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 50% 50% at 50% 30%, rgba(124, 58, 237, 0.12), transparent 70%),
        radial-gradient(ellipse 40% 40% at 70% 60%, rgba(59, 130, 246, 0.06), transparent 70%);
    pointer-events: none;
}

.login-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(124, 58, 237, 0.05);
    animation: loginAppear 0.5s var(--ease-out);
}

@keyframes loginAppear {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.login-passkey-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.password-login-wrap {
    margin-top: 1rem;
}

.login-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.login-buttons .btn {
    flex: 1;
}

.login-error {
    background: var(--destructive-bg);
    color: var(--destructive);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    margin-bottom: 0.75rem;
    animation: shake 0.3s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.login-forgot-wrap {
    margin-top: 0.5rem;
    text-align: center;
}

.login-reset-wrap .login-buttons {
    margin-top: 0.5rem;
}

.login-status {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    margin-top: 0.75rem;
    min-height: 1.25rem;
}

@media (max-width: 520px) {
    .login-buttons {
        flex-direction: column;
    }
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    opacity: 0.7;
}

/* ================================== */
/* 16. DASHBOARD                      */
/* ================================== */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.5;
}

.stat-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.stat-icon svg {
    width: 18px;
    height: 18px;
}

.stat-icon.violet {
    background: var(--primary-subtle);
    color: var(--primary);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.stat-icon.emerald {
    background: var(--success-bg);
    color: var(--success);
}

/* Progress bar */
.progress-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    transition: width 0.6s var(--ease-out);
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
    border-radius: 9999px;
}

/* ================================== */
/* 17. SCHEDULE VIEW                  */
/* ================================== */
/* Wrapper for desktop horizontal scroll (arrows + shift+wheel) */
.schedule-scroll-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
}
.schedule-scroll-wrapper .schedule-container {
    flex: 1;
    min-width: 0;
}
/* Arrow buttons: always visible on desktop; hidden only on small screens */
.schedule-scroll-btn {
    flex-shrink: 0;
    width: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--foreground);
    cursor: pointer;
    opacity: 0.95;
    transition: opacity 0.15s, background 0.15s;
}
.schedule-scroll-btn:hover {
    opacity: 1;
    background: var(--muted);
}
.schedule-scroll-btn:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
.schedule-scroll-left { border-radius: var(--radius-md) 0 0 var(--radius-md); border-right: 0; }
.schedule-scroll-right { border-radius: 0 var(--radius-md) var(--radius-md) 0; border-left: 0; }
@media (max-width: 900px) {
    .schedule-scroll-btn { display: none; }
}

.schedule-container {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.schedule-container .shadcn-table-wrapper {
    min-width: min-content;
    width: max-content;
    overflow: visible;
}

.shadcn-table-wrapper {
    position: relative;
    overflow: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

/* Custom scrollbar */
.shadcn-table-wrapper::-webkit-scrollbar,
.schedule-container::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.shadcn-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.shadcn-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.shadcn-table {
    width: 100%;
    caption-side: bottom;
    font-size: 0.8125rem;
    border-collapse: collapse;
}

.shadcn-table thead tr {
    border-bottom: 1px solid var(--border);
}

.shadcn-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.shadcn-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.shadcn-table td,
.shadcn-table th {
    padding: 0.625rem 0.5rem;
    vertical-align: middle;
    text-align: left;
}

.shadcn-table th {
    height: 2.75rem;
    color: var(--muted-foreground);
    font-weight: 500;
    font-size: 0.75rem;
}

.shadcn-table-row-header {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--foreground);
    background: rgba(14, 14, 20, 0.5);
    min-width: 100px;
    border-right: 1px solid var(--border);
    position: sticky;
    left: 0;
    z-index: 1;
}

.shadcn-week-header {
    background: var(--secondary);
    font-weight: 700;
    font-size: 0.8125rem;
    text-align: center;
    padding: 0.625rem;
    color: var(--secondary-foreground);
    position: sticky;
    left: 0;
    z-index: 4;
}

/* Current Week & Today Highlights */
.schedule-current-week-header {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(124, 58, 237, 0.08));
    border-left: 3px solid var(--primary);
    position: relative;
}

.schedule-current-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.75rem;
    padding: 0.125rem 0.625rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-radius: 9999px;
    background: var(--primary);
    color: var(--primary-foreground);
    vertical-align: middle;
    text-transform: uppercase;
}

.schedule-current-week-row {
    background: var(--primary-subtle);
}

.schedule-current-week-row:hover {
    background: rgba(124, 58, 237, 0.08) !important;
}

.schedule-today-header {
    color: var(--primary) !important;
    font-weight: 700 !important;
}

.schedule-today-cell {
    background: rgba(124, 58, 237, 0.08);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.2);
}

/* Dashboard stats (Current Week, Today's Focus, Progress) – compact on small viewports */
@media (max-width: 767px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
        margin-bottom: 1.25rem;
    }
    .dashboard-stats .shadcn-card {
        padding: 0.5rem 0.75rem;
    }
    .dashboard-stats .text-sm.font-medium {
        padding-bottom: 0.25rem;
        font-size: 0.6875rem;
    }
    .dashboard-stats .text-2xl {
        font-size: 1.125rem;
        line-height: 1.25rem;
    }
    .dashboard-stats .text-xs.mt-1 {
        margin-top: 0.125rem;
        font-size: 0.6875rem;
    }
}

/* Per-week date sub-header */
.schedule-date-row td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.schedule-date-label {
    background: rgba(14, 14, 20, 0.5);
}

.schedule-date-cell {
    background: rgba(255, 255, 255, 0.02);
}

.schedule-date-dayname {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.2;
}

.schedule-date-date {
    font-size: 0.625rem;
    color: var(--muted-foreground);
    line-height: 1.2;
}

/* Legacy schedule grid (used by buildDayCardHtml) */
.week-block {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.week-header {
    background: var(--muted);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.week-header h3 {
    margin: 0;
    font-size: 0.9375rem;
}

.week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--card-solid);
}

.day-column {
    border-right: 1px solid var(--border);
    padding: 0.75rem;
    min-height: 150px;
}

.day-column:last-child {
    border-right: none;
}

.day-header {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-column.active {
    background: var(--primary-subtle);
}

.item-tag {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    color: var(--secondary-foreground);
    font-weight: 500;
    transition: background var(--transition-fast);
}

.item-tag:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ================================== */
/* 18. COMPOUNDS VIEW                 */
/* ================================== */
.compounds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.compound-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-base);
}

.compound-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.compound-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ================================== */
/* 19. SETTINGS VIEW                  */
/* ================================== */
.settings-list {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--card-solid);
}

.list-item:last-child {
    border-bottom: none;
}

.shadcn-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-fast);
    gap: 0.75rem;
}

.shadcn-list-item:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
}

/* Day Selector */
.day-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.day-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--foreground);
    padding: 0.25rem 0;
}

/* ================================== */
/* 20. PLOTTER VIEW                   */
/* ================================== */
.shadcn-grid {
    display: grid;
    gap: 1rem;
}

.shadcn-row {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color var(--transition-fast);
}

.shadcn-row:hover {
    border-color: var(--border-hover);
}

.shadcn-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    font-size: 1.125rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.shadcn-close:hover {
    color: var(--destructive);
    background: var(--destructive-bg);
}

/* ================================== */
/* 21. DIALOG / MODAL                 */
/* ================================== */
.shadcn-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: overlayIn 0.15s ease-out;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.shadcn-dialog-content {
    position: relative;
    background: var(--card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    width: 100%;
    max-width: 28rem;
    box-shadow: var(--shadow-lg);
    animation: dialogIn 0.2s var(--ease-out);
}

@keyframes dialogIn {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.shadcn-dialog-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.shadcn-dialog-desc {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.shadcn-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ================================== */
/* 22. TOAST                          */
/* ================================== */
.shadcn-toast-container {
    position: fixed;
    bottom: calc(1rem + var(--bottom-nav-height));
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(380px, calc(100vw - 2rem));
}

@media (min-width: 768px) {
    .shadcn-toast-container {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}

.shadcn-toast {
    background: var(--card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: toastIn 0.3s var(--ease-out);
    transition: all 0.3s var(--ease-out);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.shadcn-toast.destructive {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(220, 38, 38, 0.08);
}

.shadcn-toast-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--foreground);
}

.shadcn-toast-desc {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    margin-top: 0.125rem;
    line-height: 1.4;
}

.shadcn-toast-close {
    margin-left: auto;
    color: var(--muted-foreground);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-size: 1rem;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.shadcn-toast-close:hover {
    color: var(--foreground);
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ================================== */
/* 23. LOADING STATES                 */
/* ================================== */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

.skeleton-text {
    height: 0.875rem;
    width: 60%;
    margin-bottom: 0.5rem;
}

.skeleton-text.sm {
    height: 0.75rem;
    width: 40%;
}

.skeleton-heading {
    height: 1.5rem;
    width: 30%;
    margin-bottom: 0.75rem;
}

.skeleton-card {
    height: 120px;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================== */
/* 24. VIEW TRANSITIONS               */
/* ================================== */
.view-section {
    animation: viewFadeIn 0.25s var(--ease-out);
}

@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================== */
/* 25. UTILITY CLASSES                */
/* ================================== */

/* Hidden */
.hidden { display: none !important; }

/* Text utilities */
.text-secondary, .text-sm { color: var(--muted-foreground); font-size: 0.8125rem; }
.text-accent { color: var(--primary); }
.text-muted-foreground { color: var(--muted-foreground); }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-sm { font-size: 0.8125rem; line-height: 1.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-tight { letter-spacing: -0.025em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.text-emerald-500 { color: #10b981; }

/* Grid */
.grid { display: grid; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .md\:col-span-2 { grid-column: span 2 / span 2; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }

/* Spacing */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.ml-2 { margin-left: 0.5rem; }
.gap-1 { gap: 0.25rem; }

/* Space-y (stack) */
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* Sizing */
.h-full { height: 100%; }
.w-full { width: 100%; }
.h-8 { height: 2rem; }
.w-8 { width: 2rem; }
.h-10 { height: 2.5rem; }
.w-10 { width: 2.5rem; }
.w-32 { width: 8rem; }
.max-w-sm { max-width: 24rem; }

/* Borders */
.rounded-md { border-radius: var(--radius); }
.border { border: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-transparent { border-color: transparent; }
.hover\:border-border:hover { border-color: var(--border-hover); }

/* Backgrounds */
.bg-muted\/50 { background: rgba(28, 28, 34, 0.5); }
.bg-muted\/30 { background: rgba(28, 28, 34, 0.3); }

/* Effects */
.transition-colors { transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast); }

/* Schedule Grid (legacy) */
@media (min-width: 1024px) {
    .schedule-grid { display: grid; grid-template-columns: 80px repeat(7, 1fr); gap: 1rem; }
    .schedule-header { display: contents; font-weight: 600; text-align: center; }
    .week-label { display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; letter-spacing: 0.1em; background: var(--muted); border-radius: var(--radius); padding: 1rem 0; height: 100%; border: 1px solid var(--border); }
}

@media (max-width: 1023px) {
    .schedule-grid { display: flex; flex-direction: column; gap: 2rem; }
    .schedule-header { display: none; }
    .week-label { display: block; padding: 0.75rem; background: var(--muted); border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 0.5rem; text-align: left; writing-mode: horizontal-tb; transform: none; font-weight: 700; }
}

/* Shadcn Table */
.shadcn-table-wrapper { position: relative; width: 100%; overflow: auto; }
.shadcn-table { width: 100%; caption-side: bottom; font-size: 0.875rem; border-collapse: collapse; }
.shadcn-table thead tr { border-bottom: 1px solid var(--border); transition: colors 0.2s; }
.shadcn-table tbody tr { border-bottom: 1px solid var(--border); transition: colors 0.2s; }
.shadcn-table tbody tr:hover { background-color: var(--muted); }
.shadcn-table td, .shadcn-table th { padding: 1rem; vertical-align: middle; text-align: left; }
.shadcn-table th { height: 3rem; color: var(--muted-foreground); font-weight: 500; }
.shadcn-table-row-header { font-weight: 600; color: var(--foreground); background: var(--card); min-width: 120px; border-right: 1px solid var(--border); }
.shadcn-week-header {
    background: var(--secondary);
    font-weight: 700;
    text-align: center;
    padding: 0.75rem;
    color: var(--secondary-foreground);
    position: sticky;
    left: 0;
    z-index: 4;
}
.schedule-week-current { box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.35); }
.schedule-day-header-current { color: var(--foreground); background: rgba(59, 130, 246, 0.12); box-shadow: inset 0 -2px 0 var(--primary); }
.schedule-day-current { background: rgba(59, 130, 246, 0.08); box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35); }
.schedule-date-row { border-bottom: 1px solid var(--border); }
.schedule-date-row:hover { background: transparent !important; }
.schedule-date-label { font-size: 0.75rem; color: var(--muted-foreground); font-weight: 500; padding: 0.5rem 1rem; }
.schedule-date-cell { padding: 0.4rem 0.5rem; line-height: 1.2; }
.schedule-date-dayname { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.schedule-date-num { font-size: 1.1rem; font-weight: 700; color: var(--foreground); }
.schedule-date-month { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.schedule-date-today .schedule-date-num { color: var(--primary); }
.schedule-date-today .schedule-date-dayname,
.schedule-date-today .schedule-date-month { color: var(--primary); opacity: 0.8; }

/* Dialog/Modal */
.shadcn-dialog-overlay { position: fixed; inset: 0; z-index: 50; background-color: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; animation: fadeIn 0.15s ease-out; }
.shadcn-dialog-content { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 28rem; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); animation: slideIn 0.15s ease-out; }
.shadcn-dialog-title { margin: 0; font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; }
.shadcn-dialog-desc { font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 1.5rem; }
.shadcn-dialog-footer { display: flex; justify-content: flex-end; gap: 0.5rem; }
@keyframes slideIn { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Toast */
.shadcn-toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; }
.shadcn-toast { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; min-width: 300px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); display: flex; align-items: start; gap: 0.75rem; animation: slideInRight 0.3s ease-out; transition: all 0.3s; }
.shadcn-toast.destructive { border-color: var(--destructive); color: var(--destructive); }
.shadcn-toast-title { font-weight: 600; font-size: 0.875rem; color: var(--foreground); }
.shadcn-toast-desc { font-size: 0.875rem; color: var(--muted-foreground); margin-top: 0.25rem; }
.shadcn-toast-close { margin-left: auto; color: var(--muted-foreground); cursor: pointer; background:none; border:none; }
.shadcn-toast-close:hover { color: var(--foreground); }

@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ================================== */
/* SETTINGS TABS                      */
/* ================================== */
.settings-tab-bar {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.settings-tab-bar::-webkit-scrollbar { display: none; }

/* Sticky tab bar on Schedule and Compounds so it stays visible when scrolling */
#view-schedule .compounds-schedule-tab-bar,
#view-compounds .compounds-schedule-tab-bar {
    position: sticky;
    top: var(--header-height);
    z-index: 20;
    background: rgba(9, 9, 11, 0.9);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
@media (min-width: 768px) {
    #view-schedule .compounds-schedule-tab-bar,
    #view-compounds .compounds-schedule-tab-bar {
        margin-left: -2rem;
        margin-right: -2rem;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    min-height: 44px;
    font-family: inherit;
}
.settings-tab:hover { color: var(--foreground); background: var(--muted); }
.settings-tab.active { color: var(--foreground); border-bottom-color: var(--primary); }
.settings-tab-icon { font-size: 1rem; }
@media (max-width: 640px) {
    .settings-tab-label { display: none; }
    .settings-tab { padding: 0.75rem; }
    .settings-tab-icon { font-size: 1.25rem; }
}

.settings-pane-header { margin-bottom: 1.5rem; }
.settings-pane-header h3 { margin-bottom: 0.25rem; }

/* ================================== */
/* COMPOUND AUTOCOMPLETE              */
/* ================================== */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 250px;
    overflow-y: auto;
    display: none;
}
.autocomplete-dropdown.open { display: block; }
.autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.1s;
}
.autocomplete-item:hover,
.autocomplete-item.highlighted { background: var(--accent); }
.autocomplete-name { flex: 1; }
.autocomplete-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
}

/* ================================== */
/* DOSE LOGGER MODAL (Bottom Sheet)   */
/* ================================== */
.dose-log-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
/* Center modal on desktop/laptop pointers even on narrow windows. */
@media (hover: hover) and (pointer: fine) {
    .dose-log-modal { align-items: center; }
}
.dose-log-sheet {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.2s ease-out;
}
@media (hover: hover) and (pointer: fine) {
    .dose-log-sheet { border-radius: var(--radius); }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.dose-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.dose-log-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.dose-log-close {
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dose-log-close:hover { color: var(--foreground); }
.dose-log-body { padding: 1.25rem; }
.dose-log-section { margin-top: 1rem; }
.dose-log-footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    gap: 0.5rem;
}

/* Dose Status Buttons */
.dose-status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.dose-status-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: var(--muted);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
    color: var(--foreground);
    font-family: inherit;
}
.dose-status-btn:hover { border-color: var(--border); }
.dose-status-btn.active {
    border-color: var(--status-color, var(--primary));
    background: var(--secondary);
}
.dose-status-icon { font-size: 1.25rem; font-weight: 700; }
.dose-status-label { font-size: 0.75rem; font-weight: 500; }

/* Injection Site Grid */
.injection-site-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-top: 0.5rem; }
.injection-site-btn {
    padding: 0.5rem;
    font-size: 0.8rem;
    background: var(--muted);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    color: var(--foreground);
    text-align: center;
    min-height: 44px;
    font-family: inherit;
}
.injection-site-btn:hover { border-color: var(--border); }
.injection-site-btn.active { border-color: var(--primary); background: rgba(124,58,237,0.15); }
.injection-site-btn.suggested { border-color: var(--primary); border-style: dashed; }

/* Dashboard Dose Items */
.dose-item { position: relative; }
.dose-status-indicator { font-weight: 700; font-size: 0.875rem; min-width: 1.25rem; text-align: center; }

/* Profile Chips */
.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s;
}
.profile-chip:hover { background: var(--muted); }
.profile-chip-active { background: rgba(124,58,237,0.15); border-color: var(--primary); }
.profile-chip-warning { background: rgba(127,29,29,0.15); border-color: var(--destructive); }

/* Reminder Permission Card */
.reminder-permission-card {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

/* ============================================
   CHART ENHANCEMENTS (SteroidPlotter-inspired)
   ============================================ */

/* Chart header with title + controls */
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.chart-controls {
    display: flex;
    gap: 0.375rem;
}
.chart-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.15s;
}
.chart-control-btn:hover {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--foreground);
}

/* Chart container */
.chart-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    background: var(--card);
}
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Chart hint text */
.chart-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Plotter toolbar */
.plotter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.plotter-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Level adjustment slider */
.level-slider-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 140px;
}
.level-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #ef4444 0%, var(--muted) 50%, #22c55e 100%);
    outline: none;
    cursor: pointer;
}
.level-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--foreground);
    border: 2px solid var(--card);
    cursor: pointer;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
}
.level-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--foreground);
    border: 2px solid var(--card);
    cursor: pointer;
}
.level-slider-label {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
    color: var(--muted-foreground);
}

/* Utility additions */
.overflow-hidden { overflow: hidden; }
.rounded { border-radius: var(--radius); }
.transition-all { transition: all 0.2s; }
.ml-2 { margin-left: 0.5rem; }
.mt-8 { margin-top: 2rem; }
.gap-3 { gap: 0.75rem; }
