:root {
    --bg: #f4f7f2;
    --surface: #ffffff;
    --ink: #17241d;
    --muted: #65746c;
    --line: #dfe7dd;
    --green: #176c43;
    --blue: #185ea8;
    --yellow: #f4b840;
    --red: #bf3b3b;
    --shadow: 0 16px 38px rgba(24, 54, 39, .12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .14) 49.85%, rgba(255, 255, 255, .46) 50%, rgba(255, 255, 255, .14) 50.15%),
        radial-gradient(circle at 50% 50%, transparent 0 82px, rgba(255, 255, 255, .5) 84px 86px, transparent 88px),
        linear-gradient(rgba(255, 255, 255, .34), rgba(255, 255, 255, .34)),
        repeating-linear-gradient(90deg, #1f7d45 0 110px, #23884d 110px 220px);
    background-attachment: fixed;
    font-family: Arial, Helvetica, sans-serif;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px clamp(18px, 4vw, 48px);
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #fff;
    background: var(--green);
    border-radius: 8px;
}

.nav-links {
    align-items: center;
    display: flex;
    gap: 8px;
}

.nav-links a,
.nav-action-form button {
    color: var(--muted);
    padding: 10px 12px;
    background: transparent;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
}

.nav-links a:hover,
.nav-action-form button:hover {
    color: var(--green);
    background: #edf5ef;
}

.nav-action-form {
    margin: 0;
}

.nav-action-form button {
    color: #fff;
    background: var(--green);
}

.nav-action-form button:hover {
    color: #fff;
    background: #145b39;
}

.nav-links .logout-link {
    color: #8d2525;
}

.nav-links .logout-link:hover {
    color: #8d2525;
    background: #fff0f0;
}

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

.login-shell {
    width: min(100%, 460px);
}

.login-panel {
    display: grid;
    gap: 18px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-panel h1 {
    margin: 0;
    font-size: 36px;
}

.login-panel p,
.login-panel small {
    margin: 8px 0 0;
    color: var(--muted);
}

.login-form,
.password-request-form,
.user-form {
    display: grid;
    gap: 12px;
}

.login-form label,
.password-request-form label,
.user-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.login-form input,
.password-request-form input,
.user-form input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    color: var(--ink);
    background: #fbfdfb;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.login-form button,
.password-request-form button,
.user-form button {
    min-height: 44px;
    padding: 0 16px;
    color: #fff;
    background: var(--green);
    border-radius: 8px;
    font-weight: 800;
}

.password-request-form {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.password-request-form button {
    color: var(--green);
    background: #edf5ef;
}

.inline-password-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 72px;
    gap: 6px;
}

.inline-password-form input {
    min-width: 0;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.inline-password-form button {
    height: 34px;
    color: #fff;
    background: var(--green);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.period-actions {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.period-actions form {
    margin: 0;
}

.period-actions button {
    height: 34px;
    padding: 0 9px;
    color: #fff;
    background: var(--blue);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.user-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.user-status.online {
    color: #145b3b;
    background: #ecf8f1;
    border: 1px solid #bfe5ce;
}

.user-status.offline {
    color: var(--muted);
    background: #f1f4f1;
    border: 1px solid var(--line);
}

.delete-user-form {
    margin: 0;
}

.delete-user-form button {
    height: 34px;
    padding: 0 10px;
    color: #fff;
    background: var(--red);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 28px;
    align-items: stretch;
    padding: clamp(26px, 4vw, 48px);
    color: #fff;
    background:
        linear-gradient(135deg, rgba(23, 108, 67, .96), rgba(24, 94, 168, .92)),
        url('https://images.unsplash.com/photo-1508098682722-e99c43a406b2?auto=format&fit=crop&w=1400&q=80');
    background-position: center;
    background-size: cover;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--yellow);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 700px;
    margin: 0;
    font-size: clamp(32px, 5vw, 62px);
    line-height: 1.02;
}

.hero-copy {
    max-width: 620px;
    margin: 18px 0 0;
    color: rgba(255, 255, 255, .88);
    font-size: 18px;
    line-height: 1.6;
}

.trial-note {
    display: inline-flex;
    margin: 16px 0 0;
    padding: 9px 12px;
    color: #17241d;
    background: var(--yellow);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
}

.progress-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    min-height: 210px;
    padding: 26px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
}

.progress-panel span {
    font-size: 52px;
    font-weight: 900;
}

.progress {
    height: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, .24);
    border-radius: 999px;
}

.progress div {
    height: 100%;
    background: var(--yellow);
}

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

.stat-card,
.toolbar,
.form-section,
.quick-actions,
.album-sheet,
.summary-section,
.alert {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(32, 48, 38, .06);
}

.summary-section {
    margin: 0 0 28px;
    padding: 18px;
}

.quick-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 16px;
    margin: 0 0 22px;
    padding: 14px 16px;
}

.duplicate-adjust-form {
    display: grid;
    grid-template-columns: 130px 120px 130px 180px;
    gap: 10px;
    align-items: end;
}

.duplicate-adjust-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.duplicate-adjust-form input {
    width: 100%;
    height: 42px;
    padding: 0 10px;
    color: var(--ink);
    background: #fbfdfb;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-transform: uppercase;
}

.duplicate-adjust-form button {
    height: 42px;
    padding: 0 16px;
    color: #fff;
    background: var(--green);
    border-radius: 8px;
    font-weight: 800;
}

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

.album-sheet {
    margin: 0 0 22px;
    padding: 18px;
}

.sheet-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.sheet-heading h2 {
    margin: 0;
    font-size: 28px;
    text-transform: uppercase;
}

.print-summary-button {
    min-height: 40px;
    padding: 0 14px;
    color: #fff;
    background: var(--blue);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.print-summary-meta,
.print-summary-footer {
    display: none;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.missing-dot {
    background: #fff;
    border: 1px solid var(--line);
}

.owned-dot {
    background: var(--green);
}

.repeated-dot {
    background: var(--yellow);
}

.sheet-scroll {
    overflow-x: auto;
    border: 1px solid var(--ink);
    border-radius: 4px;
}

.summary-scroll {
    overflow-x: auto;
}

.summary-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: #fff;
    font-size: 14px;
}

.summary-table th,
.summary-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.summary-table th {
    color: #fff;
    background: #17241d;
    font-size: 12px;
    text-transform: uppercase;
}

.summary-table td:not(:first-child),
.summary-table th:not(:first-child) {
    text-align: center;
}

.summary-table strong,
.summary-table span {
    display: block;
}

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

.mini-progress {
    width: 76px;
    height: 7px;
    margin: 0 auto 5px;
    overflow: hidden;
    background: #e9eee9;
    border-radius: 999px;
}

.mini-progress span {
    display: block;
    height: 100%;
    margin: 0;
    background: var(--green);
}

.sheet-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
    background: #fff;
    font-size: 11px;
}

.sheet-table th,
.sheet-table td {
    height: 24px;
    padding: 2px;
    text-align: center;
    border: 1px solid #3a413b;
}

.sheet-table th {
    color: #fff;
    background: #17241d;
    font-weight: 800;
    text-transform: uppercase;
}

.group-cell {
    width: 58px;
    background: #eef2ee;
    font-weight: 900;
    text-transform: uppercase;
}

.team-cell {
    width: 138px;
    text-align: right;
    font-weight: 800;
    text-transform: uppercase;
}

.abbr-cell {
    width: 42px;
    font-weight: 900;
}

.sheet-cell-form {
    margin: 0;
}

.sheet-cell-actions {
    position: relative;
}

.sheet-cell {
    position: relative;
    display: grid;
    width: 100%;
    min-width: 28px;
    height: 21px;
    place-items: center;
    color: var(--ink);
    background: #fff;
    border: 0;
    border-radius: 0;
    font-size: 10px;
    font-weight: 800;
}

.sheet-cell.owned {
    color: #fff;
    background: var(--green);
}

.sheet-cell.repeated {
    color: #17241d;
    background: var(--yellow);
}

.sheet-cell small {
    position: absolute;
    top: -2px;
    right: 2px;
    font-size: 8px;
}

.sheet-cell-remove-form {
    position: absolute;
    top: 1px;
    left: 1px;
    display: none;
    margin: 0;
}

.sheet-cell-actions:hover .sheet-cell-remove-form,
.sheet-cell-remove-form:focus-within {
    display: block;
}

.sheet-cell-remove {
    display: grid;
    width: 13px;
    height: 13px;
    place-items: center;
    padding: 0;
    color: #fff;
    background: var(--red);
    border-radius: 2px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.sheet-cell-remove:hover,
.sheet-cell-remove:focus {
    outline: 2px solid #fff;
    outline-offset: -1px;
}

.stat-card {
    padding: 22px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    font-size: 38px;
}

.alert {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    padding: 16px 18px;
}

.alert.success {
    color: #145b3b;
    background: #ecf8f1;
    border-color: #bfe5ce;
}

.alert.danger {
    color: #8d2525;
    background: #fff0f0;
    border-color: #f2c1c1;
}

.toolbar {
    margin-bottom: 18px;
    padding: 16px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 170px 120px;
    gap: 10px;
}

.filters input,
.filters select,
.sticker-form input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    color: var(--ink);
    background: #fbfdfb;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
}

.filters input:focus,
.filters select:focus,
.sticker-form input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(23, 108, 67, .12);
}

.filters button,
.form-actions button:last-child {
    color: #fff;
    background: var(--green);
    border-radius: 8px;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
    gap: 14px;
}

.sticker-card {
    display: grid;
    gap: 12px;
    min-height: 215px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 5px solid var(--red);
    border-radius: 8px;
}

.sticker-card.owned {
    border-top-color: var(--green);
}

.sticker-card.repeated {
    border-top-color: var(--yellow);
}

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

.sticker-top span {
    color: var(--blue);
    font-weight: 800;
}

.edit-button,
.form-actions button:first-child {
    color: var(--green);
    background: #edf5ef;
    border-radius: 8px;
}

.edit-button {
    padding: 8px 10px;
    font-size: 13px;
}

.sticker-card h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
}

.sticker-card p,
.sticker-card small {
    margin: 0;
    color: var(--muted);
}

.counter-form {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    gap: 8px;
    align-items: center;
}

.counter-form button {
    height: 42px;
    color: #fff;
    background: var(--blue);
    border-radius: 8px;
    font-size: 22px;
    font-weight: 800;
}

.counter-form span {
    display: grid;
    height: 42px;
    place-items: center;
    background: #f7faf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 800;
}

.duplicate-form {
    margin: 0;
}

.duplicate-form button {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    color: #7b4f00;
    background: #fff4d7;
    border: 1px solid #f1d184;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.form-section {
    display: grid;
    gap: 18px;
    margin-top: 28px;
    padding: 22px;
}

.form-section h2 {
    margin: 0;
}

.sticker-form {
    display: grid;
    grid-template-columns: 120px 150px repeat(3, minmax(150px, 1fr));
    gap: 12px;
}

.user-form {
    grid-template-columns: repeat(3, minmax(160px, 1fr)) 180px;
    align-items: end;
}

.sticker-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form-actions {
    display: grid;
    grid-template-columns: 110px 150px;
    gap: 10px;
    align-items: end;
}

.form-actions button {
    height: 44px;
    padding: 0 14px;
}

.footer {
    padding: 22px 16px;
    color: #fff;
    text-align: center;
    background: #17241d;
}

@media (max-width: 900px) {
    .hero,
    .cards,
    .quick-actions,
    .duplicate-adjust-form,
    .filters,
    .sheet-heading,
    .sticker-form,
    .user-form {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        align-items: stretch;
    }

    .sheet-heading {
        display: grid;
    }

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

    .nav-links {
        flex-wrap: wrap;
    }

    .progress-panel {
        min-height: 170px;
    }
}

@media (max-width: 520px) {
    .page {
        width: min(100% - 20px, 1180px);
        padding-top: 12px;
    }

    .hero {
        padding: 22px;
    }

    .hero h1 {
        font-size: 34px;
    }

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

@media print {
    @page {
        size: A4 portrait;
        margin: 4mm;
    }

    body {
        min-height: auto;
        color: #000;
        background: #fff;
        font-size: 8px;
    }

    .topbar,
    .hero,
    .alert,
    .cards,
    .quick-actions,
    .album-sheet,
    .form-section,
    .footer {
        display: none !important;
    }

    .page {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .summary-section {
        position: static;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        background: #fff;
        border: 0;
        box-shadow: none;
        page-break-after: avoid;
    }

    .summary-section .eyebrow,
    .print-summary-button,
    .mini-progress {
        display: none;
    }

    .summary-section .sheet-heading {
        display: block;
        margin: 0 0 4px;
    }

    .summary-section .sheet-heading h2 {
        color: #000;
        font-size: 12px;
        text-align: center;
    }

    .print-summary-meta {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        margin-top: 2px;
        color: #000;
        font-size: 8px;
        font-weight: 700;
    }

    .summary-scroll {
        overflow: visible;
    }

    .summary-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        border-collapse: collapse;
        font-size: 7px;
        page-break-inside: avoid;
    }

    .summary-table th,
    .summary-table td {
        padding: 1px 2px;
        color: #000;
        border: 1px solid #777;
        line-height: 1;
        page-break-inside: avoid;
    }

    .summary-table th {
        background: #e8e8e8;
        font-size: 6.8px;
    }

    .summary-table td:first-child,
    .summary-table th:first-child {
        width: 28%;
        text-align: left;
    }

    .summary-table td:nth-child(2),
    .summary-table th:nth-child(2) {
        width: 8%;
    }

    .summary-table td:nth-child(3),
    .summary-table th:nth-child(3),
    .summary-table td:nth-child(4),
    .summary-table th:nth-child(4),
    .summary-table td:nth-child(5),
    .summary-table th:nth-child(5),
    .summary-table td:nth-child(6),
    .summary-table th:nth-child(6) {
        width: 9%;
    }

    .summary-table td:nth-child(7),
    .summary-table th:nth-child(7) {
        width: 7%;
    }

    .summary-table strong,
    .summary-table span {
        color: #000;
        font-size: inherit;
        line-height: 1;
    }

    .summary-table span {
        display: block;
        margin-top: 1px;
        font-size: 6px;
        font-weight: 700;
    }

    .print-summary-footer {
        display: block;
        margin-top: 3px;
        padding-top: 2px;
        color: #000;
        border-top: 1px solid #777;
        font-size: 8px;
        font-weight: 800;
        text-align: center;
    }
}
