:root {
    color-scheme: dark;

    --bg: #0c0d12;
    --panel: #15171f;
    --panel-2: #1b1e28;
    --border: #292d39;
    --text: #f5f5f7;
    --muted: #979cab;
    --purple: #9c7cff;
    --purple-soft: rgba(156, 124, 255, 0.14);
    --green: #68d391;
    --green-soft: rgba(104, 211, 145, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at top right,
            rgba(156, 124, 255, 0.08),
            transparent 32rem
        ),
        var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

.topbar {
    height: 78px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(12, 13, 18, 0.88);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.brand-mark {
    width: 43px;
    height: 43px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: var(--purple-soft);
    border: 1px solid rgba(156, 124, 255, 0.25);
}

.brand-name {
    font-weight: 900;
    letter-spacing: 0.14em;
    font-size: 14px;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

.user-pill,
.version {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.page {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 54px 0;
}

.hero {
    min-height: 220px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.eyebrow,
.panel-kicker {
    color: var(--purple);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.hero h1 {
    margin: 10px 0 10px;
    font-size: clamp(34px, 6vw, 60px);
    line-height: 1;
    letter-spacing: -0.04em;
}

.hero p {
    margin: 0;
    max-width: 620px;
    color: var(--muted);
    line-height: 1.7;
}

.paw {
    font-size: clamp(64px, 10vw, 110px);
    opacity: 0.16;
    transform: rotate(12deg);
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin: 12px 0 18px;
}

.stat-card,
.panel,
.coming-soon {
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,0.025),
            transparent
        ),
        var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.stat-card {
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--panel-2);
    font-size: 22px;
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 850;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.panel {
    padding: 25px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 30px;
}

.panel-heading h2,
.coming-soon h2 {
    margin: 5px 0 0;
    font-size: 18px;
}

.badge {
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.purple {
    color: #c7b8ff;
    background: var(--purple-soft);
}

.badge.green {
    color: var(--green);
    background: var(--green-soft);
}

.book-title {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.25;
}

.muted {
    margin-top: 6px;
    color: var(--muted);
}

.date-row {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted);
    font-size: 13px;
}

.date-row strong {
    color: var(--text);
    text-align: right;
}

.empty {
    color: var(--muted);
    line-height: 1.7;
    padding: 10px 0;
}

.coming-soon {
    margin-top: 18px;
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 25px;
}

.coming-soon p {
    color: var(--muted);
    margin: 9px 0 0;
    line-height: 1.6;
}

footer {
    text-align: center;
    color: #666b78;
    font-size: 11px;
    padding: 12px 20px 35px;
}

@media (max-width: 700px) {
    .topbar {
        height: 70px;
        padding: 0 16px;
    }

    .brand-subtitle {
        display: none;
    }

    .page {
        width: min(100% - 24px, 1080px);
        padding: 28px 0;
    }

    .hero {
        min-height: 180px;
    }

    .paw {
        display: none;
    }

    .stats,
    .grid {
        grid-template-columns: 1fr;
    }

    .coming-soon {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* Authentication */

.brand-link {
    color: inherit;
    text-decoration: none;
}

.account {
    display: flex;
    align-items: center;
    gap: 11px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--panel-2);
}

.avatar-fallback {
    display: grid;
    place-items: center;
    font-size: 17px;
}

.account-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

.account-text strong {
    font-size: 13px;
}

.account-text a {
    color: var(--muted);
    text-decoration: none;
}

.account-text a:hover {
    color: var(--text);
}

.login-wrap {
    min-height: calc(100vh - 220px);
    display: grid;
    place-items: center;
    padding: 50px 0;
}

.login-card {
    width: min(480px, 100%);
    padding: 42px;
    text-align: center;
    border-radius: 24px;
    border: 1px solid var(--border);
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,0.03),
            transparent
        ),
        var(--panel);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.28);
}

.login-paw {
    width: 68px;
    height: 68px;
    margin: 0 auto 25px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    font-size: 32px;
    background: var(--purple-soft);
    border:
        1px solid
        rgba(156, 124, 255, 0.24);
}

.login-card h1 {
    margin: 10px 0 12px;
    font-size: 31px;
    letter-spacing: -0.035em;
}

.login-card p {
    margin: 0 auto;
    max-width: 380px;
    color: var(--muted);
    line-height: 1.7;
}

.discord-button,
.secondary-button {
    min-height: 48px;
    margin-top: 28px;
    padding: 0 20px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: white;
    text-decoration: none;
    font-weight: 750;
    font-size: 14px;
    transition:
        transform 120ms ease,
        filter 120ms ease;
}

.discord-button {
    background: #5865f2;
}

.secondary-button {
    background: var(--panel-2);
    border: 1px solid var(--border);
}

.discord-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.login-note {
    margin-top: 22px;
    color: #6f7482;
    font-size: 11px;
    line-height: 1.6;
}

@media (max-width: 700px) {
    .account-text strong {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .login-wrap {
        padding: 25px 0;
    }

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


/* Phase 3 navigation + records */

.nav {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    margin-right: 28px;
}

.nav a {
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
}

.nav a:hover {
    color: var(--text);
    background: var(--panel);
}

.nav a.active {
    color: var(--text);
    background: var(--purple-soft);
}

.compact-hero {
    min-height: 190px;
}

.card-link {
    color: inherit;
    text-decoration: none;
    transition:
        border-color 120ms ease,
        transform 120ms ease;
}

.card-link:hover {
    border-color:
        rgba(156, 124, 255, 0.38);
    transform: translateY(-1px);
}

.attention-banner {
    margin-bottom: 18px;
    padding: 17px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 16px;
    border:
        1px solid
        rgba(255, 107, 107, 0.24);
    background:
        rgba(255, 107, 107, 0.07);
}

.attention-icon {
    font-size: 22px;
}

.attention-banner strong,
.attention-banner span {
    display: block;
}

.attention-banner span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.deadline-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.035em;
    white-space: nowrap;
}

.deadline-badge.danger,
.mini-status.danger {
    color: #ff8585;
    background:
        rgba(255, 107, 107, 0.12);
}

.deadline-badge.warning,
.mini-status.warning {
    color: #ffca70;
    background:
        rgba(255, 190, 92, 0.12);
}

.deadline-badge.soon,
.mini-status.soon {
    color: #c6b8ff;
    background: var(--purple-soft);
}

.deadline-badge.normal,
.mini-status.normal {
    color: var(--green);
    background: var(--green-soft);
}

.page-heading {
    padding: 35px 0 32px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 25px;
}

.page-heading h1 {
    margin: 7px 0 8px;
    font-size: clamp(34px, 5vw, 48px);
    letter-spacing: -0.04em;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.count-pill {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.list-stack {
    display: grid;
    gap: 15px;
}

.record-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,0.025),
            transparent
        ),
        var(--panel);
}

.record-main {
    padding: 25px;
}

.record-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 25px;
}

.record-title-row h2 {
    margin: 0;
    font-size: 21px;
}

.status-line {
    margin-bottom: 7px;
    color: var(--green);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.13em;
}

.active-dot {
    margin-right: 4px;
}

.record-details {
    margin-top: 22px;
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.record-details .detail {
    padding: 17px 20px 17px 0;
}

.record-details .detail + .detail {
    padding-left: 20px;
    border-left: 1px solid var(--border);
}

.detail span,
.record-meta span,
.notes > span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 6px;
}

.detail strong {
    display: block;
    font-size: 13px;
}

.mini-status {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 7px;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 800;
}

.record-meta {
    padding-top: 17px;
    display: flex;
    gap: 30px;
}

.record-meta div {
    min-width: 100px;
}

.record-meta strong {
    font-size: 13px;
}

.notes {
    margin-top: 18px;
    padding: 15px 17px;
    border-radius: 12px;
    background: var(--panel-2);
}

.notes p {
    margin: 0;
    line-height: 1.55;
    font-size: 13px;
}

.empty-state {
    padding: 70px 25px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--panel);
}

.empty-state > div {
    font-size: 38px;
}

.empty-state h2 {
    margin: 15px 0 8px;
}

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

.history-section {
    margin-top: 45px;
}

.section-heading {
    margin-bottom: 14px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.section-heading h2 {
    margin: 5px 0 0;
}

.history-list {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel);
}

.history-row {
    padding: 16px 19px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.history-row + .history-row {
    border-top: 1px solid var(--border);
}

.history-row strong,
.history-row span {
    display: block;
}

.history-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.history-date {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

@media (max-width: 850px) {
    .topbar {
        height: auto;
        min-height: 70px;
        flex-wrap: wrap;
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .nav {
        order: 3;
        width: 100%;
        margin: 0;
        justify-content: center;
        border-top: 1px solid var(--border);
        padding-top: 9px;
    }

    .record-details {
        grid-template-columns: 1fr;
    }

    .record-details .detail {
        padding: 14px 0;
    }

    .record-details .detail + .detail {
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 600px) {
    .page-heading,
    .record-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .record-title-row {
        gap: 15px;
    }

    .history-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-date {
        white-space: normal;
    }
}


/* Phase 4A forms + actions */

.heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.button {
    min-height: 43px;
    padding: 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 11px;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition:
        transform 120ms ease,
        filter 120ms ease,
        border-color 120ms ease;
}

.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.button.primary {
    color: #fff;
    background: #6f5be7;
}

.button.secondary {
    color: var(--text);
    background: var(--panel-2);
    border: 1px solid var(--border);
}

.button.small {
    min-height: 35px;
    padding: 0 12px;
    font-size: 11px;
}

.record-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.form-panel {
    max-width: 820px;
    margin: 0 auto 45px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,0.025),
            transparent
        ),
        var(--panel);
}

.form-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.field {
    display: block;
}

.field.full {
    grid-column: 1 / -1;
}

.field > span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.field input,
.field textarea {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.field input {
    height: 44px;
    padding: 0 13px;
}

.field textarea {
    min-height: 115px;
    padding: 12px 13px;
    resize: vertical;
    line-height: 1.55;
}

.field input:focus,
.field textarea:focus {
    border-color:
        rgba(156, 124, 255, 0.7);
    box-shadow:
        0 0 0 3px
        rgba(156, 124, 255, 0.09);
}

.form-actions {
    margin-top: 24px;
    padding-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
}

.form-error {
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: 11px;
    border:
        1px solid
        rgba(255, 107, 107, 0.28);
    background:
        rgba(255, 107, 107, 0.08);
    color: #ff9a9a;
    font-size: 13px;
}

.flash-stack {
    margin-top: 20px;
}

.flash {
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    background: var(--panel);
}

.flash.success {
    border-color:
        rgba(84, 214, 151, 0.24);
    background:
        rgba(84, 214, 151, 0.07);
}

@media (max-width: 650px) {
    .heading-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

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

    .field.full {
        grid-column: auto;
    }

    .form-panel {
        padding: 20px;
    }
}


/* Phase 4B destructive/state actions */

.button.danger {
    color: #fff;
    background: #b93f4b;
}

.button.danger-outline {
    color: #ff858e;
    background:
        rgba(185, 63, 75, 0.07);
    border:
        1px solid
        rgba(255, 105, 115, 0.24);
}

.button.success-outline {
    color: #65dda4;
    background:
        rgba(84, 214, 151, 0.06);
    border:
        1px solid
        rgba(84, 214, 151, 0.22);
}

.history-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.confirm-wrap {
    max-width: 720px;
    margin: 65px auto;
}

.confirm-card {
    padding: 38px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,0.025),
            transparent
        ),
        var(--panel);
}

.confirm-card h1 {
    margin: 8px 0 12px;
    font-size: 34px;
}

.confirm-icon,
.danger-icon {
    margin-bottom: 15px;
    font-size: 38px;
}

.danger-text {
    color: #ff7d86;
}

.confirm-lead,
.confirm-note,
.confirm-warning {
    color: var(--muted);
    line-height: 1.6;
}

.confirm-record {
    margin: 22px 0;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--panel-2);
}

.confirm-record strong {
    font-size: 18px;
}

.confirm-record span {
    color: var(--muted);
    font-size: 12px;
}

.confirm-warning {
    padding: 13px 15px;
    border:
        1px solid
        rgba(255, 105, 115, 0.20);
    border-radius: 11px;
    background:
        rgba(185, 63, 75, 0.06);
    color: #f4a1a7;
}

.confirm-actions {
    margin-top: 26px;
    padding-top: 22px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
}

.error-page {
    max-width: 720px;
    margin: 90px auto;
    text-align: center;
}

.error-code {
    margin-bottom: 10px;
    color:
        rgba(156, 124, 255, 0.16);
    font-size: 100px;
    font-weight: 900;
    line-height: 0.9;
}

.error-page h1 {
    margin: 12px 0;
    font-size: 38px;
}

.error-page p {
    color: var(--muted);
    line-height: 1.6;
}

.error-page .muted-copy {
    max-width: 520px;
    margin: 0 auto 28px;
    opacity: 0.8;
}

@media (max-width: 750px) {
    .history-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 650px) {
    .confirm-wrap {
        margin: 30px auto;
    }

    .confirm-card {
        padding: 23px;
    }

    .confirm-actions {
        flex-direction: column-reverse;
    }

    .confirm-actions .button {
        width: 100%;
    }
}

/* Stage completion controls */
.record-details .detail form {
    margin-top: 12px;
}
