/* ============================================================
   Todo App — Apple Liquid Glass design system
   Plain CSS, no build step. Two full themes on CSS variables:
   dark (default) and light, switched via html[data-theme].
   Accents: cyan #00F7FF · green #00FF15 (used as light/glows,
   not as paint everywhere — follow the reference imagery).
   ============================================================ */

:root {
    color-scheme: dark;

    /* Base */
    --bg: #04070f;
    --text: #eaf2ff;
    --text-2: #9db1cc;

    /* Accent identity */
    --cyan: #00f7ff;
    --green: #00ff15;
    --accent-text: #7df3ff;          /* readable accent for text on glass */
    --accent-hover: #9ff6ff;         /* link hover on dark glass */
    --grad-accent: linear-gradient(120deg, var(--cyan) 10%, var(--green) 90%);
    --ring: rgba(0, 247, 255, 0.85);
    --ring-soft: rgba(0, 247, 255, 0.14);
    --check-accent: #00d9e8;

    /* Glass surfaces */
    --glass: rgba(10, 18, 32, 0.55);
    --glass-strong: rgba(12, 20, 36, 0.72);
    --glass-raised: rgba(16, 26, 44, 0.5);
    --edge: rgba(160, 220, 255, 0.14);
    --edge-strong: rgba(160, 220, 255, 0.3);
    --sheen: rgba(255, 255, 255, 0.09);
    --input-bg: rgba(3, 8, 18, 0.45);

    /* Ambient light behind the glass */
    --aurora-1: rgba(0, 247, 255, 0.17);
    --aurora-2: rgba(0, 255, 21, 0.1);
    --aurora-3: rgba(46, 94, 255, 0.22);

    /* Depth */
    --shadow-card: 0 22px 45px rgba(0, 0, 0, 0.38), 0 4px 14px rgba(0, 0, 0, 0.28);
    --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.3);
    --glow-cyan: 0 0 22px rgba(0, 247, 255, 0.26);
    --glow-cyan-soft: 0 0 14px rgba(0, 247, 255, 0.18);

    /* Danger */
    --danger: #ff5964;
    --danger-glass: rgba(255, 89, 100, 0.13);

    /* Shape & optics */
    --r-lg: 26px;
    --r-md: 18px;
    --r-sm: 12px;
    --r-pill: 999px;
    --blur: 20px;
    --blur-strong: 30px;
    --saturate: 1.5;
    --sidebar-width: 250px;
}

html[data-theme='light'] {
    color-scheme: light;

    --bg: #eef2f8;
    --text: #101b2e;
    --text-2: #54637d;

    --accent-text: #007a94;          /* 5:1+ on white glass (WCAG AA) */
    --accent-hover: #00566b;         /* clearly visible on hover */
    --check-accent: #0093a8;

    --glass: rgba(255, 255, 255, 0.58);
    --glass-strong: rgba(255, 255, 255, 0.74);
    --glass-raised: rgba(255, 255, 255, 0.5);
    --edge: rgba(255, 255, 255, 0.85);
    --edge-strong: rgba(105, 128, 165, 0.35);
    --sheen: rgba(255, 255, 255, 0.95);
    --input-bg: rgba(255, 255, 255, 0.55);

    --aurora-1: rgba(0, 196, 218, 0.2);
    --aurora-2: rgba(110, 232, 120, 0.16);
    --aurora-3: rgba(84, 132, 255, 0.14);

    --shadow-card: 0 18px 40px rgba(31, 51, 91, 0.14), 0 4px 12px rgba(31, 51, 91, 0.08);
    --shadow-soft: 0 10px 24px rgba(31, 51, 91, 0.1);
    --glow-cyan: 0 0 18px rgba(0, 170, 200, 0.22);
    --glow-cyan-soft: 0 0 12px rgba(0, 170, 200, 0.16);

    --danger: #d93847;
    --danger-glass: rgba(217, 56, 71, 0.1);

    --ring: rgba(0, 160, 190, 0.4);
    --ring-soft: rgba(0, 160, 190, 0.12);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;
    transition: color 0.3s ease;
}

/* Ambient light behind every glass surface (Liquid Glass needs a
   colourful backdrop to refract). Purely decorative. */

body::before {
    content: '';
    position: fixed;
    inset: -22%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(38% 42% at 12% 14%, var(--aurora-1), transparent 70%),
        radial-gradient(30% 36% at 88% 84%, var(--aurora-2), transparent 70%),
        radial-gradient(46% 52% at 76% 10%, var(--aurora-3), transparent 72%),
        radial-gradient(30% 34% at 30% 78%, var(--aurora-1), transparent 70%),
        linear-gradient(180deg, var(--bg), var(--bg));
    filter: saturate(1.25);
    animation: aurora-drift 44s ease-in-out infinite alternate;
}

/* Long holds keep the backdrop static most of the time: constant
   animation would force every backdrop-filter surface to re-blur
   several times a second, which costs real battery. */
@keyframes aurora-drift {
    0%,
    88% {
        transform: translate3d(-1.5%, -1%, 0) scale(1);
    }

    100% {
        transform: translate3d(2%, 1.5%, 0) scale(1.07);
    }
}

::selection {
    background: rgba(0, 247, 255, 0.28);
}

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}a {
    color: var(--accent-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -0.015em;
}

/* Scrollbars (WebKit) — quiet glass thumbs */

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

::-webkit-scrollbar-thumb {
    background: var(--edge-strong);
    border-radius: var(--r-pill);
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* ============================================================
   Shared glass recipe
   ============================================================ */

.panel,
.widget,
.auth-card,
.account-card,
.tag-box,
.mobile-topbar,
.page-header,
.app-footer {
    background: var(--glass);
    backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
    -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
    border: 1px solid var(--edge);
    box-shadow: inset 0 1px 0 var(--sheen), var(--shadow-card);
}

/* Browsers without backdrop-filter get denser glass so text
   contrast never depends on the blur. */

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root {
        --glass: rgba(10, 18, 32, 0.95);
        --glass-strong: rgba(10, 18, 32, 0.97);
        --input-bg: rgba(6, 12, 24, 0.85);
    }

    html[data-theme='light'] {
        --glass: rgba(255, 255, 255, 0.94);
        --glass-strong: rgba(255, 255, 255, 0.97);
        --input-bg: rgba(255, 255, 255, 0.9);
    }
}

/* ============================================================
   App shell: sidebar + content
   ============================================================ */

.app {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.page-title {
    font-size: 1.35rem;
}

.page-subtitle {
    color: var(--text-2);
    font-size: 0.875rem;
    margin: 2px 0 0;
}

.text-secondary {
    color: var(--text-2);
}

/* ============================================================
   App shell: sidebar + content
   ============================================================ */
.page-header {
    padding: 22px 24px;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--edge);
    box-shadow: inset 0 1px 0 var(--sheen);
}

.page-header .page-title {
    font-size: 1.15rem;
}

/* ============================================================
   Dashboard widget: recent tasks — floating glass card
   ============================================================ */

.widget {
    max-width: 460px;
    border-radius: var(--r-lg);
    overflow: hidden;
}

.widget-header {
    padding: 15px 18px;
    border-bottom: 1px solid var(--edge);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent);
}

.widget-header-link {
    display: block;
    color: var(--text);
}

.widget-title {
    font-size: 0.95rem;
    font-weight: 650;
}

.widget-header-link:hover .widget-title {
    color: var(--accent-text);
}

.widget-header-hint {
    color: var(--text-2);
    font-size: 0.72rem;
}

.widget-list {
    display: flex;
    flex-direction: column;
}

.widget-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid var(--edge);
    transition: background 0.2s ease;
}

.widget-row:first-child {
    border-top: none;
}

.widget-row:hover {
    background: var(--glass-raised);
}

.widget-link {
    display: grid;
    grid-template-columns: 40px minmax(0, 0.9fr) minmax(0, 1.4fr);
    gap: 10px;
    align-items: center;
    min-width: 0;
    min-height: 32px;
}

.widget-id {
    color: var(--text-2);
    font-size: 0.75rem;
}

.widget-link .widget-title {
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-link:hover .widget-title {
    color: var(--accent-text);
}

.widget-link .widget-desc {
    color: var(--text-2);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-row.is-done .widget-title,
.widget-row.is-done .widget-desc,
.widget-row.is-done .widget-id {
    color: var(--text-2);
    text-decoration: line-through;
}

/* Tick — idle glass ring, done = lit gradient pill */

.widget-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--edge-strong);
    background: var(--glass-raised);
    color: var(--text-2);
    cursor: pointer;
    padding: 0;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.widget-tick svg {
    width: 15px;
    height: 15px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.widget-tick:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    background: var(--ring-soft);
    box-shadow: var(--glow-cyan-soft);
}

.widget-tick.is-done {
    background-image: linear-gradient(135deg, rgba(0, 247, 255, 0.9), rgba(0, 255, 21, 0.75));
    border-color: transparent;
    color: #04121a;
    box-shadow: var(--glow-cyan-soft);
}

.widget-tick.is-done svg {
    opacity: 1;
}

.widget-empty {
    margin: 0;
    padding: 26px 18px;
    text-align: center;
    color: var(--text-2);
    font-size: 0.85rem;
}

/* ============================================================
   Sidebar — glass rail
   ============================================================ */

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
    -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));

    /* Pinned to the viewport: the page content scrolls, the sidebar
       never moves. Only when the nav outgrows the screen does the
       sidebar itself start scrolling. */
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.brand-mark {
    width: 27px;
    height: 27px;
    border-radius: 8px;
    background-image: var(--grad-accent);
    box-shadow: var(--glow-cyan-soft), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #04121a;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: var(--r-pill);
    color: var(--text-2);
    font-weight: 550;
    min-height: 44px;
    border: 1px solid transparent;
    transition:
        color 0.22s ease,
        background 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        transform 0.22s ease;
}

.nav-item:hover {
    color: var(--text);
    background: var(--glass-raised);
    border-color: var(--edge);
}

.nav-item.is-active {
    color: var(--accent-text);
    background: var(--ring-soft);
    border-color: rgba(0, 247, 255, 0.35);
    box-shadow: inset 0 1px 0 var(--sheen), var(--glow-cyan-soft);
}

html[data-theme='light'] .nav-item.is-active {
    border-color: rgba(0, 160, 190, 0.4);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Account card, pinned to the bottom of the sidebar */

.account-card {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 10px;
    border-radius: var(--r-md);
}

.account-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    color: var(--text);
    min-height: 44px;
    border-radius: 10px;
    transition: color 0.2s ease;
}

.account-link:hover {
    color: var(--accent-text);
}

.account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ring-soft);
    border: 1px solid rgba(0, 247, 255, 0.3);
    color: var(--accent-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-avatar svg {
    width: 18px;
    height: 18px;
}

.account-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-role {
    color: var(--text-2);
    font-size: 0.72rem;
}

.account-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--glass-raised);
    border-color: var(--edge);
}

/* The only destructive icon button is the logout one. */
.account-card .icon-btn:hover {
    color: var(--danger);
    background: var(--danger-glass);
    border-color: rgba(255, 89, 100, 0.35);
}

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

/* ============================================================
   Theme toggle — glass circle, icon follows the active theme
   (sun is offered while dark, moon while light)
   ============================================================ */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--edge-strong);
    background: var(--glass-raised);
    color: var(--text-2);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    box-shadow: inset 0 1px 0 var(--sheen), var(--shadow-soft);
    transition:
        color 0.22s ease,
        background 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        transform 0.22s ease;
}

.theme-toggle:hover {
    color: var(--cyan);
    border-color: rgba(0, 247, 255, 0.5);
    box-shadow: inset 0 1px 0 var(--sheen), var(--glow-cyan);
}

html[data-theme='light'] .theme-toggle:hover {
    color: var(--accent-text);
    border-color: rgba(0, 160, 190, 0.55);
}

.theme-toggle svg {
    width: 17px;
    height: 17px;
}

.theme-toggle .icon-moon {
    display: none;
}

html[data-theme='light'] .theme-toggle .icon-sun {
    display: none;
}

html[data-theme='light'] .theme-toggle .icon-moon {
    display: block;
}

.theme-toggle--float {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20;
}

/* ============================================================
   Mobile topbar + CSS-only sidebar toggle
   ============================================================ */

.sidebar-toggle {
    display: none;
}

.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 0;
    position: sticky;
    top: 0;
    z-index: 30;
}

.mobile-brand {
    font-weight: 700;
}

.sidebar-backdrop {
    display: none;
}

/* ============================================================
   Panels and cards
   ============================================================ */

.panel {
    border-radius: var(--r-lg);
    padding: 22px;
}

.panel + .panel {
    margin-top: 22px;
}

.panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-title {
    font-size: 1rem;
}

.panel-hint {
    color: var(--text-2);
    font-size: 0.8rem;
}

/* ============================================================
   Forms
   ============================================================ */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
}

.input {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: var(--input-bg);
    border: 1px solid var(--edge);
    border-radius: var(--r-sm);
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    box-shadow: inset 0 1px 0 var(--sheen);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input::placeholder {
    color: var(--text-2);
    opacity: 0.7;
}

.input:focus {
    outline: none;
    border-color: rgba(0, 247, 255, 0.6);
    box-shadow: 0 0 0 3px var(--ring-soft), var(--glow-cyan-soft);
}

html[data-theme='light'] .input:focus {
    border-color: rgba(0, 160, 190, 0.6);
}

.input[readonly] {
    color: var(--text-2);
    background: var(--glass-raised);
    box-shadow: none;
}

.input.is-invalid {
    border-color: rgba(255, 89, 100, 0.65);
}

.input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(255, 89, 100, 0.15), 0 0 12px rgba(255, 89, 100, 0.18);
}

.field-error {
    color: var(--danger);
    font-size: 0.78rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.link-quiet {
    color: var(--text-2);
    font-size: 0.85rem;
}

.link-quiet:hover {
    color: var(--text);
}

/* Tag picker pills (label + hidden checkbox) */

.tag-box {
    border-radius: var(--r-md);
    padding: 14px;
    margin-top: 14px;
}

.tag-box-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 5px 15px;
    border: 1px solid var(--edge);
    border-radius: var(--r-pill);
    background: var(--glass-raised);
    color: var(--text-2);
    font-size: 0.82rem;
    cursor: pointer;
    user-select: none;
    box-shadow: inset 0 1px 0 var(--sheen);
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.pill:hover {
    border-color: var(--edge-strong);
    color: var(--text);
    transform: translateY(-1px);
}

.pill-input:checked + .pill {
    background: var(--ring-soft);
    border-color: rgba(0, 247, 255, 0.45);
    color: var(--accent-text);
    font-weight: 600;
    box-shadow: inset 0 1px 0 var(--sheen), var(--glow-cyan-soft);
}

html[data-theme='light'] .pill-input:checked + .pill {
    border-color: rgba(0, 160, 190, 0.5);
}

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

input[type='checkbox'] {
    accent-color: var(--check-accent);
    width: 16px;
    height: 16px;
}

.check-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    color: var(--text-2);
    font-size: 0.85rem;
    cursor: pointer;
    min-height: 44px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-title {
    font-size: 1.1rem;
}

.auth-subtitle {
    color: var(--text-2);
    font-size: 0.85rem;
    margin: 2px 0 0;
}

/* ============================================================
   Buttons — pill glass; accent = the cyan→green identity gradient
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 22px;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.btn-accent {
    background-image: var(--grad-accent);
    color: #04121a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 8px 22px rgba(0, 205, 190, 0.3);
}

.btn-accent:hover {
    transform: translateY(-1px);
    filter: brightness(1.07);
    color: #04121a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 26px rgba(0, 230, 210, 0.42);
}

.btn-accent:active {
    transform: translateY(0) scale(0.98);
}

.btn-danger-outline {
    background: transparent;
    border-color: var(--edge);
    color: var(--text-2);
    min-height: 36px;
    padding: 5px 15px;
    font-size: 0.8rem;
    border-radius: var(--r-pill);
}

.btn-danger-outline:hover {
    border-color: rgba(255, 89, 100, 0.55);
    color: var(--danger);
    background: var(--danger-glass);
}

/* ============================================================
   Task list — glass rows inside the panel
   ============================================================ */

.task-list {
    padding: 0;
}

.task-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.9fr) auto auto auto;
    gap: 14px;
    align-items: center;
    padding: 14px 20px;
    border-top: 1px solid var(--edge);
    transition: background 0.2s ease;
}

.task-row:hover {
    background: var(--glass-raised);
}

.task-row.is-done .task-title,
.task-row.is-done .task-desc {
    color: var(--text-2);
    text-decoration: line-through;
}

.task-title {
    color: var(--text);
    font-weight: 600;
    font-size: 0.92rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-title:hover {
    color: var(--accent-text);
}

.task-id {
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 400;
    margin-right: 6px;
}

.task-desc {
    margin: 0;
    color: var(--text-2);
    font-size: 0.88rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.task-actions {
    display: flex;
    justify-content: flex-end;
}

/* Tag chips shown on tasks */

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 11px;
    border: 1px solid var(--edge);
    border-radius: var(--r-pill);
    background: var(--glass-raised);
    color: var(--text-2);
    font-size: 0.72rem;
    box-shadow: inset 0 1px 0 var(--sheen);
}

/* Status badges */

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 12px;
    border-radius: var(--r-pill);
    font-size: 0.74rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-pending {
    background: var(--ring-soft);
    border-color: rgba(0, 247, 255, 0.3);
    color: var(--accent-text);
}

html[data-theme='light'] .badge-pending {
    border-color: rgba(0, 160, 190, 0.35);
}

.badge-done {
    background: rgba(0, 255, 21, 0.08);
    border-color: rgba(0, 255, 21, 0.25);
    color: var(--text-2);
}

html[data-theme='light'] .badge-done {
    background: rgba(20, 170, 40, 0.08);
    border-color: rgba(20, 160, 40, 0.3);
    color: var(--text-2);
}

.task-empty {
    text-align: center;
    color: var(--text-2);
    padding: 40px 20px;
    margin: 0;
}

/* ============================================================
   Profile
   ============================================================ */

.profile-form {
    margin-top: 26px;
}

/* ============================================================
   Flash messages
   ============================================================ */

.alert {
    display: block;
    padding: 11px 15px;
    border-radius: var(--r-md);
    border: 1px solid rgba(0, 247, 255, 0.35);
    background: linear-gradient(120deg, rgba(0, 247, 255, 0.12), rgba(0, 255, 21, 0.08));
    color: var(--accent-text);
    font-size: 0.85rem;
    margin-bottom: 16px;
    backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
    -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
}

html[data-theme='light'] .alert {
    border-color: rgba(0, 160, 190, 0.4);
    background: linear-gradient(120deg, rgba(0, 196, 218, 0.12), rgba(110, 232, 120, 0.1));
    color: #006480;
}

/* ============================================================
   Guest (auth) pages — one big glass card over the aurora
   ============================================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    border-radius: 30px;
    padding: 30px 28px;
    backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
    -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
    box-shadow: inset 0 1px 0 var(--sheen), var(--shadow-card), var(--glow-cyan-soft);
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.auth-switch {
    text-align: center;
    color: var(--text-2);
    font-size: 0.85rem;
    margin-top: 20px;
}

/* ============================================================
   404
   ============================================================ */

.notfound {
    text-align: center;
    padding: 60px 44px;
    border-radius: 30px;
    width: min(480px, 100%);
    background: var(--glass);
    backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
    -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
    border: 1px solid var(--edge);
    box-shadow: inset 0 1px 0 var(--sheen), var(--shadow-card), var(--glow-cyan-soft);
}

.notfound-code {
    font-size: 4rem;
    font-weight: 750;
    margin: 0;
    background-image: var(--grad-accent);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.notfound .auth-title {
    margin-bottom: 4px;
}

/* ============================================================
   Footer
   ============================================================ */

.app-footer {
    text-align: center;
    color: var(--text-2);
    font-size: 0.78rem;
    padding: 20px;
    margin: 26px 24px 0;
    border-radius: var(--r-pill);
    border-top: none;
    border-left: none;
    border-right: none;
}

.app-footer .dot {
    color: var(--accent-text);
}

/* ============================================================
   Responsive — same layout mechanics, glass visuals
   ============================================================ */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 214px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        width: min(280px, 84vw);
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
        background: var(--glass-strong);
    }

    .sidebar-toggle:checked ~ .app .sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-card), var(--glow-cyan-soft);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(2, 6, 15, 0.55);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    html[data-theme='light'] .sidebar-backdrop {
        background: rgba(140, 165, 200, 0.35);
    }

    .sidebar-toggle:checked ~ .app .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .content {
        padding: 18px 14px;
    }

    .panel {
        padding: 16px;
        border-radius: var(--r-md);
    }

    /* Task rows become stacked cards */
    .task-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            'title status'
            'desc desc'
            'tags actions';
        gap: 10px;
        padding: 14px 16px;
        border-radius: var(--r-md);
    }

    .task-title {
        grid-area: title;
        white-space: normal;
    }

    .task-desc {
        grid-area: desc;
        white-space: normal;
    }

    .task-tags {
        grid-area: tags;
        justify-content: flex-start;
    }

    .task-row .badge {
        grid-area: status;
    }

    .task-actions {
        grid-area: actions;
    }
}

/* ============================================================
   Pagination — glass pills
   ============================================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--edge);
}

.page-position {
    font-size: 13px;
    color: var(--text-2);
}

.page-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-link {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid var(--edge);
    border-radius: var(--r-pill);
    background: var(--glass-raised);
    color: var(--text);
    font-size: 13px;
    box-shadow: inset 0 1px 0 var(--sheen);
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.page-link:hover {
    border-color: rgba(0, 247, 255, 0.5);
    color: var(--accent-text);
    box-shadow: var(--glow-cyan-soft);
}

.page-state {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--r-pill);
    font-size: 13px;
    color: var(--text-2);
    opacity: 0.55;
}

/* ============================================================
   Motion preferences — everything still works, nothing moves
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================================
   Focus board + companion chat (Apple Liquid Glass)
   ============================================================ */

.focus-card {
    border-radius: var(--r-lg);
    padding: 26px;
}

.focus-head {
    font-size: 1.2rem;
}

.focus-sub {
    color: var(--text-2);
    font-size: 0.9rem;
    margin: 4px 0 0;
}

.focus-timer {
    display: flex;
    justify-content: center;
    padding: 18px 0 8px;
}

.focus-countdown {
    font-size: 3.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background-image: var(--grad-accent);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
}

.focus-stopbox {
    border: 1px solid var(--danger-glass);
    background: var(--danger-glass);
    border-radius: var(--r-md);
    padding: 14px 16px;
    margin-top: 12px;
}

.focus-stopbox .focus-sub {
    color: var(--text);
    margin: 0 0 10px;
}

.btn-quiet-glass {
    background: var(--glass-raised);
    border: 1px solid var(--edge);
    color: var(--text);
    box-shadow: inset 0 1px 0 var(--sheen);
}

.btn-quiet-glass:hover {
    border-color: var(--edge-strong);
    transform: translateY(-1px);
}

.btn-danger-solid {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 8px 20px rgba(229, 72, 77, 0.3);
}

.btn-danger-solid:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* Chat panel */

.chat-panel {
    margin-top: 18px;
    border: 1px solid var(--edge);
    border-radius: var(--r-md);
    background: var(--input-bg);
    padding: 14px;
}

.chat-msgs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 13px;
    border: 1px solid var(--edge);
    border-radius: var(--r-md);
    background: var(--glass-raised);
    box-shadow: inset 0 1px 0 var(--sheen);
    max-width: 88%;
}

.chat-msg-user {
    align-self: flex-end;
    border-color: rgba(0, 247, 255, 0.3);
    background: var(--ring-soft);
}

html[data-theme='light'] .chat-msg-user {
    border-color: rgba(0, 160, 190, 0.35);
}

.chat-msg-ai {
    align-self: flex-start;
}

.chat-role {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
}

.chat-text {
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-empty-msg,
.chat-thinking {
    color: var(--text-2);
    font-size: 0.85rem;
    border: 1px dashed var(--edge-strong);
    background: transparent;
    box-shadow: none;
}

.chat-thinking {
    animation: none;
}

.chat-input-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.chat-input-row .input {
    flex: 1;
}

.chat-closed {
    color: var(--text-2);
    font-size: 0.82rem;
    margin: 0;
    text-align: center;
}

.chat-notice {
    margin-top: 10px;
    padding: 9px 13px;
    border-radius: var(--r-sm);
    border: 1px solid var(--edge-strong);
    background: var(--glass-raised);
    color: var(--text-2);
    font-size: 0.82rem;
}

@media (max-width: 767px) {
    .chat-msg {
        max-width: 100%;
    }

    .focus-countdown {
        font-size: 2.6rem;
    }
}

/* ============================================================
   Focus board — full-page immersive layout
   ============================================================ */

.content:has(.focus-board) {
    max-width: none;
}

.focus-board {
    display: flex;
    flex-direction: column;
    gap: 26px;
    width: 100%;
}

.focus-board .focus-card {
    border-radius: 34px;
    padding: 46px 52px;
}

.focus-hero {
    text-align: center;
    padding-top: 64px;
    padding-bottom: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.focus-hero .focus-head,
.focus-card .focus-head {
    font-size: 2.1rem;
}

.focus-hero .focus-sub {
    font-size: 1.02rem;
}

.focus-timer {
    padding: 26px 0 10px;
}

.focus-countdown {
    font-size: clamp(4.2rem, 11vw, 8.5rem);
    line-height: 1.05;
}

.focus-stopbox {
    margin-top: 22px;
    padding: 20px 24px;
    text-align: center;
}

.btn-lg {
    min-height: 56px;
    padding: 15px 36px;
    font-size: 1rem;
}

/* Bigger companion chat on the focus page */

.focus-chat-card {
    padding: 34px 40px;
}

.focus-chat-card .chat-msgs {
    max-height: 480px;
    gap: 14px;
}

.chat-msg {
    padding: 12px 17px;
    border-radius: 20px;
}

.chat-msg-user {
    border-radius: 20px 20px 6px 20px;
}

.chat-msg-ai {
    border-radius: 20px 20px 20px 6px;
}

.chat-text {
    font-size: 0.96rem;
}

.chat-panel {
    margin-top: 16px;
    padding: 18px;
}

.chat-input-row .input {
    min-height: 50px;
}

@media (max-width: 767px) {
    .focus-board .focus-card,
    .focus-chat-card {
        padding: 26px 20px;
        border-radius: var(--r-lg);
    }

    .focus-hero {
        padding-top: 34px;
        padding-bottom: 34px;
    }

    .focus-hero .focus-head,
    .focus-card .focus-head {
        font-size: 1.55rem;
    }

    .chat-panel {
        padding: 12px;
    }
}
