/* ==========================================================================
   TaskDesk — application styles
   Light/dark themes, responsive dashboard, cards, modals and auth screens.
   ========================================================================== */

:root {
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --bg: #f5f7fb;
    --bg-soft: #eef2f8;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --border: #e4e9f2;
    --border-strong: #d3dbe8;
    --text: #0f172a;
    --text-soft: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;

    --primary: #2563eb;
    --primary-2: #1d4ed8;
    --primary-soft: #eef4ff;
    --primary-ink: #1e40af;

    --yellow: #f0a800;
    --yellow-soft: #fef3c7;
    --yellow-ink: #92400e;
    --blue: #2563eb;
    --blue-soft: #dbeafe;
    --blue-ink: #1e40af;
    --green: #16a34a;
    --green-soft: #dcfce7;
    --green-ink: #166534;
    --red: #dc2626;
    --red-soft: #fee2e2;
    --red-ink: #991b1b;
    --purple: #7c3aed;
    --purple-soft: #ede9fe;
    --purple-ink: #5b21b6;
    --teal: #0d9488;
    --teal-soft: #ccfbf1;
    --teal-ink: #115e59;
    --sky: #0284c7;
    --sky-soft: #e0f2fe;
    --sky-ink: #075985;

    --sidebar: #0b1220;
    --sidebar-2: #101a2d;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-border: rgba(255, 255, 255, 0.08);

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 14px 34px -18px rgba(15, 23, 42, 0.25);
    --shadow-lg: 0 40px 80px -30px rgba(15, 23, 42, 0.4);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 20px;
    --sidebar-width: 264px;
    --topbar-height: 76px;
}

[data-theme="dark"] {
    --bg: #080e1a;
    --bg-soft: #0b1424;
    --surface: #0f1a2e;
    --surface-2: #0c1626;
    --surface-3: #152238;
    --border: #1d2b44;
    --border-strong: #2a3a58;
    --text: #e8eef9;
    --text-soft: #c3d0e4;
    --muted: #8da0bd;
    --muted-2: #6b7f9f;

    --primary: #60a5fa;
    --primary-2: #3b82f6;
    --primary-soft: rgba(37, 99, 235, 0.18);
    --primary-ink: #bfdbfe;

    --yellow: #fbbf24;
    --yellow-soft: rgba(245, 158, 11, 0.16);
    --yellow-ink: #fcd34d;
    --blue: #60a5fa;
    --blue-soft: rgba(37, 99, 235, 0.2);
    --blue-ink: #bfdbfe;
    --green: #4ade80;
    --green-soft: rgba(22, 163, 74, 0.18);
    --green-ink: #86efac;
    --red: #f87171;
    --red-soft: rgba(220, 38, 38, 0.18);
    --red-ink: #fca5a5;
    --purple: #a78bfa;
    --purple-soft: rgba(124, 58, 237, 0.2);
    --purple-ink: #ddd6fe;
    --teal: #2dd4bf;
    --teal-soft: rgba(13, 148, 136, 0.2);
    --teal-ink: #99f6e4;
    --sky: #38bdf8;
    --sky-soft: rgba(2, 132, 199, 0.2);
    --sky-ink: #bae6fd;

    --sidebar: #060c17;
    --sidebar-2: #0a1424;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 16px 40px -20px rgba(0, 0, 0, 0.65);
    --shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, 0.8);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, figure {
    margin: 0;
}

ul, ol {
    padding: 0;
    list-style: none;
}

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

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

img, svg {
    display: block;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

::selection {
    background: var(--primary);
    color: #fff;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: 16px;
    z-index: 999;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.skip-link:focus {
    top: 16px;
}

.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

/* Status + priority tokens */
.status-not_started {
    --status: var(--yellow);
    --status-soft: var(--yellow-soft);
    --status-ink: var(--yellow-ink);
}

.status-in_progress {
    --status: var(--blue);
    --status-soft: var(--blue-soft);
    --status-ink: var(--blue-ink);
}

.status-completed {
    --status: var(--green);
    --status-soft: var(--green-soft);
    --status-ink: var(--green-ink);
}

.status-late {
    --status: var(--red);
    --status-soft: var(--red-soft);
    --status-ink: var(--red-ink);
}

.priority-low { --priority: var(--muted-2); }
.priority-medium { --priority: var(--sky); }
.priority-high { --priority: #ea580c; }
.priority-urgent { --priority: var(--red); }

[data-theme="dark"] .priority-high { --priority: #fb923c; }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

.app-shell {
    min-height: 100vh;
}

.app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 16px 18px;
    color: var(--sidebar-text);
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(37, 99, 235, 0.18), transparent 60%),
        linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 2px 8px 4px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: inherit;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    box-shadow: 0 10px 24px -10px rgba(37, 99, 235, 0.9);
}

.brand-mark .icon {
    width: 21px;
    height: 21px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-size: 1.06rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: #fff;
}

.brand-sub {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sidebar-text);
}

.sidebar-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-weight: 650;
    font-size: 0.9rem;
    box-shadow: 0 14px 26px -16px rgba(37, 99, 235, 0.95);
    transition: transform 0.16s ease, filter 0.16s ease;
}

.sidebar-cta:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

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

.nav-label {
    padding: 0 12px;
    margin-bottom: 6px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 11px;
    color: var(--sidebar-text);
    font-size: 0.91rem;
    font-weight: 550;
    border: 1px solid transparent;
    transition: background 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-active);
}

.nav-item.is-active {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.25);
    color: #fff;
}

.nav-icon {
    display: grid;
    place-items: center;
    color: #7c8db0;
}

.nav-item.is-active .nav-icon {
    color: #93c5fd;
}

.nav-text {
    flex: 1;
}

.nav-count {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
}

.nav-item.is-active .nav-count {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 12px;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.25;
}

.sidebar-user-info strong {
    font-size: 0.85rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info span {
    font-size: 0.72rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-note {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    font-size: 0.68rem;
    color: #5c6f8f;
}

.sidebar-note .icon {
    width: 12px;
    height: 12px;
}

.sidebar-overlay {
    display: none;
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: var(--topbar-height);
    padding: 12px clamp(18px, 3vw, 32px);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    min-width: 0;
}

.topbar-title h1 {
    font-size: 1.18rem;
    font-weight: 720;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.topbar-title p {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 400px;
    margin-left: auto;
}

.topbar-search .search-icon {
    position: absolute;
    left: 12px;
    color: var(--muted-2);
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 38px 0 38px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.87rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.topbar-search input::placeholder {
    color: var(--muted-2);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.search-clear {
    position: absolute;
    right: 8px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
}

.search-clear:hover {
    background: var(--surface-3);
}

.search-clear .icon {
    width: 14px;
    height: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--primary), var(--primary-2));
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.menu-btn {
    display: none !important;
}

.theme-toggle {
    position: relative;
}

.theme-icon {
    display: grid;
    place-items: center;
}

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

[data-theme="dark"] .theme-icon-sun {
    display: none;
}

[data-theme="dark"] .theme-icon-moon {
    display: grid;
}

/* --------------------------------------------------------------------------
   Content, page head, buttons
   -------------------------------------------------------------------------- */

.content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: clamp(18px, 3vw, 32px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.page-head h2 {
    font-size: clamp(1.45rem, 2.4vw, 1.85rem);
    font-weight: 760;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-top: 4px;
}

.page-head p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.9rem;
    max-width: 64ch;
}

.eyebrow {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary);
}

.eyebrow-light {
    color: #93c5fd;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 15px;
    border-radius: 11px;
    border: 1px solid transparent;
    font-size: 0.87rem;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.btn .icon {
    width: 16px;
    height: 16px;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(145deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 12px 24px -16px color-mix(in srgb, var(--primary) 90%, transparent);
}

.btn-primary:hover {
    filter: brightness(1.06);
    box-shadow: 0 16px 28px -16px color-mix(in srgb, var(--primary) 95%, transparent);
}

[data-theme="dark"] .btn-primary {
    color: #07101f;
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-soft);
}

.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.btn-danger-ghost {
    background: transparent;
    border-color: color-mix(in srgb, var(--red) 35%, transparent);
    color: var(--red);
}

.btn-danger-ghost:hover {
    background: var(--red-soft);
}

.btn-sm {
    padding: 7px 11px;
    font-size: 0.79rem;
    border-radius: 9px;
}

.btn-lg {
    padding: 13px 18px;
    font-size: 0.94rem;
}

.btn-block {
    width: 100%;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.icon-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}

.icon-btn .icon {
    width: 17px;
    height: 17px;
}

.icon-btn-dark {
    color: #7c8db0;
}

.icon-btn-dark:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.card-actions {
    display: flex;
    align-items: flex-start;
    gap: 2px;
    flex-shrink: 0;
}

.card-actions form {
    margin: 0;
}

.link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--primary);
    white-space: nowrap;
}

.link .icon {
    width: 14px;
    height: 14px;
    transition: transform 0.16s ease;
}

.link:hover .icon {
    transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: 14px;
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: var(--accent);
    opacity: 0.85;
}

.stat-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    flex-shrink: 0;
}

.stat-icon .icon {
    width: 20px;
    height: 20px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 760;
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.stat-note {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.stat-blue { --accent: var(--blue); --accent-soft: var(--blue-soft); }
.stat-sky { --accent: var(--sky); --accent-soft: var(--sky-soft); }
.stat-green { --accent: var(--green); --accent-soft: var(--green-soft); }
.stat-red { --accent: var(--red); --accent-soft: var(--red-soft); }
.stat-purple { --accent: var(--purple); --accent-soft: var(--purple-soft); }
.stat-teal { --accent: var(--teal); --accent-soft: var(--teal-soft); }
.stat-yellow { --accent: var(--yellow); --accent-soft: var(--yellow-soft); }

/* --------------------------------------------------------------------------
   Panels, overview
   -------------------------------------------------------------------------- */

.panel {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.panel-head h3 {
    font-size: 1.02rem;
    font-weight: 720;
    letter-spacing: -0.02em;
}

.panel-head p {
    margin-top: 3px;
    font-size: 0.8rem;
    color: var(--muted);
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.panel-empty {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 18px;
    border: 1px dashed var(--border-strong);
    border-radius: 14px;
    background: var(--surface-2);
}

.panel-empty-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--green-soft);
    color: var(--green);
    flex-shrink: 0;
}

.panel-empty > div {
    flex: 1;
    min-width: 180px;
}

.panel-empty strong {
    display: block;
    font-size: 0.9rem;
}

.panel-empty p {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--muted);
}

.mini-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-task,
.mini-schedule {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    color: inherit;
    transition: background 0.14s ease, border-color 0.14s ease;
}

.mini-task:hover,
.mini-schedule:hover {
    background: var(--surface-2);
    border-color: var(--border);
}

.mini-bar {
    width: 4px;
    align-self: stretch;
    min-height: 38px;
    border-radius: 999px;
    background: var(--status, var(--muted-2));
    flex-shrink: 0;
}

.mini-main {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.mini-title {
    font-size: 0.87rem;
    font-weight: 620;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-meta {
    font-size: 0.74rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-task .badge {
    flex-shrink: 0;
}

.mini-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 46px;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary);
    flex-shrink: 0;
    line-height: 1;
}

.mini-month {
    font-size: 0.6rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mini-day {
    font-size: 1.1rem;
    font-weight: 750;
    margin-top: 1px;
}

.mini-schedule.is-appointment .mini-date {
    background: var(--teal-soft);
    color: var(--teal);
}

.mini-type {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    flex-shrink: 0;
}

.mini-type .icon {
    width: 15px;
    height: 15px;
}

.type-event {
    background: var(--purple-soft);
    color: var(--purple-ink);
}

.type-appointment {
    background: var(--teal-soft);
    color: var(--teal-ink);
}

.type-task {
    background: var(--blue-soft);
    color: var(--blue-ink);
}

[data-theme="dark"] .type-event,
[data-theme="dark"] .type-appointment,
[data-theme="dark"] .type-task {
    color: var(--text-soft);
}

.status-stack {
    display: flex;
    height: 13px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface-3);
    margin: 4px 0 16px;
}

.status-segment {
    height: 100%;
    background: var(--status);
    transition: width 0.4s ease;
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 550;
}

.legend-item:hover {
    color: var(--text);
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--status);
    flex-shrink: 0;
}

.legend-label {
    color: inherit;
}

.legend-count {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Badges, avatars, meta
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.35;
    white-space: nowrap;
}

.badge .icon {
    width: 12px;
    height: 12px;
}

.badge-status {
    background: var(--status-soft);
    color: var(--status-ink);
}

.badge-priority {
    background: var(--surface-3);
    color: var(--muted);
}

.priority-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--priority);
}

.badge-soft {
    background: var(--surface-3);
    color: var(--muted);
}

.badge-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.avatar {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(145deg, #60a5fa, #2563eb);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    text-transform: uppercase;
}

.avatar-sm {
    width: 23px;
    height: 23px;
    border-radius: 7px;
    font-size: 0.58rem;
}

.avatar-light {
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
}

.meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.meta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.77rem;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}

.meta .icon {
    width: 14px;
    height: 14px;
    color: var(--muted-2);
}

.meta .avatar {
    margin-right: 1px;
}

.tone-ok { color: var(--green) !important; }
.tone-warn { color: #b45309 !important; }
.tone-danger { color: var(--red) !important; font-weight: 650; }
.tone-muted { color: var(--muted) !important; }

[data-theme="dark"] .tone-warn {
    color: #fbbf24 !important;
}

.updated {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.71rem;
    color: var(--muted-2);
    white-space: nowrap;
}

.updated .icon {
    width: 12px;
    height: 12px;
}

/* --------------------------------------------------------------------------
   Chips, toolbar, inputs
   -------------------------------------------------------------------------- */

.chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.chip:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.chip.is-active {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--status, var(--muted-2));
    flex-shrink: 0;
}

.chip-count {
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 700;
}

.chip.is-active .chip-count {
    background: color-mix(in srgb, var(--bg) 20%, transparent);
    color: inherit;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.result-count {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.search-inline {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 190px;
    max-width: 330px;
}

.search-inline .search-icon {
    position: absolute;
    left: 11px;
    color: var(--muted-2);
    pointer-events: none;
}

.search-inline .input {
    padding-left: 35px;
    height: 38px;
    font-size: 0.84rem;
}

.input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.87rem;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.input::placeholder {
    color: var(--muted-2);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    cursor: pointer;
}

.select-auto {
    width: auto;
    min-width: 130px;
    height: 38px;
    font-size: 0.8rem;
    font-weight: 550;
}

.select-sm {
    width: auto;
    min-width: 132px;
    height: 32px;
    padding: 4px 30px 4px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 8px;
    background-position: right 9px center;
}

/* --------------------------------------------------------------------------
   Task cards
   -------------------------------------------------------------------------- */

.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 15px;
    align-items: start;
}

.task-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-left: 6px solid var(--status, var(--border-strong));
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.task-body {
    padding: 17px 18px 14px;
}

.task-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    justify-content: space-between;
}

.task-heading {
    min-width: 0;
    flex: 1;
}

.task-title {
    margin-top: 8px;
    font-size: 1.03rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.task-desc {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.55;
    max-height: 4.7em;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.task-body .meta-row {
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.task-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    flex-wrap: wrap;
}

.status-quick {
    display: flex;
    align-items: center;
    gap: 7px;
}

.status-quick select {
    background-color: var(--surface);
}

/* --------------------------------------------------------------------------
   Schedule cards (events + appointments)
   -------------------------------------------------------------------------- */

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 15px;
    align-items: start;
}

.schedule-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.schedule-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.schedule-card.is-past {
    opacity: 0.72;
}

.schedule-card.is-past:hover {
    opacity: 1;
}

.date-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 72px;
    min-height: 84px;
    border-radius: 14px;
    flex-shrink: 0;
    line-height: 1.05;
    background: linear-gradient(160deg, var(--purple-soft), color-mix(in srgb, var(--purple-soft) 55%, var(--surface)));
    color: var(--purple-ink);
    border: 1px solid color-mix(in srgb, var(--purple) 16%, transparent);
}

.schedule-card.is-appointment .date-tile {
    background: linear-gradient(160deg, var(--teal-soft), color-mix(in srgb, var(--teal-soft) 55%, var(--surface)));
    color: var(--teal-ink);
    border-color: color-mix(in srgb, var(--teal) 16%, transparent);
}

.date-month {
    font-size: 0.64rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.date-day {
    font-size: 1.65rem;
    font-weight: 780;
    letter-spacing: -0.03em;
    margin: 2px 0;
}

.date-week {
    font-size: 0.63rem;
    font-weight: 650;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.schedule-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.schedule-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.schedule-head h3 {
    margin-top: 6px;
    font-size: 1.03rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.schedule-head .meta-row {
    margin-top: 7px;
}

.schedule-desc {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.55;
    max-height: 3.1em;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.schedule-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 9px;
    border-top: 1px dashed var(--border);
}

.schedule-foot .badge .icon {
    width: 12px;
    height: 12px;
}

/* --------------------------------------------------------------------------
   Archive
   -------------------------------------------------------------------------- */

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.archive-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 15px 17px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.archive-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.archive-type .icon {
    width: 13px;
    height: 13px;
}

.archive-main {
    flex: 1;
    min-width: 200px;
}

.archive-main h3 {
    font-size: 0.94rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.archive-main p {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.archive-main .meta-row {
    margin-top: 6px;
}

.archive-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.archive-actions form {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: clamp(36px, 7vw, 64px) 24px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.empty-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    background: var(--primary-soft);
    color: var(--primary);
    margin-bottom: 16px;
}

.empty-icon .icon {
    width: 27px;
    height: 27px;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 720;
    letter-spacing: -0.02em;
}

.empty-state p {
    margin-top: 6px;
    max-width: 52ch;
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.6;
}

.empty-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 18px;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toast-stack {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 220;
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    --tone: var(--primary);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--tone);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toast-in 0.22s ease both;
}

.toast-success { --tone: var(--green); }
.toast-error { --tone: var(--red); }
.toast-warning { --tone: var(--yellow); }
.toast-info { --tone: var(--primary); }

.toast-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--tone) 15%, transparent);
    color: var(--tone);
    flex-shrink: 0;
}

.toast-icon .icon {
    width: 15px;
    height: 15px;
}

.toast p {
    flex: 1;
    font-size: 0.83rem;
    line-height: 1.45;
    color: var(--text-soft);
    padding-top: 2px;
}

.toast-close {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted-2);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--surface-3);
    color: var(--text);
}

.toast-close .icon {
    width: 13px;
    height: 13px;
}

.toast-out {
    animation: toast-out 0.22s ease both;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(-8px) scale(0.98); }
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 18px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fade-in 0.18s ease both;
}

.modal-card {
    position: relative;
    width: min(620px, 100%);
    max-height: min(90vh, 820px);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.2s ease both;
}

.modal-card form {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 750;
    letter-spacing: -0.025em;
}

.modal-header p {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--muted);
    max-width: 52ch;
}

.modal-body {
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    position: sticky;
    bottom: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

body.modal-open {
    overflow: hidden;
}

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

.field label {
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.field .input {
    background: var(--surface);
}

.field textarea.input {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
}

.req {
    color: var(--red);
    font-weight: 700;
}

.optional {
    color: var(--muted-2);
    font-size: 0.7rem;
    font-weight: 500;
}

.field-hint {
    font-size: 0.72rem;
    color: var(--muted);
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Auth screens
   -------------------------------------------------------------------------- */

.auth-body {
    background: var(--bg);
    min-height: 100vh;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    min-height: 100vh;
}

.auth-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 34px;
    padding: clamp(28px, 4vw, 52px);
    color: #e2e8f0;
    overflow: hidden;
    background:
        radial-gradient(80% 60% at 100% 0%, rgba(37, 99, 235, 0.35), transparent 60%),
        radial-gradient(70% 50% at 0% 100%, rgba(13, 148, 136, 0.22), transparent 60%),
        linear-gradient(150deg, #0b1220 0%, #0d1a33 55%, #0b1220 100%);
}

.auth-hero::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -160px;
    top: -140px;
    border-radius: 50%;
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow: 0 0 0 40px rgba(96, 165, 250, 0.04), 0 0 0 90px rgba(96, 165, 250, 0.03);
    pointer-events: none;
}

.auth-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.brand-light .brand-name {
    color: #fff;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.4);
    color: #cbd5e1;
    font-size: 0.68rem;
    font-weight: 650;
    white-space: nowrap;
}

.hero-pill .icon {
    width: 12px;
    height: 12px;
    color: #86efac;
}

.auth-hero-copy {
    position: relative;
    z-index: 1;
    max-width: 560px;
}

.auth-hero-copy h1 {
    margin-top: 12px;
    font-size: clamp(2rem, 3.6vw, 3.05rem);
    font-weight: 780;
    letter-spacing: -0.045em;
    line-height: 1.05;
    color: #fff;
}

.auth-hero-copy > p {
    margin-top: 14px;
    font-size: 0.98rem;
    line-height: 1.65;
    color: #a9b9d2;
    max-width: 50ch;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 28px;
}

.auth-features li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.feature-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(59, 130, 246, 0.16);
    border: 1px solid rgba(96, 165, 250, 0.24);
    color: #93c5fd;
    flex-shrink: 0;
}

.feature-icon .icon {
    width: 18px;
    height: 18px;
}

.auth-features strong {
    display: block;
    font-size: 0.88rem;
    color: #e8eef9;
    font-weight: 650;
}

.auth-features span {
    display: block;
    margin-top: 2px;
    font-size: 0.79rem;
    color: #8296b5;
    line-height: 1.5;
}

.auth-preview {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    max-width: 520px;
}

.preview-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-left: 4px solid var(--preview);
    border-radius: 11px;
    background: rgba(15, 26, 46, 0.72);
    backdrop-filter: blur(6px);
}

.preview-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--preview);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--preview) 22%, transparent);
}

.preview-card strong {
    display: block;
    font-size: 0.76rem;
    font-weight: 620;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-card span:last-child {
    display: block;
    margin-top: 1px;
    font-size: 0.66rem;
    color: #7c8db0;
}

.preview-card-yellow { --preview: #fbbf24; }
.preview-card-blue { --preview: #60a5fa; }
.preview-card-green { --preview: #4ade80; }
.preview-card-red { --preview: #f87171; }

.auth-copyright {
    position: relative;
    z-index: 1;
    font-size: 0.7rem;
    color: #5f7190;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: clamp(24px, 4vw, 48px);
    background:
        radial-gradient(70% 50% at 100% 100%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 70%),
        var(--bg);
    position: relative;
}

.auth-panel-brand {
    display: none;
}

.auth-panel-brand .brand-name {
    color: var(--text);
}

.auth-panel-brand .brand-sub {
    color: var(--muted);
}

.auth-panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(430px, 100%);
}

.auth-panel-label {
    font-size: 0.66rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted);
}

.auth-card {
    width: min(430px, 100%);
    padding: clamp(22px, 3vw, 32px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.auth-card-head {
    text-align: left;
    margin-bottom: 20px;
}

.auth-badge {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--primary-soft);
    color: var(--primary);
    margin-bottom: 14px;
}

.auth-badge .icon {
    width: 21px;
    height: 21px;
}

.auth-card-head h2 {
    font-size: 1.5rem;
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.auth-card-head p {
    margin-top: 6px;
    font-size: 0.84rem;
    color: var(--muted);
    line-height: 1.55;
}

.auth-alert {
    display: flex;
    gap: 9px;
    padding: 11px 12px;
    margin-bottom: 16px;
    border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
    border-left: 4px solid var(--red);
    border-radius: 10px;
    background: var(--red-soft);
    color: var(--red-ink);
}

.auth-alert-icon {
    flex-shrink: 0;
    padding-top: 1px;
}

.auth-alert-icon .icon {
    width: 16px;
    height: 16px;
}

.auth-alert p {
    font-size: 0.8rem;
    line-height: 1.45;
}

.auth-alert p + p {
    margin-top: 4px;
}

.auth-alert-success {
    border-color: color-mix(in srgb, var(--green) 25%, transparent);
    border-left-color: var(--green);
    background: var(--green-soft);
    color: var(--green-ink);
}

.auth-alert-warning {
    border-color: color-mix(in srgb, var(--yellow) 30%, transparent);
    border-left-color: var(--yellow);
    background: var(--yellow-soft);
    color: var(--yellow-ink);
}

.auth-alert-info {
    border-color: color-mix(in srgb, var(--blue) 25%, transparent);
    border-left-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue-ink);
}

.auth-form .field {
    margin-bottom: 13px;
}

.password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrap .input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
}

.password-toggle:hover {
    background: var(--surface-3);
    color: var(--text);
}

.password-toggle .icon {
    width: 16px;
    height: 16px;
}

.password-toggle .eye-off {
    display: none;
}

.password-toggle.is-visible .eye-on {
    display: none;
}

.password-toggle.is-visible .eye-off {
    display: grid;
}

.auth-form .btn-block {
    margin-top: 6px;
}

.auth-foot {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.5;
}

.auth-foot .icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--green);
}

.auth-panel-copy {
    font-size: 0.7rem;
    color: var(--muted-2);
    text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
    .overview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1080px) {
    .task-grid,
    .schedule-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .app-main {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-105%);
        transition: transform 0.24s ease;
        box-shadow: var(--shadow-lg);
        width: min(300px, 86vw);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(2, 6, 23, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.22s ease, visibility 0.22s ease;
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .menu-btn {
        display: inline-grid !important;
        flex-shrink: 0;
    }

    .topbar {
        gap: 12px;
    }

    .topbar-search {
        max-width: 300px;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        display: none;
    }

    .auth-panel-brand {
        display: inline-flex;
    }

    .auth-panel {
        min-height: 100vh;
        padding: 24px 18px;
        justify-content: center;
    }

    .auth-panel-copy {
        margin-top: 4px;
    }
}

@media (max-width: 820px) {
    .topbar {
        flex-wrap: wrap;
        padding-top: 10px;
        padding-bottom: 10px;
        row-gap: 10px;
    }

    .topbar-title {
        flex: 1;
        order: 1;
    }

    .topbar-actions {
        order: 2;
    }

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

    .topbar-search input {
        height: 38px;
    }

    .topbar-avatar {
        display: none;
    }

    .page-head {
        align-items: flex-start;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .content {
        padding: 16px;
        gap: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 13px;
        gap: 10px;
        border-radius: 14px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .stat-icon .icon {
        width: 17px;
        height: 17px;
    }

    .stat-value {
        font-size: 1.32rem;
    }

    .stat-label {
        font-size: 0.69rem;
        white-space: normal;
    }

    .stat-note {
        display: none;
    }

    .panel {
        padding: 16px;
        border-radius: 16px;
    }

    .panel-head {
        flex-direction: column;
        gap: 6px;
    }

    .task-card,
    .schedule-card,
    .archive-row {
        border-radius: 14px;
    }

    .task-body {
        padding: 14px 14px 12px;
    }

    .task-footer {
        padding: 10px 14px;
    }

    .task-head {
        flex-direction: column;
        gap: 6px;
    }

    .card-actions {
        align-self: flex-end;
        margin-top: -4px;
    }

    .schedule-card {
        padding: 13px;
        gap: 12px;
    }

    .date-tile {
        width: 60px;
        min-height: 72px;
        border-radius: 12px;
    }

    .date-day {
        font-size: 1.4rem;
    }

    .schedule-head {
        flex-direction: column;
    }

    .schedule-head .card-actions {
        align-self: flex-end;
    }

    .toolbar {
        padding: 10px;
    }

    .toolbar-filters {
        width: 100%;
    }

    .search-inline {
        max-width: none;
        flex-basis: 100%;
    }

    .select-auto {
        flex: 1;
        min-width: 120px;
    }

    .result-count {
        display: none;
    }

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

    .modal {
        padding: 0;
        align-items: end;
    }

    .modal-card {
        width: 100%;
        max-height: 94vh;
        border-radius: 20px 20px 0 0;
        animation: sheet-in 0.24s ease both;
    }

    .modal-footer {
        border-radius: 0;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .archive-row {
        align-items: flex-start;
        padding: 14px;
    }

    .archive-type {
        order: 0;
    }

    .archive-main {
        order: 1;
        flex-basis: calc(100% - 90px);
    }

    .archive-actions {
        order: 2;
        width: 100%;
        justify-content: flex-end;
        border-top: 1px dashed var(--border);
        padding-top: 10px;
    }

    .auth-card {
        border-radius: 18px;
    }

    .toast-stack {
        top: 10px;
        right: 10px;
        width: calc(100vw - 20px);
    }
}

@media (max-width: 430px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-note {
        display: inline-block;
    }

    .page-actions {
        flex-direction: column;
    }

    .page-actions .btn {
        width: 100%;
    }

    .topbar-title p {
        display: none;
    }

    .chip {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .task-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 7px;
    }

    .status-quick {
        justify-content: space-between;
    }

    .status-quick select {
        flex: 1;
    }

    .updated {
        justify-content: flex-end;
    }
}

@keyframes sheet-in {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
