/* App Portal UI reset + design tokens (no Node/Tailwind) */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    color-scheme: light;
}

body {
    margin: 0;
    min-height: 100%;
    background: hsl(var(--color-bg));
    color: hsl(var(--color-text));
}

img,
svg {
    display: block;
    max-width: 100%;
}

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

button:focus,
button:focus-visible,
input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible {
    outline: none;
    box-shadow: none;
}

::selection {
    background: hsl(var(--color-accent));
    color: hsl(var(--color-surface));
}

:root {
    --color-bg: 210 20% 98%;
    --color-surface: 0 0% 100%;
    --color-surface-2: 210 24% 96%;
    --color-text: 222 22% 12%;
    --color-muted: 215 16% 44%;
    --color-border: 214 20% 86%;
    --color-accent: 208 88% 38%;
    --color-accent-2: 174 62% 34%;
    --color-focus: 36 93% 55%;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-soft: 0 12px 30px -16px hsl(222 22% 12% / 0.25);
    --shadow-card: 0 18px 40px -26px hsl(222 22% 12% / 0.35);
}

.dark {
    color-scheme: dark;
    --color-bg: 220 20% 10%;
    --color-surface: 222 22% 14%;
    --color-surface-2: 222 20% 18%;
    --color-text: 210 30% 96%;
    --color-muted: 215 14% 68%;
    --color-border: 218 18% 28%;
    --color-accent: 198 92% 60%;
    --color-accent-2: 168 72% 45%;
    --color-focus: 36 93% 62%;
    --shadow-soft: 0 16px 36px -20px hsl(220 25% 3% / 0.6);
    --shadow-card: 0 20px 46px -26px hsl(220 25% 3% / 0.7);
}

.page {
    min-height: 100vh;
    background: hsl(var(--color-bg));
    color: hsl(var(--color-text));
    display: flex;
    flex-direction: column;
}

.container {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 0 24px;
}

.site-header,
.site-footer {
    background: hsl(var(--color-surface) / 0.92);
    border-color: hsl(var(--color-border) / 0.7);
    backdrop-filter: blur(12px);
}

.site-header {
    border-bottom: 1px solid hsl(var(--color-border) / 0.7);
}

.site-footer {
    border-top: 1px solid hsl(var(--color-border) / 0.7);
    margin-top: auto;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
}

.site-footer a:hover {
    color: hsl(var(--color-accent-2));
}

.page-login a {
    color: hsl(var(--color-text));
}

.page-login a:hover {
    color: hsl(var(--color-accent-2));
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: hsl(var(--color-accent));
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.brand-subtitle {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: hsl(var(--color-muted));
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.settings-actions-spread {
    width: 100%;
    margin-top: 16px;
}

.settings-actions-spread .btn {
    flex: 1 1 0;
    justify-content: center;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid hsl(var(--color-border));
    background: hsl(var(--color-surface));
    border-radius: 999px;
    padding: 6px 10px;
    cursor: pointer;
}

.theme-icon {
    font-size: 0.9rem;
}

.theme-track {
    position: relative;
    width: 42px;
    height: 22px;
    background: hsl(var(--color-surface-2));
    border-radius: 999px;
}

.theme-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: hsl(var(--color-text));
    border-radius: 50%;
    transition: transform 180ms ease;
}

.dark .theme-thumb {
    transform: translateX(20px);
}

.main {
    padding: 40px 0 56px;
    flex: 1;
}

.layout-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.sidebar {
    min-width: 0;
}

.sidebar-close {
    position: absolute;
    top: 18px;
    right: 18px;
    border: 1px solid hsl(var(--color-border));
    background: hsl(var(--color-surface));
    border-radius: 999px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: hsl(220 20% 10% / 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    z-index: 30;
}

.sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-inner {
    display: grid;
    gap: 12px;
    text-align: left;
}

.sidebar-panel {
    position: relative;
    border-radius: 22px;
    border: 1px solid hsl(var(--color-border));
    background:
        linear-gradient(180deg, hsl(var(--color-surface)) 0%, hsl(var(--color-surface)) 78%, hsl(var(--color-surface-2)) 100%);
    box-shadow: var(--shadow-card);
    padding: 18px;
}

.sidebar-header {
    display: grid;
    gap: 6px;
    padding: 6px 4px 16px;
    border-bottom: 1px solid hsl(var(--color-border) / 0.9);
    margin-bottom: 14px;
}

.sidebar-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: hsl(var(--color-accent-2));
    font-weight: 700;
}

.sidebar-title {
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: hsl(var(--color-text));
    font-weight: 600;
}

.sidebar-subtitle {
    color: hsl(var(--color-muted));
    font-size: 0.84rem;
    line-height: 1.6;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
    justify-items: stretch;
}

.nav-item {
    display: grid;
    gap: 6px;
}

.nav-link,
.nav-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid hsl(var(--color-border) / 0.1);
    background: transparent;
    text-align: left;
    font-size: 0.96rem;
    color: hsl(var(--color-text));
    font-weight: 550;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, color 160ms ease;
}

.nav-link:hover,
.nav-toggle:hover {
    background: hsl(var(--color-surface-2));
    border-color: hsl(var(--color-border));
    transform: translateX(2px);
}

.nav-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    min-width: 0;
}

.nav-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.75;
}

.nav-item.is-active > .nav-link,
.nav-item.is-active > .nav-toggle {
    background: linear-gradient(135deg, hsl(var(--color-accent) / 0.12), hsl(var(--color-accent-2) / 0.08));
    border-color: hsl(var(--color-accent) / 0.28);
    color: hsl(var(--color-text));
    box-shadow: inset 3px 0 0 hsl(var(--color-accent));
}

.nav-children {
    display: none;
    padding: 2px 0 0 14px;
    justify-items: stretch;
}

.nav-children.is-open {
    display: grid;
}

.nav-chevron {
    margin-left: auto;
    opacity: 0.52;
    font-size: 0.72rem;
    transition: transform 160ms ease;
}

.nav-item.is-active > .nav-toggle .nav-chevron,
.nav-toggle[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

.profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: hsl(var(--color-surface-2));
    color: hsl(var(--color-text));
    font-weight: 600;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.profile-actions {
    display: grid;
    gap: 6px;
}

.profile-actions .nav-link {
    padding: 8px 10px;
    justify-content: flex-start;
    font-size: 0.85rem;
}

.header-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 12px;
    border-left: 1px solid hsl(var(--color-border));
}

.profile-trigger {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    min-width: 160px;
    background: hsl(var(--color-surface));
    border: 1px solid hsl(var(--color-border));
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    padding: 8px;
    z-index: 50;
}

.profile-menu.is-open {
    display: grid;
    gap: 6px;
}

.profile-menu .nav-link {
    padding: 8px 10px;
    justify-content: flex-start;
    width: 100%;
    text-align: left;
}

.content-area {
    min-width: 0;
}

.hero {
    display: grid;
    gap: 32px;
}

.hero-copy {
    display: grid;
    gap: 16px;
}

.hero-title {
    font-size: clamp(2rem, 3vw, 2.7rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}

.hero-subtitle {
    margin: 0;
    color: hsl(var(--color-muted));
}

.grid {
    display: grid;
    gap: 24px;
}

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

.settings-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
}

.settings-nav {
    position: sticky;
    top: 24px;
    align-self: start;
}

.settings-content {
    min-width: 0;
}

.job-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid hsl(var(--color-border));
}

.job-row:last-child {
    border-bottom: none;
}

.job-controls {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.grid-hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}

.stack {
    display: grid;
    gap: 20px;
}

.stack-sm {
    display: grid;
    gap: 12px;
}

.card {
    border-radius: var(--radius-lg);
    border: 1px solid hsl(var(--color-border));
    background: hsl(var(--color-surface));
    box-shadow: var(--shadow-card);
    padding: 24px;
}

.card-muted {
    background: hsl(var(--color-surface-2));
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: hsl(var(--color-surface-2));
    color: hsl(var(--color-muted));
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    border-radius: 999px;
    border: 1px solid hsl(var(--color-border));
    background: hsl(var(--color-surface));
    color: hsl(var(--color-text));
    font-weight: 500;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.btn-primary {
    border-color: hsl(var(--color-accent));
    background: hsl(var(--color-accent));
    color: #fff;
    box-shadow: 0 10px 20px -14px hsl(var(--color-accent) / 0.8);
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
}

.text-muted {
    color: hsl(var(--color-muted));
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-lg {
    font-size: 1.125rem;
}

.weather-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.weather-icon {
    width: 40px;
    height: 40px;
}

.activity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid hsl(var(--color-border));
}

.activity-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.section-divider {
    border: none;
    border-top: 1px solid hsl(var(--color-border));
    margin: 8px 0;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.quicklink-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid hsl(var(--color-border));
    text-decoration: none;
    color: hsl(var(--color-text));
    background: hsl(var(--color-surface));
}

.quicklink-card:hover {
    border-color: hsl(var(--color-accent-2));
}

.link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid hsl(var(--color-border));
    cursor: grab;
}

.link-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.link-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-favicon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.calendar-container {
    position: relative;
}

.cal-loading {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.75rem;
    color: hsl(var(--color-muted));
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: hsl(220 20% 10% / 0.5);
    z-index: 60;
}

.modal.is-open {
    display: flex;
}

.modal-card {
    width: min(520px, 90vw);
    background: hsl(var(--color-surface));
    border: 1px solid hsl(var(--color-border));
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-card);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-body {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.font-semibold {
    font-weight: 600;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-wide {
    letter-spacing: 0.2em;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: hsl(var(--color-surface-2));
    border-radius: var(--radius-md);
    min-height: 1rem;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent 0%,
        hsl(var(--color-surface) / 0.7) 50%,
        transparent 100%
    );
    animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton.h-4 {
    height: 1rem;
}

.skeleton.h-20 {
    height: 5rem;
}

.w-2-3 {
    width: 66%;
}

.w-1-2 {
    width: 50%;
}

.w-full {
    width: 100%;
}

.callout {
    border-radius: 16px;
    border: 1px dashed hsl(var(--color-border) / 0.7);
    padding: 16px;
    font-size: 0.875rem;
    color: hsl(var(--color-muted));
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 0;
    font-size: 0.75rem;
    color: hsl(var(--color-muted));
}

.auth-wrapper {
    position: relative;
    display: flex;
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 48px clamp(20px, 4vw, 40px);
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at top left, hsl(var(--color-accent) / 0.2), transparent 36%),
        linear-gradient(135deg, hsl(var(--color-surface)), hsl(var(--color-surface-2)));
}

.auth-wrapper::before,
.auth-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
}

.auth-wrapper-has-image::before {
    background:
        linear-gradient(135deg, hsl(220 30% 10% / 0.28), hsl(210 30% 12% / 0.5)),
        var(--login-background-image) center / cover no-repeat;
    transform: scale(1.02);
}

.auth-wrapper-has-image::after {
    z-index: -1;
    background:
        linear-gradient(140deg, hsl(220 30% 8% / 0.24), transparent 42%),
        linear-gradient(0deg, hsl(220 30% 8% / 0.58), hsl(220 30% 8% / 0.12)),
        radial-gradient(circle at top right, var(--login-background-accent), transparent 28%);
}

.auth-stage {
    flex: 1;
    min-height: 0;
    display: grid;
    align-items: center;
    justify-items: end;
}

.auth-card {
    width: min(420px, 100%);
}

.auth-card-surface {
    backdrop-filter: blur(14px);
    background: hsl(var(--color-surface) / 0.84);
    border-color: hsl(var(--color-border) / 0.8);
}

.page-login {
    background: hsl(var(--color-bg));
}

.page-login .main {
    padding: 0;
    display: flex;
    flex: 1;
    min-height: 0;
}

.page-login .layout-shell {
    display: flex;
    width: 100%;
    max-width: none;
    padding: 0;
    flex: 1;
    min-height: 0;
}

.page-login .content-area {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: none;
    min-height: 0;
}

.auth-attribution {
    position: absolute;
    left: 20px;
    bottom: 14px;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: hsl(220 30% 8% / 0.58);
    color: hsl(210 30% 96%);
    backdrop-filter: blur(10px);
    font-size: 0.6875rem;
    z-index: 1;
}

.auth-attribution a {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.auth-attribution a:hover {
    text-decoration: underline;
}

.auth-note {
    margin: 0;
    font-size: 0.875rem;
    color: hsl(var(--color-muted));
}

.auth-link-inline {
    font-weight: 600;
    text-decoration: none;
}

.unsplash-preview {
    position: relative;
    min-height: 220px;
    border-radius: 20px;
    overflow: hidden;
    background:
        linear-gradient(135deg, hsl(220 24% 14% / 0.18), hsl(220 24% 10% / 0.58)),
        var(--unsplash-preview-image) center / cover no-repeat;
}

.unsplash-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, transparent, hsl(220 28% 10% / 0.72)),
        radial-gradient(circle at top right, var(--unsplash-preview-accent), transparent 28%);
}

.unsplash-preview-content {
    position: relative;
    z-index: 1;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    color: #fff;
}

.field {
    display: grid;
    gap: 6px;
}

.field-label {
    font-size: 0.875rem;
    font-weight: 600;
}

.field input {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid hsl(var(--color-border));
    padding: 10px 14px;
    background: hsl(var(--color-surface));
    color: hsl(var(--color-text));
}

.field select {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid hsl(var(--color-border));
    padding: 10px 14px;
    background: hsl(var(--color-surface));
    color: hsl(var(--color-text));
}

.field textarea {
    min-height: 120px;
    border-radius: 12px;
    border: 1px solid hsl(var(--color-border));
    padding: 12px 14px;
    background: hsl(var(--color-surface));
    color: hsl(var(--color-text));
    resize: vertical;
}

.field input:focus-visible {
    border-color: hsl(var(--color-border));
}

.field textarea:focus-visible {
    border-color: hsl(var(--color-border));
}

.callout-error {
    border-color: hsl(10 70% 55% / 0.6);
    color: hsl(10 60% 45%);
    background: hsl(10 70% 95%);
}

.dark .callout-error {
    background: hsl(10 40% 18%);
    color: hsl(10 70% 70%);
    border-color: hsl(10 60% 45%);
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

@media (max-width: 960px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(360px, 100vw);
        z-index: 40;
        padding: 20px 16px;
        transform: translateX(-110%);
        transition: transform 280ms ease;
    }

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

    .sidebar-panel {
        height: 100%;
        overflow: auto;
        padding: 22px 18px 18px;
    }

    .sidebar-close {
        display: grid;
    }

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

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

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

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-wrapper {
        min-height: 0;
        padding: 24px 18px;
    }

    .auth-stage {
        flex: 1;
        min-height: 0;
        display: grid;
        align-items: center;
        justify-items: end;
    }

    .auth-attribution {
        left: 12px;
        bottom: 12px;
    }
}

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

    .settings-nav {
        position: static;
    }
}

@media (min-width: 961px) {
    .layout-shell-has-sidebar {
        display: block;
        width: 100%;
        max-width: none;
        margin: 0;
        padding-left: 328px;
        padding-right: 28px;
    }

    .sidebar-trigger,
    .sidebar-close,
    .sidebar-overlay {
        display: none !important;
    }

    .sidebar {
        position: fixed;
        top: 104px;
        left: 20px;
        bottom: 24px;
        width: 280px;
        transform: none !important;
        z-index: 20;
    }

    .sidebar-panel {
        height: 100%;
        overflow: auto;
        padding: 18px;
    }

    .layout-shell-has-sidebar .content-area {
        width: 100%;
        max-width: none;
    }
}

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

    .btn-primary:hover {
        transform: none;
    }
}
