/* ============================================================================
 * Bleedpoint dashboard — app.css
 * Phase 8.1
 *
 * Single stylesheet. No external imports (strict CSP forbids them anyway).
 * Self-hosted IBM Plex Sans (4 weights) loaded below. Brand green is
 * #0f6848 to match the marketing site.
 * ========================================================================= */


/* ----- Fonts ----------------------------------------------------------- */

@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-400.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-500.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-600.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-700.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Serif';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/ibm-plex-serif-600.woff2') format('woff2');
}


/* ----- Reset ----------------------------------------------------------- */

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

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

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #0e1c1a;
    background: #f6f8f7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--brand-green);
    text-decoration: underline;
}
a:hover {
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: 0;
    background: none;
    color: inherit;
}
button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

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

[hidden] {
    display: none !important;
}


/* ----- Tokens ---------------------------------------------------------- */

:root {
    --brand-green: #0f6848;
    --brand-green-dark: #0a4f37;
    --brand-green-light: #e6f0ec;
    --brand-green-tint: #f3f8f5;
    --ink: #1a1a1a;
    --ink-muted: #5f5e5a;
    --ink-faint: #6b6a64;
    --line: #e8e6df;
    --line-strong: #d3d1c7;
    --bg: #faf9f5;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --error: #993c1d;
    --error-bg: #faece7;
    --warn: #b87a00;
    --warn-bg: #fcf3df;
    --shadow-sm: 0 1px 2px rgba(15, 104, 72, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 104, 72, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 104, 72, 0.12);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --container: 1080px;
}


/* ----- Boot view (loading) ------------------------------------------- */

.boot-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
}

.boot-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--line);
    border-top-color: var(--brand-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.boot-message {
    color: var(--ink-muted);
    font-size: 14px;
}


/* ----- Login view ---------------------------------------------------- */

.login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-link {
    display: inline-block;
    line-height: 0;
}
.login-logo-link:hover { opacity: 0.8; }

.login-logo {
    height: 36px;
    width: auto;
}

.login-state {
    text-align: center;
}

.login-title {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 600;
    font-size: 28px;
    line-height: 1.15;
    color: var(--ink);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.login-subtitle {
    color: var(--ink-muted);
    font-size: 15px;
    margin-bottom: 28px;
}

.login-help {
    margin-top: 24px;
    color: var(--ink-faint);
    font-size: 13px;
}

.login-sent-icon {
    color: var(--brand-green);
    margin: 0 auto 16px;
    width: 48px;
    height: 48px;
}


/* ----- Form fields --------------------------------------------------- */

.field {
    text-align: left;
    margin-bottom: 16px;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 6px;
}

.field-input {
    width: 100%;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    padding: 11px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:focus {
    outline: 0;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(15, 102, 72, 0.15);
}

.field-error {
    margin-top: 6px;
    font-size: 13px;
    color: var(--error);
}


/* ----- Buttons ------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    min-height: 44px;
}

.btn-primary {
    background: var(--brand-green);
    color: #ffffff;
    width: 100%;
}
.btn-primary:hover:not(:disabled) {
    background: var(--brand-green-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--line-strong);
}
.btn-secondary:hover:not(:disabled) {
    border-color: var(--brand-green);
    color: var(--brand-green);
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}


/* ----- Dashboard topbar ---------------------------------------------- */

.topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-logo-link {
    line-height: 0;
    text-decoration: none;
}
.topbar-logo-link:hover { opacity: 0.85; }

.topbar-logo {
    height: 28px;
    width: auto;
}

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border-radius: var(--radius-md);
}
.nav-toggle:hover {
    background: var(--brand-green-light);
}

.nav-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
}

.nav {
    display: block;
}

.nav-list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: inline-block;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s, color 0.15s;
}
.nav-link:hover {
    background: var(--brand-green-light);
    color: var(--brand-green);
    text-decoration: none;
}
.nav-link-active {
    color: var(--brand-green);
    background: var(--brand-green-light);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid var(--line);
}

.nav-email {
    font-size: 13px;
    color: var(--ink-faint);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-logout {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s, color 0.15s;
}
.nav-logout:hover:not(:disabled) {
    background: var(--brand-green-light);
    color: var(--brand-green);
}


/* ----- Dashboard content --------------------------------------------- */

.dashboard-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    max-width: var(--container);
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 600;
    font-size: 28px;
    line-height: 1.2;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--ink-muted);
    font-size: 15px;
}

.placeholder {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
}

.placeholder p {
    color: var(--ink-muted);
}

.placeholder-meta {
    margin-top: 8px;
    color: var(--ink-faint);
    font-size: 13px;
}


/* ----- Footer -------------------------------------------------------- */

.footer {
    border-top: 1px solid var(--line);
    padding: 20px 24px;
    text-align: center;
}

.footer-text {
    font-size: 12px;
    color: var(--ink-faint);
    margin: 2px 0;
}

.footer-text a {
    color: var(--ink-muted);
    text-decoration: none;
}
.footer-text a:hover {
    color: var(--brand-green);
    text-decoration: underline;
}


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

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 48px);
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand-green);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 12px 16px;
    font-size: 14px;
    color: var(--ink);
    max-width: 360px;
    transition: opacity 0.2s, transform 0.2s;
}
.toast-error {
    border-left-color: var(--error);
}
.toast-warn {
    border-left-color: var(--warn);
}
.toast-leave {
    opacity: 0;
    transform: translateX(20px);
}


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

@media (max-width: 720px) {
    .topbar-inner {
        padding: 10px 16px;
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: flex;
    }

    .nav {
        display: none;
        flex-basis: 100%;
        order: 3;
    }
    .nav.nav-open {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding-top: 12px;
        margin-top: 12px;
        border-top: 1px solid var(--line);
    }

    .nav-link {
        padding: 12px 12px;
        font-size: 15px;
    }

    .nav-user {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-left: 0;
        padding-left: 12px;
        border-left: 0;
        padding-top: 12px;
        border-top: 1px solid var(--line);
    }

    .content {
        padding: 24px 16px;
    }

    .page-title {
        font-size: 24px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .login-title {
        font-size: 24px;
    }
}
