*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Phosphor icon sizing ───────────────────────────────────────── */
.nav-link .ph         { font-size: 1.1rem; line-height: 1; }
.nav-chip .ph         { font-size: 14px; line-height: 1; }
.blade-header-icon .ph { font-size: 1rem; line-height: 1; }

/* ── Design tokens ──────────────────────────────────────────────── */
:root {
    --font: 'Inter', 'Google Sans', system-ui, sans-serif;

    /* Surfaces */
    --bg:      #6E8C96;
    --surface: rgba(210,214,216,0.50);
    --border:  rgba(255,255,255,0.22);
    --border-s: rgba(255,255,255,0.14);

    /* Text */
    --t1: #1A1C20;
    --t2: #4A5260;
    --t3: #7A8494;

    /* Default accent – overridden per blade */
    --accent:      #2A5462;
    --accent-soft: rgba(42,84,98,0.18);
    --accent-dim:  rgba(42,84,98,0.10);
    --bg-tint:     #6E8C96;

    /* Shadows */
    --sh-sm: 0 2px 6px rgba(0,0,0,.15), 0 1px 3px rgba(0,0,0,.10);
    --sh-md: 0 6px 24px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.12);
    --sh-lg: 0 16px 56px rgba(0,0,0,.28), 0 4px 14px rgba(0,0,0,.14);

    /* Radii */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;

    /* Motion */
    --ease: 160ms cubic-bezier(.4,0,.2,1);
}

/* ── Blade-specific theme overrides ────────────────────────────── */
/* Applied to <body data-blade="X"> so all vars cascade everywhere  */
body[data-blade="todos"] {
    --accent:      #2A5462;
    --accent-soft: rgba(42,84,98,0.20);
    --accent-dim:  rgba(42,84,98,0.10);
    --bg-tint:     #6B8A94;
    background:
        radial-gradient(ellipse 70% 55% at 74% 20%, rgba(255,255,248,0.42) 0%, transparent 58%),
        radial-gradient(ellipse 50% 48% at 10% 90%, rgba(0,0,0,0.32) 0%, transparent 52%),
        radial-gradient(ellipse 60% 38% at 42% 68%, rgba(0,0,0,0.14) 0%, transparent 46%),
        #6B8A94;
}
body[data-blade="calendar"] {
    --accent:      #5A4A18;
    --accent-soft: rgba(90,74,24,0.20);
    --accent-dim:  rgba(90,74,24,0.10);
    --bg-tint:     #8C7E5C;
    background:
        radial-gradient(ellipse 65% 52% at 36% 15%, rgba(255,248,210,0.48) 0%, transparent 56%),
        radial-gradient(ellipse 52% 50% at 88% 82%, rgba(0,0,0,0.34) 0%, transparent 52%),
        radial-gradient(ellipse 58% 36% at 16% 70%, rgba(0,0,0,0.16) 0%, transparent 44%),
        #8C7E5C;
}
body[data-blade="shopping"] {
    --accent:      #2A4E38;
    --accent-soft: rgba(42,78,56,0.20);
    --accent-dim:  rgba(42,78,56,0.10);
    --bg-tint:     #6A8674;
    background:
        radial-gradient(ellipse 62% 50% at 25% 18%, rgba(248,255,248,0.42) 0%, transparent 56%),
        radial-gradient(ellipse 52% 50% at 82% 85%, rgba(0,0,0,0.34) 0%, transparent 52%),
        radial-gradient(ellipse 55% 38% at 60% 58%, rgba(0,0,0,0.14) 0%, transparent 44%),
        #6A8674;
}
body[data-blade="apps"] {
    --accent:      #38386A;
    --accent-soft: rgba(56,56,106,0.20);
    --accent-dim:  rgba(56,56,106,0.10);
    --bg-tint:     #6C6C8C;
    background:
        radial-gradient(ellipse 68% 52% at 68% 16%, rgba(248,248,255,0.42) 0%, transparent 56%),
        radial-gradient(ellipse 50% 50% at 12% 85%, rgba(0,0,0,0.34) 0%, transparent 52%),
        radial-gradient(ellipse 55% 36% at 38% 62%, rgba(0,0,0,0.14) 0%, transparent 44%),
        #6C6C8C;
}

/* ── Base ───────────────────────────────────────────────────────── */
body {
    font-family: var(--font);
    background: var(--bg-tint);
    color: var(--t1);
    height: 100vh;
    overflow: hidden;
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background var(--ease);
}

/* ── Auth ───────────────────────────────────────────────────────── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 70% 55% at 72% 18%, rgba(255,255,248,0.42) 0%, transparent 56%),
        radial-gradient(ellipse 52% 50% at 10% 88%, rgba(0,0,0,0.32) 0%, transparent 52%),
        radial-gradient(ellipse 58% 36% at 40% 62%, rgba(0,0,0,0.13) 0%, transparent 44%),
        #6C848E;
}

.auth-card {
    background: rgba(200,204,208,0.45);
    backdrop-filter: blur(28px) saturate(1.1);
    -webkit-backdrop-filter: blur(28px) saturate(1.1);
    border-radius: var(--r-lg);
    padding: 44px 48px;
    width: 400px;
    box-shadow: var(--sh-lg);
    border: 1px solid rgba(255,255,255,0.30);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 36px;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(42,54,62,0.70);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.brand-mark-icon {
    font-size: 16px;
    color: #fff;
    line-height: 1;
}

.brand-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--t1);
    letter-spacing: -0.3px;
}

.auth-card h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.4px;
    margin-bottom: 4px;
    color: var(--t1);
}

.auth-subtitle {
    font-size: 13px;
    color: var(--t2);
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--t2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid rgba(255,255,255,0.35);
    border-radius: var(--r-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: rgba(255,255,255,0.70);
    color: var(--t1);
    transition: border-color var(--ease), box-shadow var(--ease);
}

.form-group input::placeholder { color: var(--t3); }

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn-primary {
    width: 100%;
    margin-top: 8px;
    padding: 11px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: filter var(--ease), transform var(--ease);
    letter-spacing: .1px;
}

.btn-primary:hover  { filter: brightness(1.08); }
.btn-primary:active { transform: scale(.99); }

.error-message {
    background: #FEF2F2;
    color: #B91C1C;
    padding: 10px 14px;
    border-radius: var(--r-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #FECACA;
}

/* ── App shell ──────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: rgba(200,204,208,0.42);
    backdrop-filter: blur(24px) saturate(1.1);
    -webkit-backdrop-filter: blur(24px) saturate(1.1);
    border-right: 1px solid rgba(255,255,255,0.20);
    display: flex;
    flex-direction: column;
    box-shadow: var(--sh-sm);
    z-index: 10;
}

.sidebar-header {
    padding: 18px 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    gap: 9px;
}

/* Reuse .brand-mark from auth above */
.sidebar-header .brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    box-shadow: 0 1px 5px rgba(0,0,0,.25);
}

.sidebar-header .brand-mark .brand-mark-icon {
    font-size: 14px;
}

/* ── Nav icon chips ─────────────────────────────────────────────── */
.nav-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    flex-shrink: 0;
    font-size: 14px;
    color: #fff;
    transition: transform var(--ease), box-shadow var(--ease);
}

.nav-chip-todos    { background: #6B8A94; }
.nav-chip-calendar { background: #8C7E5C; }
.nav-chip-shopping { background: #6A8674; }
.nav-chip-apps     { background: #6C6C8C; }

.nav-item.active .nav-chip,
.nav-link:hover   .nav-chip {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.app-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--t1);
    letter-spacing: -0.2px;
}

.nav-list {
    list-style: none;
    padding: 8px 6px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    text-decoration: none;
    color: var(--t2);
    font-size: 13px;
    font-weight: 450;
    transition: color var(--ease), background var(--ease);
}

.nav-link svg { flex-shrink: 0; transition: color var(--ease); }

.nav-link:hover {
    background: var(--accent-dim);
    color: var(--t1);
}

.nav-item.active .nav-link {
    background: var(--accent-soft);
    color: var(--t1);
    font-weight: 500;
}

.badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 8px 6px 12px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.logout-link { color: var(--t3); }
.logout-link:hover { color: var(--t1); background: rgba(255,255,255,0.15) !important; }

/* ── Blade area ─────────────────────────────────────────────────── */
.blade-area {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.blade {
    background: rgba(200,204,208,0.48);
    backdrop-filter: blur(20px) saturate(1.1);
    -webkit-backdrop-filter: blur(20px) saturate(1.1);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-md);
    max-width: 700px;
    border: 1px solid rgba(255,255,255,0.26);
    overflow: hidden;
}

.blade-header {
    padding: 16px 22px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
    display: flex;
    align-items: center;
    gap: 10px;
}

.blade-header-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.blade-header h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--t1);
}

.blade-content {
    padding: 4px 0;
}

/* ── Item list ──────────────────────────────────────────────────── */
.item-list { list-style: none; }

.item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    transition: background var(--ease);
}

.item:last-child { border-bottom: none; }
.item:hover { background: rgba(255,255,255,0.12); }
.item.completed .item-title { text-decoration: line-through; color: var(--t3); }

.item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-title {
    font-size: 13.5px;
    color: var(--t1);
}

.item-meta {
    font-size: 11.5px;
    color: var(--t3);
}

.item-location {
    font-size: 11.5px;
    color: var(--t3);
}

.item-qty {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Urgency tags */
.urgency-tag {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.urgency-tag.critical { background: #FEF2F2; color: #B91C1C; }
.urgency-tag.high     { background: #FFFBEB; color: #D97706; }
.urgency-tag.medium   { background: var(--accent-soft); color: var(--accent); }
.urgency-tag.low      { background: #F0FDF4; color: #166534; }

/* ── Shopping ───────────────────────────────────────────────────── */
.shopping-list {
    padding: 14px 22px;
    border-bottom: 1px solid var(--border-s);
}

.shopping-list:last-child { border-bottom: none; }

.list-name {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--t1);
}

.store-name {
    font-size: 12px;
    font-weight: 400;
    color: var(--t3);
}

.shopping-list .item-list { margin-left: 4px; }

.shopping-list .item {
    padding: 5px 8px;
    border-radius: var(--r-sm);
    border-bottom: none;
    margin-bottom: 1px;
}

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
    padding: 52px 24px;
    text-align: center;
    color: var(--t3);
    font-size: 13px;
    line-height: 1.7;
}

/* ── App tiles ──────────────────────────────────────────────────── */
.app-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 16px 18px;
}

.app-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: var(--r-md);
    text-decoration: none;
    color: var(--t2);
    width: 72px;
    transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
    cursor: pointer;
}

.app-tile:hover {
    background: var(--accent-soft);
    transform: translateY(-2px);
    box-shadow: var(--sh-sm);
}

.app-favicon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: contain;
}

.app-favicon-fallback {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-tile-name {
    font-size: 10.5px;
    font-weight: 450;
    text-align: center;
    color: var(--t2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 64px;
}

.app-tile-wrapper {
    position: relative;
    display: inline-flex;
}

.remove-form {
    position: absolute;
    top: 4px;
    right: 4px;
}

.remove-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.18);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--ease);
}

.app-tile-wrapper:hover .remove-btn { display: flex; }
.remove-btn:hover { background: #B91C1C; }

.add-link-form {
    padding: 10px 18px 16px;
    border-top: 1px solid var(--border-s);
}

.add-link-row {
    display: flex;
    gap: 8px;
}

.add-link-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid rgba(255,255,255,0.30);
    border-radius: var(--r-sm);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: rgba(255,255,255,0.65);
    color: var(--t1);
    transition: border-color var(--ease), box-shadow var(--ease);
}

.add-link-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.add-link-btn {
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: filter var(--ease);
    white-space: nowrap;
}

.add-link-btn:hover { filter: brightness(1.08); }

/* ── Admin section (apps blade) ─────────────────────────────── */
.app-section-sep {
    width: 100%;
    height: 0;
    border-top: 1px solid rgba(255,255,255,0.18);
    margin: 8px 4px 4px;
}

.app-section-label-row {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 2px 4px;
}

.app-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--t3);
}

.cloud-portal-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #2A3462;
    color: rgba(255,255,255,0.88);
    font-size: 20px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
