/* Shared tokens, base styles, and the signed-in page shell (top bar + side nav). */
:root {
    --bg: #f7f9fb;
    --surface: #ffffff;
    --ink: #14202e;
    --muted: #5a6b7d;
    --line: #e1e6ec;
    --accent: #2f6f5e;
    --accent-tint: #e6f0ed;
    --danger: #b42318;
    --danger-hover: #912018;
    --hover: #eef2f5;
    --button: #1f2328;
    --button-hover: #32383f;
    --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --topbar-h: 56px;
    --rail-w: 64px;
    --side-w: 232px;
}

* { box-sizing: border-box; }

[v-cloak] { display: none; }

html, body { margin: 0; height: 100%; }

body {
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 var(--sans);
}

.icon {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.icon-button:hover,
.icon-button[aria-expanded="true"] { background: var(--hover); }

.icon-button:focus-visible,
.side-nav a:focus-visible,
.menu-item:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Shell ---- */

.shell {
    min-height: 100dvh;
    display: grid;
    grid-template-rows: var(--topbar-h) minmax(0, 1fr);
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

.shell.nav-open { grid-template-columns: var(--side-w) minmax(0, 1fr); }

.topbar {
    grid-column: 1 / -1;
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

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

.wordmark {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}

.side-nav {
    position: sticky;
    top: var(--topbar-h);
    z-index: 20;
    height: calc(100dvh - var(--topbar-h));
    width: var(--rail-w);
    overflow: hidden;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.nav-open .side-nav { width: var(--side-w); }

.side-nav ul {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    display: grid;
    gap: 2px;
}

/* 10px margin + 12px padding centers the 20px icon in the 64px rail. */
.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.side-nav a:hover { background: var(--hover); color: var(--ink); }

.side-nav a[aria-current="page"] {
    background: var(--accent-tint);
    color: var(--accent);
    font-weight: 600;
}

.shell:not(.nav-open) .side-nav .label { display: none; }

.content {
    min-width: 0;
    padding: 32px;
}

.scrim { display: none; }

/* On narrow screens the rail stays in place and the open nav slides over the page. */
@media (max-width: 767px) {
    .shell.nav-open { grid-template-columns: var(--rail-w) minmax(0, 1fr); }

    .nav-open .side-nav {
        position: fixed;
        left: 0;
        bottom: 0;
        height: auto;
        box-shadow: 8px 0 24px rgba(20, 32, 46, 0.12);
    }

    .nav-open .scrim {
        display: block;
        position: fixed;
        inset: var(--topbar-h) 0 0 0;
        z-index: 10;
        background: rgba(20, 32, 46, 0.25);
    }

    .content { padding: 24px 20px; }
}

/* ---- Account menu ---- */

.account { position: relative; }

.menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 240px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(20, 32, 46, 0.12);
}

.menu-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
    min-width: 0;
}

.menu-user img { border-radius: 50%; flex: none; }

.menu-user div { display: grid; min-width: 0; }

.menu-user strong,
.menu-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-user span { color: var(--muted); font-size: 14px; }

.menu-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: 15px/1.4 var(--sans);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.menu-item:hover { background: var(--hover); }

/* ---- Page content ---- */

.page-header {
    display: grid;
    gap: 4px;
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.page-header p { margin: 0; color: var(--muted); }

.panel {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.panel h2 { margin: 0 0 4px; font-size: 17px; }

.panel p { margin: 0; color: var(--muted); }

/* ---- Forms and buttons ---- */

.stack { display: grid; gap: 16px; max-width: 720px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--button);
    color: #fff;
    font: 600 15px/1.2 var(--sans);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.btn:hover { background: var(--button-hover); }

.btn:disabled { opacity: 0.6; cursor: progress; }

.btn:focus-visible,
.field input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.btn.secondary {
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
}

.btn.secondary:hover { background: var(--hover); }

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

.btn.secondary.danger {
    background: transparent;
    color: var(--danger);
}
.btn.secondary.danger:hover { background: var(--hover); }

.steps {
    margin: 12px 0 20px;
    padding-left: 20px;
    display: grid;
    gap: 4px;
    color: var(--muted);
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.field { display: grid; gap: 6px; flex: 1 1 240px; min-width: 0; }

.field label { font-size: 14px; font-weight: 600; }

.field input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: 15px/1.4 var(--mono);
}

.field input[aria-invalid="true"] { border-color: var(--danger); }

.panel .error { margin-top: 8px; color: var(--danger); }

.panel .hint { margin-top: 16px; font-size: 14px; }

.notice {
    margin: 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--accent-tint);
    color: var(--accent);
}

.app-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
}

.app-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.app-list li > div:first-child { display: grid; min-width: 0; }

.app-list span { color: var(--muted); font-size: 14px; }

.app-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.app-confirm { display: grid; gap: 8px; max-width: 420px; }

.app-confirm p { margin: 0; font-size: 14px; }
