/* ═══════════════════════════════════════════════
   StudyPlanner Pro — Modern Dark Theme v2
   Indigo / Graphite · Performance-first
   ═══════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
    /* Backgrounds — 5-layer surface system */
    --bg-base: #0c0d14;
    --bg-surface-0: #12131c;
    --bg-surface-1: #181a25;
    --bg-surface-2: #1e2030;
    --bg-surface-3: #252838;

    /* Borders */
    --border-default: #2a2d3e;
    --border-light: #363a4f;
    --border-focus: #6366f1;

    /* Text hierarchy */
    --text-primary: #e2e4ed;
    --text-secondary: #9395a5;
    --text-muted: #5f6274;
    --text-inverse: #0c0d14;

    /* Accent — Indigo */
    --accent-primary: #6366f1;
    --accent-primary-hover: #5457e5;
    --accent-primary-active: #4f46e5;
    --accent-primary-light: #818cf8;
    --accent-primary-subtle: rgba(99, 102, 241, 0.12);

    /* Secondary accent — Cyan */
    --accent-secondary: #06b6d4;
    --accent-secondary-light: #22d3ee;

    /* Semantic status */
    --color-success: #22c55e;
    --color-success-subtle: rgba(34, 197, 94, 0.12);
    --color-warning: #f59e0b;
    --color-warning-subtle: rgba(245, 158, 11, 0.12);
    --color-error: #ef4444;
    --color-error-subtle: rgba(239, 68, 68, 0.12);
    --color-info: #06b6d4;
    --color-info-subtle: rgba(6, 182, 212, 0.12);

    /* Shadows — minimal */
    --shadow-sm: 0 1px 3px 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.35);

    /* Transitions — performance first */
    --transition-fast: 120ms ease;
    --transition-normal: 200ms ease;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 56px;

    /* ─── LEGACY ALIASES (backward compat) ─── */
    --bg-primary: var(--bg-base);
    --bg-secondary: var(--bg-surface-0);
    --bg-tertiary: var(--bg-surface-2);
    --bg-card: var(--bg-surface-1);
    --bg-card-hover: var(--bg-surface-2);
    --border-color: var(--border-default);
    --accent-purple: var(--accent-primary);
    --accent-purple-light: var(--accent-primary-light);
    --accent-cyan: var(--accent-secondary-light);
    --accent-green: var(--color-success);
    --accent-orange: var(--color-warning);
    --accent-red: var(--color-error);
    --gradient-purple: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-light) 100%);
    --gradient-cyan: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-secondary-light) 100%);
    --gradient-dark: linear-gradient(180deg, var(--bg-surface-0) 0%, var(--bg-base) 100%);
    --shadow-glow: var(--shadow-md);
    --transition-slow: var(--transition-normal);
}


/* ─── Global Reset ─── */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ─── Typography ─── */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.375rem;
}

h3 {
    font-size: 1.0625rem;
}

p {
    color: var(--text-secondary);
}

a {
    color: var(--accent-primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-primary);
}


/* ─── Bootstrap Dark Theme Overrides ─── */
.text-dark,
.text-body,
.text-black {
    color: var(--text-primary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.bg-white,
.bg-light {
    background-color: var(--bg-surface-1) !important;
}


/* ─── Force Light Text on Dark ─── */
body,
html,
main,
article,
section,
aside,
header,
footer,
nav,
label,
span,
div,
p,
td,
th,
li,
input,
textarea,
select,
option,
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
}


/* ─── Table Dark Overrides ─── */
.table {
    --bs-table-bg: var(--bg-surface-1);
    --bs-table-striped-bg: var(--bg-surface-2);
    --bs-table-hover-bg: var(--bg-surface-2);
    --bs-table-active-bg: var(--bg-surface-2);
    color: var(--text-primary);
}

.table> :not(caption)>*>* {
    background-color: var(--bg-surface-1) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

.table-hover>tbody>tr:hover>* {
    background-color: var(--bg-surface-2) !important;
}


/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
    text-decoration: none;
    outline: none;
}

.btn:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    color: white;
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--accent-primary-active);
    transform: translateY(0);
}

.btn-purple {
    background: var(--accent-primary);
    color: white;
    border: none;
    font-weight: 600;
    transition: background-color var(--transition-fast),
        transform var(--transition-fast);
}

.btn-purple:hover {
    background: var(--accent-primary-hover);
    color: white;
    transform: translateY(-1px);
}

.btn-purple:active {
    transform: translateY(0);
}

.text-purple {
    color: var(--accent-primary) !important;
}

.bg-purple {
    background-color: var(--accent-primary) !important;
}

.btn-secondary {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-surface-3);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    filter: brightness(1.1);
    color: white;
}

.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover {
    filter: brightness(1.1);
    color: white;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.7rem 1.15rem;
    font-size: 0.9375rem;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}


/* ─── Card & Text Overrides ─── */
.card,
.card-body,
.card-header,
.card-footer,
.card-title,
.card-text,
.card-subtitle {
    color: var(--text-primary) !important;
}

.card-title {
    color: var(--text-primary) !important;
    font-weight: 600;
}


/* ─── Form Elements ─── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
    color: var(--text-primary) !important;
    background-color: var(--bg-surface-2) !important;
    border-color: var(--border-default) !important;
    color-scheme: dark;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    filter: invert(1) brightness(0.8) contrast(1.2);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
    color: var(--text-muted) !important;
}

/* Validation */
.text-danger {
    color: var(--color-error) !important;
}


/* ─── Modal ─── */
.modal-content {
    background-color: var(--bg-surface-1) !important;
    border-color: var(--border-default) !important;
    color: var(--text-primary) !important;
}

.modal-header,
.modal-footer {
    border-color: var(--border-default) !important;
}

.modal-title {
    color: var(--text-primary) !important;
}

.btn-close {
    filter: invert(1);
}

/* Modal backdrop — no blur for performance */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: none !important;
}


/* ─── Dropdown ─── */
.dropdown-menu {
    background-color: var(--bg-surface-1) !important;
    border-color: var(--border-default) !important;
    box-shadow: var(--shadow-md);
}

.dropdown-item {
    color: var(--text-primary) !important;
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-surface-2) !important;
}


/* ─── Form Labels ─── */
.form-label,
label {
    color: var(--text-secondary) !important;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Table text */
.table,
.table td,
.table th {
    color: var(--text-primary) !important;
}

/* Row / Col text */
.row,
.col,
[class*="col-"] {
    color: var(--text-primary);
}

/* Checkbox / radio labels */
input[type="checkbox"]+span,
input[type="radio"]+span,
label span {
    color: var(--text-secondary) !important;
}

/* Small text */
small,
.small {
    color: var(--text-secondary) !important;
}

/* Badge text */
.badge {
    color: inherit;
}

/* Alert text */
.alert {
    color: var(--text-primary) !important;
}

/* Input group text */
.input-group-text {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-default) !important;
}


/* ═══════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}


/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface-0);
    border-right: 1px solid var(--border-default);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-normal);
    will-change: transform;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-default);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    color: white;
}

.sidebar-brand-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}


/* ─── Navigation ─── */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: 0.25rem 0.75rem;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.125rem;
}

.nav-item {
    margin-bottom: 0.125rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast),
        color var(--transition-fast);
    text-decoration: none;
    font-size: 0.8125rem;
}

.nav-link:hover {
    background: var(--bg-surface-1);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-primary-subtle);
    color: var(--accent-primary-light);
    border-left: 3px solid var(--accent-primary);
}

.nav-link-icon {
    font-size: 1.125rem;
    width: 22px;
    text-align: center;
    opacity: 0.85;
}

.nav-link.active .nav-link-icon {
    opacity: 1;
}


/* ─── Sidebar User ─── */
.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-default);
    background: var(--bg-surface-2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-inverse);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.user-email {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ─── Main Content ─── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


/* ─── Top Header ─── */
.top-header {
    height: var(--header-height);
    background: var(--bg-surface-0);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.global-search {
    position: relative;
    flex: 1;
    max-width: 520px;
    margin: 0 1.25rem;
}

.global-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.global-search-input {
    width: 100%;
    height: 38px;
    padding: 0 0.9rem 0 2.35rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface-2);
    color: var(--text-primary);
    outline: none;
}

.global-search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

.global-search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    z-index: 1050;
    background: var(--bg-surface-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.global-search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-default);
}

.global-search-result:hover,
.global-search-result.active {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.global-search-result-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(124, 58, 237, 0.14);
    color: var(--accent-primary);
    flex-shrink: 0;
}

.global-search-result-content {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.global-search-result-title,
.global-search-result-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-result-title {
    font-weight: 600;
}

.global-search-result-subtitle {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.global-search-more,
.global-search-empty {
    width: 100%;
    padding: 0.75rem 0.85rem;
    background: var(--bg-surface-1);
    color: var(--text-muted);
    border: 0;
    text-align: center;
}

.global-search-more:hover {
    color: var(--text-primary);
    background: var(--bg-surface-2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}


/* Header User Section */
.header-user-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-page {
    display: grid;
    gap: 1rem;
}

.search-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.search-page-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: min(460px, 100%);
}

.search-page-form > i {
    color: var(--text-muted);
}

.search-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    color: var(--text-muted);
}

.search-summary span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.65rem;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}

.search-results-list {
    display: grid;
    gap: 0.6rem;
}

.search-result-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    background: var(--bg-surface-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    text-decoration: none;
}

.search-result-row:hover {
    background: var(--bg-surface-1);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.search-result-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(124, 58, 237, 0.14);
    color: var(--accent-primary);
    flex-shrink: 0;
}

.search-result-content {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}

.search-result-title,
.search-result-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-title {
    font-weight: 700;
}

.search-result-subtitle {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.search-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 160px;
    color: var(--text-muted);
}

.header-streak,
.header-level,
.header-xp {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    background: var(--bg-surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
}

.header-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-inverse);
}


/* ─── Page Loading Overlay ─── */
.page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.page-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.book-loader {
    width: 80px;
    height: 60px;
    position: relative;
    perspective: 400px;
}

.book-loader .page {
    width: 40px;
    height: 60px;
    background: var(--accent-primary);
    position: absolute;
    left: 20px;
    transform-origin: left center;
    border-radius: 0 4px 4px 0;
}

.book-loader .page:nth-child(1) {
    background: var(--accent-primary-light);
    animation: pageTurn 1.2s ease-in-out infinite;
}

.book-loader .page:nth-child(2) {
    background: var(--accent-primary);
    animation: pageTurn 1.2s ease-in-out infinite 0.3s;
}

.book-loader .page:nth-child(3) {
    background: rgba(99, 102, 241, 0.5);
    animation: pageTurn 1.2s ease-in-out infinite 0.6s;
}

@keyframes pageTurn {

    0%,
    100% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(-120deg);
    }
}

.loading-text {
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    animation: pulse 1.5s ease-in-out infinite;
}


/* ─── Page Content ─── */
.page-content {
    flex: 1;
    padding: 1.75rem;
    background: var(--bg-base);
    animation: fadeIn 0.2s ease;
}


/* ═══════════════════════════════════════════════
   COMPONENTS
   ═══════════════════════════════════════════════ */

/* ─── Cards ─── */
.card {
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: border-color var(--transition-fast);
}

.card:hover {
    border-color: var(--border-light);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--border-default);
}

.card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin: 0;
}


/* ─── Forms ─── */
.form-group {
    margin-bottom: 1.125rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-subtle);
}

.form-control.is-invalid,
.form-control:invalid {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px var(--color-error-subtle);
}

.form-control::placeholder {
    color: var(--text-muted);
}


/* ─── Stat Cards ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: border-color var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--border-light);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}

.stat-icon.purple {
    background: var(--accent-primary-subtle);
    color: var(--accent-primary);
}

.stat-icon.cyan {
    background: var(--color-info-subtle);
    color: var(--accent-secondary-light);
}

.stat-icon.green {
    background: var(--color-success-subtle);
    color: var(--color-success);
}

.stat-icon.orange {
    background: var(--color-warning-subtle);
    color: var(--color-warning);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}


/* ─── Tables ─── */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-default);
}

.table th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg-surface-2);
    position: sticky;
    top: 0;
    z-index: 5;
}

.table tr:hover td {
    background: var(--bg-surface-2);
}


/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: var(--radius-pill);
}

.badge-purple {
    background: var(--accent-primary-subtle);
    color: var(--accent-primary-light);
}

.badge-cyan {
    background: var(--color-info-subtle);
    color: var(--accent-secondary-light);
}

.badge-green {
    background: var(--color-success-subtle);
    color: var(--color-success);
}

.badge-orange {
    background: var(--color-warning-subtle);
    color: var(--color-warning);
}

.badge-red {
    background: var(--color-error-subtle);
    color: var(--color-error);
}


/* ─── Progress Bar ─── */
.progress {
    height: 6px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-pill);
    transition: width var(--transition-normal);
}


/* ─── Alerts ─── */
.alert {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    border-left: 3px solid transparent;
}

.alert-success {
    background: var(--color-success-subtle);
    border-left-color: var(--color-success);
}

.alert-warning {
    background: var(--color-warning-subtle);
    border-left-color: var(--color-warning);
}

.alert-danger {
    background: var(--color-error-subtle);
    border-left-color: var(--color-error);
}

.alert-info {
    background: var(--color-info-subtle);
    border-left-color: var(--color-info);
}


/* ═══════════════════════════════════════════════
   ANIMATIONS (GPU-only)
   ═══════════════════════════════════════════════ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn var(--transition-normal) ease forwards;
}


/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface-0);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


/* ═══════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-purple {
    color: var(--accent-primary);
}

.text-cyan {
    color: var(--accent-secondary-light);
}

.text-green {
    color: var(--color-success);
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-5 {
    margin-bottom: 2rem;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}


/* ═══════════════════════════════════════════════
   PLANNER STYLES
   ═══════════════════════════════════════════════ */
.planner-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 3.5rem);
    gap: 0.75rem;
}

.planner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: var(--bg-surface-1);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
}

.planner-body {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    overflow: hidden;
}

/* Planner Sidebar */
.planner-sidebar {
    width: 200px;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 0.875rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subject-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.subject-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.625rem;
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: background-color var(--transition-fast),
        transform var(--transition-fast);
    font-size: 0.8125rem;
}

.subject-chip:hover {
    background: var(--bg-surface-3);
    transform: translateX(3px);
}

.subject-chip.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.subject-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Quick Stats */
.quick-stats {
    padding: 0.625rem;
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.375rem;
}

.stat-row span:last-child {
    font-weight: 600;
    color: var(--accent-primary-light);
}

/* Planner Grid */
.planner-grid {
    flex: 1;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.grid-header {
    display: flex;
    background: var(--bg-surface-2);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.time-gutter {
    width: 60px;
    flex-shrink: 0;
}

.day-header {
    flex: 1;
    text-align: center;
    padding: 0.625rem 0.5rem;
    border-left: 1px solid var(--border-default);
}

.day-header.today {
    background: var(--accent-primary-subtle);
}

.day-name {
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    letter-spacing: 0.04em;
}

.day-number {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.day-number.today-number {
    background: var(--accent-primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Grid Body */
.grid-body {
    flex: 1;
    overflow-y: auto;
}

.time-row {
    display: flex;
    min-height: 48px;
    border-bottom: 1px solid var(--border-default);
}

.time-label {
    width: 60px;
    flex-shrink: 0;
    font-size: 0.6875rem;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    text-align: right;
}

.time-cell {
    flex: 1;
    border-left: 1px solid var(--border-default);
    transition: background-color var(--transition-fast);
    cursor: pointer;
}

.time-cell:hover {
    background: var(--accent-primary-subtle);
}

.time-cell.drag-over {
    background: rgba(99, 102, 241, 0.18);
    box-shadow: inset 0 0 0 2px var(--accent-primary);
}

/* Plans */
.plans-container {
    position: absolute;
    top: 51px;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.plan-card {
    position: absolute;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    cursor: grab;
    pointer-events: auto;
    transition: transform var(--transition-fast);
    min-height: 56px;
    box-shadow: var(--shadow-sm);
}

.plan-card:hover {
    transform: scale(1.02);
    z-index: 10;
}

.plan-card.dragging {
    opacity: 0.7;
    cursor: grabbing;
}

.plan-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.375rem;
}

.plan-subject {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.plan-duration {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* Analytics Panel */
.planner-analytics {
    width: 200px;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 0.875rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.breakdown-item {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-default);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
}

.breakdown-header span:last-child {
    margin-left: auto;
}

/* Modal Enhancements */
.duration-btn {
    padding: 0.4rem 0.625rem;
    font-size: 0.75rem;
}

.duration-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}


/* ─── Gamification ─── */
.user-gamification {
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px dashed var(--border-default);
}

.level-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.level-info {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-primary-light);
}

.xp-text {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.xp-progress-container {
    height: 3px;
    background: var(--bg-base);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.375rem;
}

.xp-progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--color-warning);
    background: var(--color-warning-subtle);
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-pill);
    text-decoration: none !important;
}

.streak-badge i {
    font-size: 0.8125rem;
}


/* ═══════════════════════════════════════════════
   PWA & MOBILE
   ═══════════════════════════════════════════════ */

/* Touch-friendly minimum targets */
.touch-target,
a.nav-link {
    min-height: 44px;
    min-width: 44px;
}

input[type="checkbox"],
input[type="radio"] {
    min-height: 16px;
    min-width: 16px;
    width: 16px;
    height: 16px;
}


/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .top-header {
        height: auto;
        min-height: var(--header-height);
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .global-search {
        order: 3;
        width: 100%;
        max-width: none;
        margin: 0;
        flex-basis: 100%;
    }

    .search-page-header,
    .search-page-form {
        flex-direction: column;
        align-items: stretch;
    }

    .page-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    body {
        font-size: 16px;
    }

    .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn {
        padding: 0.55rem 1rem;
        font-size: 0.875rem;
    }

    .row>.col-md-6,
    .row>.col-md-4,
    .row>.col-md-3 {
        margin-bottom: 1rem;
    }

    input,
    select,
    textarea {
        font-size: 16px;
        padding: 0.625rem;
    }

    #timerDisplay,
    .focus-timer {
        font-size: 3rem !important;
    }

    .table {
        font-size: 0.8125rem;
    }

    .table th:nth-child(n+5),
    .table td:nth-child(n+5) {
        display: none;
    }

    /* Planner responsive */
    .planner-body {
        flex-direction: column;
    }

    .planner-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }

    .subject-list {
        flex-direction: row;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
    }
}

@media (max-width: 1200px) {
    .planner-analytics {
        display: none;
    }
}

@media (max-width: 992px) {
    .planner-sidebar {
        width: 160px;
    }
}


/* PWA Install */
#pwa-install-btn {
    animation: pulse 2s infinite;
}

@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    #pwa-install-btn {
        display: none !important;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .sidebar {
        width: 200px;
    }

    .top-header {
        min-height: 48px;
    }
}

@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .card,
    .btn,
    input,
    select {
        border-width: 0.5px;
    }
}


/* Daily Plan */
.daily-planner-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 1120px;
    margin: 0 auto;
}

.daily-toolbar,
.daily-progress-section,
.daily-tasks-container {
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

.daily-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1rem;
}

.daily-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.daily-date-pill {
    min-width: 220px;
    text-align: center;
    padding: 0.45rem 0.875rem;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.daily-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.daily-stat-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: 86px;
    padding: 1rem;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

.daily-stat-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
}

.daily-stat-icon.purple {
    background: var(--accent-primary-subtle);
    color: var(--accent-primary-light);
}

.daily-stat-icon.cyan {
    background: var(--color-info-subtle);
    color: var(--accent-secondary-light);
}

.daily-stat-icon.green {
    background: var(--color-success-subtle);
    color: var(--color-success);
}

.daily-stat-content {
    min-width: 0;
}

.daily-stat-value {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.daily-stat-label {
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.daily-progress-section {
    padding: 1rem;
}

.daily-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.daily-progress-percent {
    color: var(--accent-primary-light);
}

.daily-progress-bar {
    height: 9px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--bg-surface-2);
}

.daily-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width var(--transition-normal);
}

.daily-tasks-container {
    min-height: 260px;
    padding: 1rem;
}

.daily-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.daily-task-card {
    display: grid;
    grid-template-columns: 22px 34px minmax(0, 1fr) 12px;
    align-items: center;
    gap: 0.75rem;
    min-height: 68px;
    padding: 0.875rem;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
}

.daily-task-card:hover,
.daily-task-card.drag-over {
    border-color: var(--accent-primary);
    background: var(--bg-surface-3);
}

.daily-task-card:hover {
    transform: translateY(-1px);
}

.daily-task-card.dragging {
    opacity: 0.65;
}

.daily-task-card.is-completed {
    opacity: 0.72;
}

.daily-task-drag {
    color: var(--text-muted);
    cursor: grab;
}

.daily-task-checkbox {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    color: white;
    background: var(--bg-surface-1);
}

.daily-task-checkbox.checked {
    background: var(--color-success);
    border-color: var(--color-success);
}

.daily-task-content {
    min-width: 0;
}

.daily-task-title {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daily-task-title.completed {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.daily-task-time {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.daily-task-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    padding: 0.125rem 0.45rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface-1);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

.daily-task-color {
    width: 10px;
    height: 42px;
    border-radius: var(--radius-pill);
}

.daily-empty-state {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.daily-empty-state[hidden] {
    display: none;
}

.daily-empty-state > i {
    margin-bottom: 0.875rem;
    color: var(--accent-primary-light);
    font-size: 2.5rem;
}

.daily-empty-state h3 {
    margin-bottom: 0.25rem;
}

.daily-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.58);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.daily-drawer-backdrop.is-open {
    pointer-events: auto;
    opacity: 1;
}

.daily-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1100;
    width: min(520px, 100vw);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface-1);
    border-left: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
}

.daily-drawer.is-open {
    transform: translateX(0);
}

.daily-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-default);
}

.daily-kicker {
    margin: 0 0 0.25rem;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.daily-drawer-header h3 {
    margin: 0;
}

.daily-drawer-close {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

.daily-form {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.daily-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.875rem;
}

.daily-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.daily-field[hidden],
.study-only-field[hidden] {
    display: none;
}

.daily-field-full,
.daily-time-fields {
    grid-column: 1 / -1;
}

.daily-time-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.875rem;
}

.daily-time-fields[hidden] {
    display: none;
}

.daily-time-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.daily-time-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 38px;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
}

.daily-time-mode-btn.is-active {
    border-color: var(--accent-primary);
    background: var(--accent-primary-subtle);
    color: var(--accent-primary-light);
}

.daily-color-picker {
    display: grid;
    grid-template-columns: repeat(8, 30px);
    gap: 0.5rem;
}

.daily-color-option {
    width: 30px;
    height: 30px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
}

.daily-color-option.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--accent-primary);
}

.daily-form-error {
    margin-top: 1rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--color-error);
    border-radius: var(--radius-md);
    background: var(--color-error-subtle);
    color: var(--text-primary);
}

.daily-form-error[hidden] {
    display: none;
}

.daily-drawer-actions {
    position: sticky;
    bottom: -1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    margin: 1.25rem -1.25rem -1.25rem;
    padding: 1rem 1.25rem;
    background: var(--bg-surface-1);
    border-top: 1px solid var(--border-default);
}

.daily-drawer-actions .btn-danger {
    margin-right: auto;
}

.daily-toast-stack {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.daily-toast {
    min-width: 220px;
    max-width: min(360px, calc(100vw - 2rem));
    padding: 0.75rem 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-surface-2);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.daily-toast.success {
    border-color: var(--color-success);
}

.daily-toast.error {
    border-color: var(--color-error);
}

@media (max-width: 768px) {
    .daily-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .daily-toolbar-group,
    .daily-toolbar > .btn {
        width: 100%;
    }

    .daily-toolbar-group .btn,
    .daily-toolbar > .btn {
        flex: 1;
    }

    .daily-date-pill {
        min-width: 0;
        width: 100%;
    }

    .daily-stats-grid,
    .daily-form-grid,
    .daily-time-fields {
        grid-template-columns: 1fr;
    }

    .daily-task-card {
        grid-template-columns: 28px minmax(0, 1fr) 10px;
    }

    .daily-task-drag {
        display: none;
    }

    .daily-drawer {
        width: 100vw;
    }

    .daily-drawer-actions {
        flex-wrap: wrap;
    }

    .daily-drawer-actions .btn {
        flex: 1 1 auto;
    }
}
