/* ============================================================
   Codebasics Events Calendar — Design System v4 "Solid"
   Inter · solid two-color system · glass surfaces · refined motion
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    /* Surfaces */
    --bg:        #F4F5FB;
    --surface:   #FFFFFF;
    --glass:        rgba(255, 255, 255, 0.72);
    --glass-strong: rgba(255, 255, 255, 0.9);
    --surface-2: #EEF0F7;

    /* Borders */
    --border:        rgba(17, 24, 50, 0.08);
    --border-mid:    rgba(17, 24, 50, 0.14);
    --border-strong: rgba(17, 24, 50, 0.24);
    --glass-edge:    rgba(255, 255, 255, 0.7);

    /* Text */
    --text:   #0E1018;
    --text-2: #4A5168;
    --text-3: #8C93A8;

    /* Category palette — solid */
    --blue:        #2563EB;
    --blue-hover:  #1D4ED8;
    --blue-soft:   rgba(37, 99, 235, 0.08);
    --blue-tint:   rgba(37, 99, 235, 0.14);
    --blue-glow:   rgba(37, 99, 235, 0.30);

    --purple:      #7C3AED;
    --purple-soft: rgba(124, 58, 237, 0.08);
    --purple-tint: rgba(124, 58, 237, 0.14);
    --purple-glow: rgba(124, 58, 237, 0.30);

    --danger: #EF4444;

    /* Radius */
    --r-xs: 6px;  --r-sm: 9px;  --r-md: 13px;
    --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(17, 24, 50, 0.06);
    --shadow-sm: 0 2px 8px rgba(17, 24, 50, 0.07), 0 1px 2px rgba(17, 24, 50, 0.04);
    --shadow-md: 0 8px 24px rgba(17, 24, 50, 0.10), 0 2px 6px rgba(17, 24, 50, 0.05);
    --shadow-lg: 0 20px 48px rgba(17, 24, 50, 0.14), 0 6px 14px rgba(17, 24, 50, 0.07);
    --shadow-xl: 0 32px 72px rgba(17, 24, 50, 0.22), 0 12px 24px rgba(17, 24, 50, 0.10);

    /* Motion */
    --spring: cubic-bezier(0.16, 1, 0.3, 1);
    --ease:   cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg:        #0A0B12;
    --surface:   #13151F;
    --glass:        rgba(24, 27, 40, 0.68);
    --glass-strong: rgba(24, 27, 40, 0.88);
    --surface-2: #1B1E2C;

    --border:        rgba(255, 255, 255, 0.08);
    --border-mid:    rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.26);
    --glass-edge:    rgba(255, 255, 255, 0.10);

    --text:   #EDF0FA;
    --text-2: #969DB5;
    --text-3: #5A6178;

    --blue:        #3B82F6;
    --blue-hover:  #60A5FA;
    --blue-soft: rgba(59,130,246,0.14); --blue-tint: rgba(59,130,246,0.22); --blue-glow: rgba(59,130,246,0.40);
    --purple:      #8B5CF6;
    --purple-soft: rgba(139,92,246,0.14); --purple-tint: rgba(139,92,246,0.22); --purple-glow: rgba(139,92,246,0.40);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.25);
    --shadow-md: 0 8px 28px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 56px rgba(0,0,0,0.62), 0 6px 18px rgba(0,0,0,0.4);
    --shadow-xl: 0 32px 80px rgba(0,0,0,0.78), 0 14px 28px rgba(0,0,0,0.5);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue); text-decoration: none; }

/* Text selection — brand-tinted */
::selection { background: color-mix(in srgb, var(--blue) 24%, transparent); }

/* Keyboard focus — one consistent accent ring (mouse clicks stay clean) */
:focus-visible { outline: 2px solid color-mix(in srgb, var(--blue) 75%, transparent); outline-offset: 2px; }
button, a.dec-btn, a.dec-edit, .book-choice, .view-opt, .mini-day, .mp-month, .cal-event-chip { -webkit-user-select: none; user-select: none; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
* { scrollbar-width: thin; scrollbar-color: var(--border-mid) transparent; }

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.cico { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Category accent system ─────────────────────────────────── */
.cat-live  { --acc: var(--blue);   --acc-soft: var(--blue-soft);   --acc-glow: var(--blue-glow); }
.cat-event { --acc: var(--purple); --acc-soft: var(--purple-soft); --acc-glow: var(--purple-glow); }

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(14px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes popover-in {
    from { opacity: 0; transform: scale(0.96) translateY(-6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes card-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TOP NAV — frosted glass
   ============================================================ */
.top-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 26px; height: 60px;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.top-nav-logo { height: 30px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    background: var(--blue); color: #fff; border: none; border-radius: var(--r-sm);
    padding: 0 18px; height: 38px;
    font-family: inherit; font-weight: 600; font-size: 13.5px; letter-spacing: -0.1px;
    cursor: pointer; white-space: nowrap;
    box-shadow: 0 2px 8px var(--blue-glow);
    transition: background 140ms ease, box-shadow 160ms ease, transform 120ms ease;
}
.btn-primary:hover { background: var(--blue-hover); box-shadow: 0 6px 18px var(--blue-glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-sm { height: 32px; font-size: 12.5px; padding: 0 13px; border-radius: var(--r-xs); }

.btn-outline {
    background: var(--glass); color: var(--text-2);
    border: 1px solid var(--border-mid); border-radius: var(--r-sm);
    padding: 0 14px; height: 34px;
    font-family: inherit; font-weight: 500; font-size: 13px;
    cursor: pointer; white-space: nowrap; backdrop-filter: blur(8px);
    transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.btn-outline:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }

.btn-icon {
    background: none; border: none; color: var(--text-3);
    cursor: pointer; padding: 6px; border-radius: var(--r-xs);
    line-height: 1; font-size: 15px;
    transition: color 140ms ease, background 140ms ease;
}
.btn-icon:hover { color: var(--text); background: var(--surface-2); }

.btn-ms {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    width: 100%; padding: 0 20px; height: 46px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-mid); border-radius: var(--r-sm);
    font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}
.btn-ms:hover { background: var(--surface-2); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-ms:disabled { opacity: 0.55; cursor: not-allowed; }

.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: var(--r-sm); color: var(--text-3); font-size: 15px;
    cursor: pointer; flex-shrink: 0; backdrop-filter: blur(8px);
    transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.theme-toggle:hover { border-color: var(--border-mid); color: var(--text); background: var(--surface-2); }

/* ============================================================
   CARD (login)
   ============================================================ */
.card {
    background: var(--glass-strong);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-edge);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
}

/* ============================================================
   APP SHELL
   ============================================================ */
.cal-app { display: grid; grid-template-columns: 256px 1fr; height: calc(100vh - 60px); min-height: 0; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.cal-sidebar {
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-right: 1px solid var(--border);
    padding: 18px 16px 22px;
    display: flex; flex-direction: column; gap: 24px; overflow-y: auto;
}
.cal-new-side { width: 100%; height: 42px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 600; }

/* ── Mini calendar ── */
.mini-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mini-cal-label { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -0.1px; }
.mini-nav {
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 15px;
    border-radius: var(--r-xs); transition: background 140ms ease, color 140ms ease;
}
.mini-nav:hover { background: var(--surface-2); color: var(--text); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-dow {
    text-align: center; font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.4px; color: var(--text-3); padding: 4px 0 3px;
}
.mini-day {
    aspect-ratio: 1; border: none; background: none; cursor: pointer; border-radius: 50%;
    font-size: 11px; font-weight: 500; color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
    transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}
.mini-day:hover { background: var(--surface-2); color: var(--text); transform: scale(1.08); }
.mini-out { color: var(--text-3); opacity: 0.4; }
.mini-today { color: var(--blue); font-weight: 700; }
.mini-sel { background: var(--blue) !important; color: #fff !important; font-weight: 600; box-shadow: 0 2px 6px var(--blue-glow); }

/* ── Today's events (sidebar) ── */
.today-events { display: flex; flex-direction: column; gap: 10px; }
.today-events-head { display: flex; align-items: baseline; justify-content: space-between; }
.today-events-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-3); }
.today-events-date { font-size: 10px; font-weight: 600; color: var(--text-3); }
#today-events-list { display: flex; flex-direction: column; gap: 7px; }
.te-item {
    display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--acc, var(--blue)) 8%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--acc, var(--blue)) 14%, transparent);
    border-radius: var(--r-md);
    cursor: pointer; box-shadow: var(--shadow-xs);
    transition: transform 180ms var(--spring), box-shadow 180ms var(--spring), border-color 180ms ease;
}
.te-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--acc, var(--blue)) 26%, transparent); }
[data-theme="dark"] .te-item { background: color-mix(in srgb, var(--acc, var(--blue)) 14%, var(--surface)); border-color: color-mix(in srgb, var(--acc, var(--blue)) 22%, transparent); }
.te-top { display: flex; align-items: center; gap: 6px; }
.te-top .cico { width: 13px; height: 13px; color: var(--acc, var(--blue)); flex-shrink: 0; }
.te-time { font-size: 11px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.te-title { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-empty { font-size: 12px; color: var(--text-3); text-align: center; padding: 16px 8px; border: 1px dashed var(--border-mid); border-radius: var(--r-md); }

/* ============================================================
   MAIN AREA
   ============================================================ */
.cal-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px 22px 12px; }

/* ── Toolbar ── */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-shrink: 0; flex-wrap: wrap; }
.cal-toolbar-left { position: relative; display: flex; align-items: center; gap: 7px; }
.cal-toolbar-right { display: flex; align-items: center; }
.cal-tb-btn {
    padding: 0 15px; height: 34px; border-radius: var(--r-sm);
    border: 1px solid var(--border-mid); background: var(--glass); backdrop-filter: blur(8px);
    font-family: inherit; font-weight: 500; font-size: 13px; color: var(--text-2);
    cursor: pointer; box-shadow: var(--shadow-xs);
    transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.cal-tb-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.cal-tb-icon {
    width: 34px; height: 34px; border-radius: var(--r-sm);
    border: 1px solid var(--border); background: var(--glass); backdrop-filter: blur(8px);
    color: var(--text-2); font-size: 18px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-xs); line-height: 1;
    transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.cal-tb-icon:hover { border-color: var(--border-mid); color: var(--text); background: var(--surface-2); }
.cal-month-trigger {
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
    padding: 0 12px; height: 34px; cursor: pointer; font-family: inherit;
    transition: background 140ms ease, border-color 140ms ease;
}
.cal-month-trigger:hover { background: var(--surface-2); border-color: var(--border); }
.cal-month-label { font-size: 19px; font-weight: 800; letter-spacing: -0.5px; color: var(--text); }
.cal-caret { font-size: 11px; color: var(--text-3); transition: transform 160ms ease; }
.cal-month-trigger.open .cal-caret { transform: rotate(180deg); }

.view-switcher {
    display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-sm); padding: 3px; gap: 2px;
}
.view-opt {
    padding: 0 15px; height: 28px; border: none; background: transparent;
    border-radius: calc(var(--r-sm) - 2px);
    font-family: inherit; font-weight: 500; font-size: 12.5px; color: var(--text-2);
    cursor: pointer; transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.view-opt:hover { color: var(--text); }
.view-opt.active { background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 2px 6px var(--blue-glow); }

/* ── Month-picker popover ── */
.month-picker {
    position: absolute; top: calc(100% + 10px); left: 0; z-index: 200; width: 272px;
    background: var(--glass-strong);
    backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-edge); border-radius: var(--r-lg);
    padding: 16px; box-shadow: var(--shadow-lg);
    animation: popover-in 200ms var(--spring) both;
}
.month-picker.hidden { display: none; }
.cal-toolbar-left .month-picker { left: 0; transform: none; }
.mp-year-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mp-year { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.mp-year-btn {
    width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; color: var(--text-2); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--r-xs); cursor: pointer;
    transition: border-color 140ms ease, color 140ms ease;
}
.mp-year-btn:hover { border-color: var(--blue); color: var(--blue); }
.mp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.mp-month {
    padding: 9px 0; font-size: 12.5px; font-weight: 500; color: var(--text-2);
    background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
    cursor: pointer; text-align: center; transition: background 140ms ease, color 140ms ease;
}
.mp-month:hover { background: var(--surface-2); color: var(--text); }
.mp-month.selected { background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 2px 6px var(--blue-glow); }
.mp-today { width: 100%; margin-top: 12px; }

/* ── Error banner ── */
.cal-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 12px; padding: 11px 15px;
    border: 1px solid rgba(239, 68, 68, 0.28); border-radius: var(--r-md);
    background: rgba(239, 68, 68, 0.08); color: var(--danger); font-size: 12.5px; font-weight: 600;
}
.cal-banner-retry {
    flex-shrink: 0; padding: 0 13px; height: 30px; border-radius: var(--r-xs); cursor: pointer;
    border: 1px solid var(--danger); background: transparent; color: var(--danger);
    font-family: inherit; font-weight: 600; font-size: 12px; transition: background 140ms ease;
}
.cal-banner-retry:hover { background: rgba(239, 68, 68, 0.12); }

/* ============================================================
   MONTH GRID
   ============================================================ */
#view-month { flex: 1; min-height: 0; display: flex; }
.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: auto repeat(6, 1fr);
    gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-lg);
    overflow: hidden; flex: 1; box-shadow: var(--shadow-sm);
}
.cal-day-header {
    background: var(--glass); backdrop-filter: blur(8px);
    text-align: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--text-3); padding: 9px 0 7px;
}
.cal-cell {
    position: relative; background: var(--surface); min-height: 92px; padding: 8px 7px 5px;
    cursor: pointer; overflow: hidden; transition: background 140ms ease;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell-outside { background: color-mix(in srgb, var(--bg) 55%, transparent); }
.cal-cell-outside:hover { background: var(--surface-2); }
.cal-cell-outside .cal-day-num { opacity: 0.32; }
.cal-today { background: color-mix(in srgb, var(--blue) 7%, var(--surface)); }
.cal-today:hover { background: color-mix(in srgb, var(--blue) 11%, var(--surface)); }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; line-height: 1; display: inline-block; font-variant-numeric: tabular-nums; }
.cal-today-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 23px; height: 23px; background: var(--blue); color: #fff;
    border-radius: 50%; font-size: 11.5px; font-weight: 700; box-shadow: 0 2px 6px var(--blue-glow);
}
.cal-event-chip {
    display: flex; align-items: center; gap: 5px;
    font-size: 10.5px; font-weight: 600; padding: 2.5px 7px; border-radius: var(--r-pill);
    margin-bottom: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    cursor: pointer; line-height: 1.3; transition: filter 120ms ease, transform 120ms ease;
}
.cal-event-chip::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.cal-event-chip.cat-live  { color: #1D4ED8; background: var(--blue-soft); }
.cal-event-chip.cat-event { color: #6D28D9; background: var(--purple-soft); }
.cal-event-chip:hover { filter: brightness(0.92); transform: translateX(1px); }
[data-theme="dark"] .cal-event-chip.cat-live  { color: #93C5FD; }
[data-theme="dark"] .cal-event-chip.cat-event { color: #C4B5FD; }
.cal-chip-time { opacity: 0.62; font-variant-numeric: tabular-nums; font-size: 10px; font-weight: 700; }
.cal-more { font-size: 10.5px; font-weight: 600; color: var(--text-3); padding: 1px 5px; cursor: pointer; }
.cal-more:hover { color: var(--blue); }

/* ============================================================
   WEEK / DAY TIME GRID
   ============================================================ */
#view-timegrid { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tg-headrow { display: grid; border-bottom: 1px solid var(--border); flex-shrink: 0; padding-right: 6px; }
.tg-dayhead {
    text-align: center; padding: 9px 0; border-left: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tg-dow { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); }
.tg-daynum {
    font-size: 17px; font-weight: 700; color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 8px; border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums; transition: background 140ms ease;
}
.tg-today .tg-dow { color: var(--blue); }
.tg-today .tg-daynum { background: var(--blue); color: #fff; box-shadow: 0 2px 6px var(--blue-glow); }
.timegrid { flex: 1; display: grid; overflow-y: auto; min-height: 0; position: relative; }
.tg-axis { border-right: 1px solid var(--border); }
.tg-axis-hour { position: relative; }
.tg-axis-hour span { position: absolute; top: -7px; right: 9px; font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tg-col { position: relative; border-left: 1px solid var(--border); }
.tg-col-today { background: color-mix(in srgb, var(--blue) 4%, transparent); }
.tg-hour { border-bottom: 1px solid var(--border); cursor: pointer; }
.tg-hour:hover { background: var(--surface-2); }
.tg-now-line { position: absolute; left: 0; right: 0; height: 2px; background: #EF4444; pointer-events: none; z-index: 10; border-radius: 1px; }
.tg-now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #EF4444; }
.tg-event {
    position: absolute; border-radius: var(--r-sm); padding: 4px 8px;
    font-size: 11px; font-weight: 600; line-height: 1.3; overflow: hidden; cursor: pointer;
    border: 1px solid transparent; box-shadow: var(--shadow-xs);
    transition: filter 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.tg-event.cat-live  { background: var(--blue-tint);   color: #1D4ED8; border-color: color-mix(in srgb, var(--blue) 24%, transparent); }
.tg-event.cat-event { background: var(--purple-tint); color: #6D28D9; border-color: color-mix(in srgb, var(--purple) 24%, transparent); }
.tg-event:hover { filter: brightness(0.96); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tg-ev-time { font-variant-numeric: tabular-nums; opacity: 0.72; }
[data-theme="dark"] .tg-event.cat-live  { color: #BFDBFE; }
[data-theme="dark"] .tg-event.cat-event { color: #DDD6FE; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10, 12, 24, 0.42);
    backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%);
    z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-overlay:not(.hidden) { animation: overlay-in 200ms var(--ease) both; }
.modal-overlay:not(.hidden) .modal-box { animation: modal-in 300ms var(--spring) both; }
.modal-box {
    background: var(--surface); border: 1px solid var(--glass-edge); border-radius: var(--r-xl);
    width: 100%; max-width: 580px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-xl);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px 0; margin-bottom: 18px; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; text-wrap: balance; }

/* ── Day modal — clean solid header ── */
.day-modal-box { display: flex; flex-direction: column; padding: 0; max-height: 88vh; overflow: hidden; }
.day-modal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 22px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0;
    position: relative; z-index: 2; box-shadow: 0 6px 16px -12px rgba(17, 24, 50, 0.35);
}
.day-modal-header .modal-title { font-size: 18px; }
.day-modal-actions { display: flex; align-items: center; gap: 9px; }
.day-modal-body {
    overflow-y: auto; padding: 16px 18px 24px;
    display: flex; flex-direction: column; gap: 13px; background: var(--bg);
}
.day-modal-body .dec { animation: card-rise 360ms var(--spring) both; }
.day-modal-body .dec:nth-child(1) { animation-delay: 30ms; }
.day-modal-body .dec:nth-child(2) { animation-delay: 80ms; }
.day-modal-body .dec:nth-child(3) { animation-delay: 130ms; }
.day-modal-body .dec:nth-child(4) { animation-delay: 180ms; }
.day-modal-body .dec:nth-child(n+5) { animation-delay: 220ms; }

/* ── New booking chooser ── */
.book-chooser { max-width: 540px; }
.book-chooser .modal-header { padding: 24px 26px 0; }
.book-chooser-sub { padding: 0 26px; margin-bottom: 22px; font-size: 13.5px; color: var(--text-3); line-height: 1.5; }
.book-choices { display: flex; gap: 14px; padding: 0 26px 26px; }
.book-choice {
    flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 11px;
    padding: 26px 18px; border: 1px solid var(--border-mid); border-radius: var(--r-lg);
    background: var(--surface); cursor: pointer; text-decoration: none;
    transition: border-color 180ms ease, transform 180ms var(--spring), box-shadow 180ms ease, background 180ms ease;
}
.book-choice:first-child { --c: var(--purple); --c-soft: var(--purple-soft); }
.book-choice:last-child  { --c: var(--blue);   --c-soft: var(--blue-soft); }
.book-choice:hover { border-color: var(--c); background: var(--c-soft); transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.book-choice-icon {
    width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
    font-size: 26px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border);
}
.book-choice-title { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.3; text-wrap: balance; }
.book-choice-sub { font-size: 12px; color: var(--text-3); line-height: 1.4; }
@media (max-width: 520px) { .book-choices { flex-direction: column; } }

/* ============================================================
   DAY EVENT CARD (.dec) — solid color spine + clean stack
   ============================================================ */
.dec {
    padding: 16px 18px;
    background: color-mix(in srgb, var(--acc, var(--blue)) 7%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--acc, var(--blue)) 12%, transparent);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 200ms var(--spring), transform 200ms var(--spring), border-color 200ms ease;
}
.dec:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--acc, var(--blue)) 24%, transparent); }
.dec.is-past { opacity: 0.62; }
[data-theme="dark"] .dec { background: color-mix(in srgb, var(--acc, var(--blue)) 13%, var(--surface)); border-color: color-mix(in srgb, var(--acc, var(--blue)) 20%, transparent); }

.dec-main { display: flex; flex-direction: column; }

/* Header: colored category eyebrow + actions */
.dec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dec-eyebrow {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0;
    color: var(--acc, var(--blue));
    font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
}
.dec-eyebrow .cico { width: 13px; height: 13px; }
.dec-eyebrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dec-head-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dec-done {
    font-size: 9.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
    color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border);
    padding: 3px 8px; border-radius: var(--r-pill);
}
.dec-edit {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 9px; border-radius: var(--r-xs);
    background: transparent; border: 1px solid transparent; color: var(--text-3);
    font-family: inherit; font-weight: 500; font-size: 12px; cursor: pointer;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.dec-edit .cico { width: 12px; height: 12px; }
.dec-edit, .dec-edit:hover { text-decoration: none; }
.dec-edit:hover { color: var(--acc, var(--blue)); background: var(--acc-soft, var(--blue-soft)); border-color: color-mix(in srgb, var(--acc, var(--blue)) 28%, transparent); }

/* Time line */
.dec-time {
    margin-top: 12px; display: flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 700; color: var(--text-2);
    font-variant-numeric: tabular-nums; letter-spacing: 0.2px;
}
.dec-time-dash { color: var(--text-3); font-weight: 500; }

/* Title — the hero */
.dec-title { font-size: 16.5px; font-weight: 700; color: var(--text); line-height: 1.32; margin: 3px 0 0; letter-spacing: -0.3px; overflow-wrap: anywhere; text-wrap: pretty; }

/* One quiet metadata line */
.dec-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dec-mi { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--text-2); min-width: 0; }
.dec-mi .cico { width: 13px; height: 13px; color: var(--text-3); flex-shrink: 0; }
.dec-mi span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dec-mi-type { font-weight: 600; }
.dec-sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); font-size: 0; flex-shrink: 0; }
.dec-stat { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--text); }
.dec-stat .cico { width: 13px; height: 13px; color: var(--acc, var(--blue)); }
.dec-aipro {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px; color: #fff;
    background: var(--acc, var(--blue)); padding: 3px 9px; border-radius: var(--r-pill);
}

/* Bootcamps */
.dec-bootcamps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dec-bootcamp {
    font-size: 10.5px; font-weight: 600; color: var(--acc, var(--blue));
    background: var(--acc-soft, var(--blue-soft));
    border: 1px solid color-mix(in srgb, var(--acc, var(--blue)) 20%, transparent);
    padding: 3px 9px; border-radius: var(--r-pill);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* Footer: zoom account + actions */
.dec-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--acc, var(--blue)) 15%, transparent); }
.dec-acct { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; flex-wrap: wrap; }
.dec-acct-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-3); }
.dec-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--acc, var(--blue)); flex-shrink: 0; }
.dec-acct-mail { font-size: 12.5px; font-weight: 500; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.dec-actions { display: flex; gap: 9px; }
.dec-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 40px; border-radius: var(--r-sm); border: 1px solid transparent;
    font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: -0.1px;
    text-decoration: none; cursor: pointer;
    transition: transform 120ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}
.dec-btn .cico { width: 15px; height: 15px; }
.dec-btn.is-primary { background: var(--acc, var(--blue)); color: #fff; }
.dec-btn.is-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px var(--acc-glow, var(--blue-glow)); text-decoration: none; }
.dec-btn.is-secondary { background: transparent; color: var(--acc, var(--blue)); border-color: color-mix(in srgb, var(--acc, var(--blue)) 32%, transparent); }
.dec-btn.is-secondary:hover { background: var(--acc-soft, var(--blue-soft)); transform: translateY(-1px); text-decoration: none; }
.dec-btn.disabled { color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); cursor: not-allowed; pointer-events: none; }
.dec-btn.disabled .cico { color: var(--text-3); }
.dec-btn:active { transform: translateY(0) scale(0.985); }

/* Pressed feedback — tactile, consistent */
.te-item:active { transform: scale(0.99); }
.view-opt:active, .cal-tb-btn:active, .cal-tb-icon:active, .mini-day:active, .mp-month:active, .mini-nav:active { transform: scale(0.96); }
.book-choice:active { transform: translateY(-1px) scale(0.99); }
.dec-edit:active { transform: scale(0.96); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .cal-app { grid-template-columns: 1fr; height: auto; }
    .cal-sidebar { display: none; }
}
@media (max-width: 768px) {
    .cal-cell { min-height: 60px; padding: 5px 4px; }
    .cal-day-header { font-size: 9.5px; padding: 7px 0; }
    .cal-day-num { font-size: 10.5px; }
    .cal-event-chip { font-size: 9.5px; padding: 2px 5px; }
    .cal-month-label { font-size: 16px; }
    .top-nav { padding: 0 16px; }
    .top-nav-logo { height: 28px; }
    .dec-actions { flex-direction: column; }
}
@media (max-width: 480px) {
    .cal-grid { gap: 0.5px; }
    .cal-cell { min-height: 50px; }
    .cal-event-chip { font-size: 8.5px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
