:root {
    color-scheme: light;
    --navy: #15334b;
    --blue: #1f6d91;
    --blue-dark: #174f6a;
    --mint: #dcefe9;
    --paper: #f4f7f8;
    --white: #ffffff;
    --text: #1d2d38;
    --muted: #61717c;
    --line: #d9e2e6;
    --success: #2b765b;
    --error: #a33a3a;
    --shadow: 0 16px 38px rgba(21, 51, 75, 0.11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top right, rgba(220, 239, 233, 0.9), transparent 32rem),
        var(--paper);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.55;
}

a {
    color: var(--blue-dark);
}

button,
input,
select {
    font: inherit;
}

[hidden] {
    display: none !important;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 3.5rem);
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--navy);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.brand-pro {
    color: var(--blue);
}

.home-link {
    font-weight: 650;
    text-decoration: none;
}

.portal-main {
    width: min(70rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(2rem, 6vw, 5rem) 0;
    flex: 1;
}

.intro {
    max-width: 47rem;
    margin-bottom: 2rem;
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: var(--blue);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.75rem;
    color: var(--navy);
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.08;
}

h2,
h3 {
    color: var(--navy);
}

.panel,
.dashboard-heading,
.stat,
.location-group,
.order {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.panel {
    padding: clamp(1.25rem, 4vw, 2rem);
}

.auth-panel {
    max-width: 36rem;
}

form {
    display: grid;
    gap: 0.7rem;
}

.auth-honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

label {
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #aebdc5;
    border-radius: 0.65rem;
    background: var(--white);
    color: var(--text);
}

input:focus,
select:focus {
    outline: 3px solid rgba(31, 109, 145, 0.2);
    border-color: var(--blue);
}

button {
    min-height: 3rem;
    padding: 0.7rem 1rem;
    border: 0;
    border-radius: 0.65rem;
    background: var(--blue);
    color: var(--white);
    cursor: pointer;
    font-weight: 750;
}

button:hover {
    background: var(--blue-dark);
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.secondary-button {
    background: var(--white);
    color: var(--blue-dark);
    border: 1px solid var(--blue);
}

.text-button {
    min-height: auto;
    margin-top: 1rem;
    padding: 0;
    background: transparent;
    color: var(--blue-dark);
    text-decoration: underline;
}

.text-button:hover {
    background: transparent;
}

.message {
    max-width: 46rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
    background: var(--mint);
    color: var(--success);
    font-weight: 650;
}

.message.error {
    background: #f9e4e4;
    color: var(--error);
}

.admin-preview-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border: 2px solid #e19a35;
    border-radius: 0.85rem;
    background: #fff4df;
    color: #643d07;
    box-shadow: var(--shadow);
}

.admin-preview-banner div {
    display: grid;
    gap: 0.15rem;
}

.admin-preview-banner strong {
    color: #8a4e00;
    font-size: 1.05rem;
}

.admin-preview-banner a {
    flex: none;
    font-weight: 800;
}

.dashboard-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: clamp(1.25rem, 4vw, 2rem);
}

.dashboard-heading h2 {
    margin-bottom: 0.25rem;
}

.dashboard-heading p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}

.stat {
    padding: 1.25rem;
}

.stat span {
    display: block;
    color: var(--blue);
    font-size: 2rem;
    font-weight: 800;
}

.stat small {
    color: var(--muted);
    font-weight: 700;
}

.content-section {
    margin-top: 2.25rem;
}

.section-intro {
    max-width: 46rem;
    margin-bottom: 1rem;
    color: var(--muted);
}

.order-filter-panel {
    display: grid;
    grid-template-columns: minmax(15rem, 1fr) auto;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

.order-search,
.status-filter {
    display: grid;
    gap: 0.4rem;
}

.order-search span,
.status-filter > span {
    color: var(--navy);
    font-size: 0.86rem;
    font-weight: 800;
}

.status-filter-buttons {
    display: flex;
    gap: 0.4rem;
    padding: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: #f8fafb;
}

.status-filter-button {
    min-height: 2.5rem;
    padding: 0.5rem 0.8rem;
    background: transparent;
    color: var(--blue-dark);
}

.status-filter-button:hover {
    background: #e8f2f6;
}

.status-filter-button.is-active {
    background: var(--blue);
    color: var(--white);
}

.filter-result {
    grid-column: 1 / -1;
    margin: -0.15rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.location-list {
    display: grid;
    gap: 1.25rem;
}

.location-group {
    overflow: hidden;
}

.location-header {
    padding: 1.25rem;
}

.location-header h4 {
    margin: 0 0 0.25rem;
    color: var(--navy);
    font-size: 1.15rem;
}

.location-address {
    margin-bottom: 0;
    color: var(--muted);
}

.location-orders {
    padding: 1.25rem;
    border-top: 1px solid var(--line);
    background: #f8fafb;
}

.location-orders > h5 {
    margin: 0 0 0.85rem;
    color: var(--navy);
    font-size: 0.92rem;
}

.location-order-list,
.order-list {
    display: grid;
    gap: 0.85rem;
}

.order {
    padding: 1.25rem;
    box-shadow: none;
}

.order h4 {
    margin: 0 0 0.35rem;
    color: var(--navy);
    font-size: 1.05rem;
}

.order p {
    margin-bottom: 0;
}

.order-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.order-badges {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}

.order-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.status,
.access-badge {
    flex: none;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: #e8f2f6;
    color: var(--blue-dark);
    font-size: 0.78rem;
    font-weight: 800;
}

.access-badge {
    background: #fff0d6;
    color: #815006;
}

.status.done {
    background: var(--mint);
    color: var(--success);
}

.order.is-restricted {
    border-color: #d6b77f;
    background: #fffdf8;
}

.restricted-note {
    margin-top: 0.9rem;
    padding: 0.75rem 0.85rem;
    border-left: 3px solid #d6a34f;
    border-radius: 0.35rem;
    background: #fff7e8;
    color: #68430b;
    font-size: 0.9rem;
}

.order-files {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.order-files h5 {
    margin: 0 0 0.65rem;
    color: var(--navy);
    font-size: 0.9rem;
}

.file-list {
    display: grid;
    gap: 0.55rem;
}

.file-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
    padding: 0.55rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: #f8fafb;
}

.file-row.is-file-hidden {
    border-color: #d6b77f;
    background: #fff9ed;
}

.file-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: #f8fafb;
    color: var(--text);
    text-decoration: none;
}

.file-preview {
    width: 5.5rem;
    height: 4.25rem;
    flex: 0 0 5.5rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    background: var(--white);
    object-fit: cover;
}

.file-link.has-preview .file-details {
    margin-right: auto;
}

.admin-file-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 0.2rem 0.1rem;
}

.file-visibility {
    flex: none;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
}

.file-visibility.is-visible {
    background: var(--mint);
    color: var(--success);
}

.file-visibility.is-hidden {
    background: #fff0d6;
    color: #815006;
}

.admin-file-action-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
}

.admin-file-select {
    min-height: 2.5rem;
    max-width: 18rem;
    padding: 0.45rem 2rem 0.45rem 0.65rem;
    border: 1px solid #aebdc5;
    border-radius: 0.6rem;
    background: var(--white);
    color: var(--text);
}

.admin-location-save {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
    padding: 0.9rem 1rem;
    border: 1px solid #b7ccd6;
    border-radius: 0.8rem;
    background: #edf5f8;
}

.admin-location-save > div {
    display: grid;
    gap: 0.1rem;
}

.admin-location-save strong {
    color: var(--navy);
    font-size: 0.88rem;
}

.admin-location-save-summary {
    color: var(--muted);
    font-size: 0.82rem;
}

.admin-location-save-button {
    flex: none;
    min-height: 2.65rem;
    padding: 0.55rem 1rem;
}

.file-link:hover {
    border-color: var(--blue);
    background: #f0f6f8;
}

.file-details {
    display: grid;
    min-width: 0;
}

.file-details strong {
    overflow-wrap: anywhere;
    font-size: 0.92rem;
}

.file-details small {
    color: var(--muted);
}

.file-action {
    flex: none;
    color: var(--blue-dark);
    font-size: 0.88rem;
    font-weight: 800;
}

.empty {
    padding: 1rem;
    border: 1px dashed #aebdc5;
    border-radius: 0.75rem;
    color: var(--muted);
}

.empty.compact {
    margin: 0;
    background: rgba(255, 255, 255, 0.65);
}

.portal-footer {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    padding: 1.5rem;
    background: var(--white);
    border-top: 1px solid var(--line);
    font-size: 0.92rem;
}

@media (max-width: 38rem) {
    .dashboard-heading,
    .order-head,
    .admin-preview-banner {
        align-items: stretch;
        flex-direction: column;
    }

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

    .order-filter-panel {
        grid-template-columns: 1fr;
    }

    .status-filter-buttons {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .status-filter-button {
        padding-inline: 0.4rem;
    }

    .order-badges {
        justify-content: flex-start;
    }

    .file-link {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 0.35rem;
    }

    .file-link:not(.has-preview) {
        display: flex;
        align-items: flex-start;
        flex-direction: column;
    }

    .file-link.has-preview .file-action {
        grid-column: 2;
    }

    .admin-file-controls,
    .admin-file-action-group,
    .admin-location-save {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-file-select {
        width: 100%;
        max-width: none;
    }

    .admin-location-save-button {
        width: 100%;
    }
}
