:root {
    --bg: #f7f4ed;
    --bg-soft: #ebe7dd;
    --ink: #161a1d;
    --muted: #6f7478;
    --panel: rgba(255, 255, 255, 0.72);
    --panel-solid: #fffdf8;
    --line: rgba(22, 26, 29, 0.11);
    --shadow: 0 24px 70px rgba(31, 35, 38, 0.12);
    --accent: #176b5b;
    --accent-2: #f0713f;
    --accent-3: #3b6ce1;
    --danger: #c64545;
    --radius: 24px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    color-scheme: light;
}

body.dark {
    --bg: #0d1012;
    --bg-soft: #151a1d;
    --ink: #f5f0e7;
    --muted: #a1aaa9;
    --panel: rgba(25, 30, 33, 0.72);
    --panel-solid: #181d20;
    --line: rgba(245, 240, 231, 0.12);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    --accent: #6ed7bd;
    --accent-2: #ff9568;
    --accent-3: #8aaaff;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.mesh {
    position: absolute;
    border-radius: 999px;
    filter: blur(2px);
    opacity: .62;
}

.mesh-a {
    width: 54vw;
    height: 54vw;
    top: -23vw;
    right: -14vw;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 46%, transparent), transparent 64%);
}

.mesh-b {
    width: 46vw;
    height: 46vw;
    bottom: -22vw;
    left: 10vw;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent-3) 30%, transparent), transparent 64%);
}

.grid-glow {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px),
        linear-gradient(to bottom, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .42), rgba(0, 0, 0, .04));
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) minmax(320px, 420px);
    gap: 20px;
    padding: 20px;
}

.side-nav,
.main-stage,
.news-dock,
.panel,
.time-card,
.focus-card,
.palette-panel,
.toast {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px) saturate(140%);
}

.side-nav {
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 28px;
}

.brand,
.rail-btn,
.icon-btn {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    cursor: pointer;
    transition: .22s var(--ease);
}

.brand {
    margin-bottom: 8px;
    background: var(--ink);
    color: var(--bg);
    font-weight: 900;
}

.rail-btn:last-child {
    margin-top: auto;
}

.rail-btn:hover,
.rail-btn.is-active,
.icon-btn:hover {
    border-color: var(--line);
    background: var(--panel-solid);
    color: var(--ink);
    transform: translateY(-2px);
}

.main-stage {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: clamp(18px, 3vw, 32px);
    border-radius: 34px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
    gap: 20px;
    align-items: center;
}

.eyebrow {
    color: var(--accent);
    font-size: .74rem;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}

h1,
h2 {
    letter-spacing: 0;
}

h1 {
    margin-top: 4px;
    font-size: clamp(2rem, 4.8vw, 4.8rem);
    line-height: .94;
}

h2 {
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    line-height: 1.05;
}

.command-trigger,
.search-inline,
.palette-search {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-solid);
}

.command-trigger {
    width: 100%;
    cursor: pointer;
    color: var(--muted);
    text-align: left;
    transition: .22s var(--ease);
}

.command-trigger:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
}

.command-trigger span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

kbd {
    padding: 5px 8px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ink) 8%, transparent);
    color: var(--ink);
    font-size: .72rem;
    font-weight: 800;
}

.hero-grid,
.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, .75fr);
    gap: 20px;
}

.time-card,
.focus-card,
.panel,
.news-dock {
    border-radius: var(--radius);
}

.time-card {
    position: relative;
    overflow: hidden;
    min-height: 354px;
    padding: clamp(22px, 4vw, 42px);
}

.time-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 8px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}

.time-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 800;
}

#timeButton {
    display: block;
    width: 100%;
    margin-top: 28px;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

#time {
    display: block;
    font-size: clamp(5rem, 14vw, 10.4rem);
    font-weight: 900;
    line-height: .82;
    font-variant-numeric: tabular-nums;
}

.weather-card {
    position: absolute;
    left: clamp(22px, 4vw, 42px);
    bottom: 32px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    max-width: calc(100% - 84px);
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-solid);
    color: var(--ink);
    cursor: pointer;
}

.weather-card i {
    color: var(--accent-2);
}

.focus-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    min-height: 354px;
    padding: 26px;
}

.focus-card p:not(.eyebrow) {
    margin-top: 12px;
    color: var(--muted);
    line-height: 1.55;
}

.quick-actions {
    display: grid;
    gap: 10px;
}

.quick-action {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-solid);
    color: var(--ink);
    text-decoration: none;
}

.quick-action strong,
.site-card strong,
.recent-item strong,
.news-item strong,
.command-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-action span,
.site-card span,
.recent-item span,
.news-item span,
.command-item span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.content-grid {
    grid-template-columns: minmax(0, 1fr) minmax(260px, .5fr);
}

.panel {
    padding: 22px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.text-btn {
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-weight: 900;
}

.site-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.site-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.site-card,
.recent-item,
.news-item,
.command-item {
    border: 1px solid var(--line);
    background: var(--panel-solid);
    color: var(--ink);
    text-decoration: none;
    transition: .22s var(--ease);
}

.site-card:hover,
.recent-item:hover,
.news-item:hover,
.command-item:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.site-card {
    position: relative;
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border-radius: 20px;
}

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

.site-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--accent-3) 12%, transparent);
    overflow: hidden;
}

.site-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.pin-btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ink) 7%, transparent);
    color: var(--muted);
    cursor: pointer;
}

.pin-btn.is-pinned {
    color: var(--accent-2);
}

.recent-list,
.news-list,
.command-results {
    display: grid;
    gap: 10px;
}

.empty {
    color: var(--muted);
    font-weight: 700;
    line-height: 1.5;
}

.recent-item,
.news-item,
.command-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px;
    border-radius: 18px;
}

.news-dock {
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.news-list {
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.news-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    min-height: auto;
    padding: 14px;
}

.news-item small {
    color: var(--accent);
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.news-item strong {
    display: block;
    margin-top: 7px;
    white-space: normal;
    line-height: 1.28;
}

.news-item span {
    display: block;
    margin-top: 8px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.tabs.slim {
    flex-wrap: nowrap;
    overflow-x: auto;
}

.tab {
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-solid);
    color: var(--muted);
    cursor: pointer;
    font-size: .82rem;
    font-weight: 900;
}

.tab.is-active {
    background: var(--ink);
    color: var(--bg);
}

.page-head {
    align-items: end;
}

.search-inline {
    width: min(100%, 360px);
}

.search-inline input,
.palette-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
}

.launch-screen {
    display: grid;
    gap: 4px;
}

.palette {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: start center;
    padding: 8vh 18px 18px;
}

.palette[hidden] {
    display: none;
}

.palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 12, 13, .46);
}

.palette-panel {
    position: relative;
    width: min(760px, 100%);
    max-height: min(760px, 84vh);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 30px;
    padding: 14px;
}

.palette-search {
    margin-bottom: 12px;
}

.palette-search button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: color-mix(in srgb, var(--ink) 7%, transparent);
    cursor: pointer;
}

.palette-panel h2 {
    padding: 4px 8px 12px;
}

.command-results {
    overflow: auto;
    padding: 0 2px 4px;
}

.command-item {
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.command-item mark {
    border-radius: 999px;
    padding: 4px 8px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-size: .72rem;
    font-weight: 900;
}

.toast-container {
    position: fixed;
    top: 22px;
    right: 22px;
    z-index: 2200;
    display: grid;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: min(340px, calc(100vw - 44px));
    padding: 14px 16px;
    border-radius: 18px;
    animation: toastIn .24s var(--ease) both;
}

.toast i {
    color: var(--accent);
}

.toast button {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

@keyframes toastIn {
    from {
        transform: translateX(110%);
        opacity: 0;
    }
}

@keyframes toastOut {
    to {
        transform: translateX(110%);
        opacity: 0;
    }
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 58%, white);
    outline-offset: 3px;
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .news-dock {
        position: static;
        grid-column: 2;
        height: auto;
        max-height: 620px;
    }
}

@media (max-width: 860px) {
    .app-shell {
        display: block;
        padding: 14px;
    }

    .side-nav {
        position: fixed;
        left: 50%;
        bottom: 14px;
        top: auto;
        z-index: 1200;
        width: min(420px, calc(100vw - 28px));
        height: 68px;
        flex-direction: row;
        justify-content: center;
        border-radius: 24px;
    }

    .brand {
        display: none;
    }

    .rail-btn:last-child {
        margin-top: 0;
    }

    .main-stage,
    .news-dock {
        margin-bottom: 16px;
        padding: 18px;
        border-radius: 28px;
    }

    .news-dock {
        margin-bottom: 92px;
    }

    .topbar,
    .hero-grid,
    .content-grid,
    .page-head {
        grid-template-columns: 1fr;
    }

    .site-grid,
    .site-grid.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .time-card,
    .focus-card {
        min-height: 300px;
    }
}

@media (max-width: 560px) {
    .site-grid,
    .site-grid.compact {
        grid-template-columns: 1fr;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .search-inline {
        width: 100%;
    }

    .command-trigger kbd {
        display: none;
    }

    #time {
        font-size: clamp(4.6rem, 24vw, 7rem);
    }
}

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