:root {
    --bg: #f4f5f1;
    --surface: #ffffff;
    --surface-soft: #f8faf7;
    --text: #20231f;
    --muted: #687069;
    --line: #dfe4dc;
    --primary: #2f6f58;
    --primary-strong: #245743;
    --accent: #b66a3c;
    --danger: #ad3f3f;
    --warning: #9f7a23;
    --shadow: 0 14px 34px rgba(35, 39, 33, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.auth-link {
    color: var(--primary-strong);
    font-weight: 700;
}

.auth-link:hover {
    text-decoration: underline;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: #20231f;
    color: #f8faf7;
    padding: 22px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    margin-bottom: 28px;
}

.brand-mark,
.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
}

.brand-logo {
    object-fit: contain;
    background: #ffffff;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
}

.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #dde5dd;
}

.nav-link:hover,
.nav-link.active {
    background: #32372f;
    color: #ffffff;
}

.nav-link.disabled {
    color: #9aa59b;
    cursor: default;
}

.main-column {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.eyebrow {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 13px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-meta {
    display: grid;
    text-align: right;
    font-size: 14px;
}

.user-meta span {
    color: var(--muted);
}

.content {
    padding: 28px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card,
.panel,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat-card {
    display: grid;
    gap: 4px;
    min-height: 124px;
    padding: 18px;
}

.stat-card span,
.stat-card small,
.muted {
    color: var(--muted);
}

.stat-card strong {
    font-size: 30px;
}

.stat-card .stat-text {
    font-size: 18px;
    overflow-wrap: anywhere;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
    gap: 16px;
}

.section-gap {
    margin-top: 16px;
}

.panel {
    padding: 18px;
}

.panel.narrow {
    max-width: 920px;
}

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

.panel-heading h2 {
    margin: 0;
    font-size: 19px;
}

.action-list,
.form-stack {
    display: grid;
    gap: 12px;
}

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

.action-row:first-child,
.list-row:first-of-type {
    border-top: 0;
}

.list-row div {
    display: grid;
    gap: 2px;
}

.list-row span,
td small {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f0eadf;
    color: #61452c;
    font-size: 12px;
    white-space: nowrap;
}

.status-active {
    background: #edf8f1;
    color: #245743;
}

.status-inactive {
    background: #fff1f1;
    color: var(--danger);
}

.role-admin {
    background: #e8f1f4;
    color: #294b5a;
}

.role-company_owner {
    background: #f0eadf;
    color: #61452c;
}

.role-company_employee {
    background: #edf2ea;
    color: #40583e;
}

.review-valid {
    background: #edf8f1;
    color: #245743;
}

.review-expiring {
    background: #fff6df;
    color: #7a5616;
}

.review-expired {
    background: #fff1f1;
    color: var(--danger);
}

.review-no_review {
    background: #eef0ee;
    color: #5a625b;
}

.order-new {
    background: #e8f1f4;
    color: #294b5a;
}

.order-in-progress {
    background: #fff6df;
    color: #7a5616;
}

.order-completed {
    background: #edf8f1;
    color: #245743;
}

.order-cancelled {
    background: #fff1f1;
    color: var(--danger);
}

.notification-sent {
    background: #edf8f1;
    color: #245743;
}

.notification-failed {
    background: #fff1f1;
    color: var(--danger);
}

.notification-skipped {
    background: #eef0ee;
    color: #5a625b;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

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

.button.ghost {
    background: transparent;
}

.button.danger {
    border-color: #e7c6c6;
    background: #fff1f1;
    color: var(--danger);
}

.button.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 14px;
}

.button.full {
    width: 100%;
}

.alert {
    margin: 18px 28px 0;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid;
}

.alert.success {
    background: #edf8f1;
    border-color: #b9ddc3;
    color: #245743;
}

.alert.error {
    background: #fff3f0;
    border-color: #efc5bb;
    color: #833424;
}

.alert ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

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

.filter-bar {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(180px, 0.5fr) minmax(160px, 0.45fr) auto auto;
    gap: 10px;
    margin-bottom: 14px;
}

.filter-bar.compact-filter {
    grid-template-columns: minmax(220px, 1fr) auto auto;
}

.filter-bar.notification-filter {
    grid-template-columns: minmax(180px, 1fr) minmax(170px, 0.7fr) minmax(160px, 0.7fr) minmax(150px, 0.65fr) minmax(150px, 0.65fr) auto auto;
}

.filter-bar.wide-filter {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.filter-bar .button {
    min-width: 92px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

label span {
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 11px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

.field-hint {
    color: var(--muted);
    font-weight: 400;
}

textarea {
    resize: vertical;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

.settings-group {
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.settings-group:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.settings-group h3 {
    margin: 0;
    font-size: 17px;
}

.settings-group p {
    margin: 4px 0 0;
    color: var(--muted);
}

.logo-preview {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.logo-preview img {
    max-width: 180px;
    max-height: 72px;
    object-fit: contain;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

td small {
    display: block;
    margin-top: 4px;
}

.actions-cell {
    width: 160px;
    text-align: right;
}

.actions-cell form {
    display: inline-flex;
    margin-left: 6px;
}

.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.deploy-page {
    min-height: 100vh;
    padding: 24px;
    background: var(--bg);
}

.deploy-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.deploy-warning {
    margin: 0;
}

.deploy-checks,
.deploy-actions {
    display: grid;
    gap: 10px;
}

.deploy-check {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.deploy-check:first-child {
    border-top: 0;
}

.deploy-check p {
    margin: 2px 0 0;
    color: var(--muted);
}

.deploy-actions form,
.deploy-actions button {
    width: 100%;
}

.deploy-output {
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    margin: 10px 0 0;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
}

.auth-card {
    width: min(420px, 100%);
    padding: 24px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-brand h1 {
    margin: 0;
    font-size: 24px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.form-checkbox {
    align-self: end;
    min-height: 42px;
}

.checkbox-line input {
    width: auto;
}

.details-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.details-list div {
    display: grid;
    grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.details-list div:first-child {
    border-top: 0;
}

.details-list dt {
    color: var(--muted);
    font-weight: 700;
}

.details-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.compact-details {
    margin-top: 8px;
}

.inline-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.file-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.file-card img,
.pdf-tile {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 6px;
    object-fit: cover;
    background: #e8ece6;
}

.pdf-tile {
    display: grid;
    place-items: center;
    color: var(--danger);
    font-weight: 700;
}

.file-meta {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.file-meta strong {
    overflow-wrap: anywhere;
    font-size: 14px;
}

.file-meta a {
    color: var(--primary);
    font-size: 14px;
}

.review-row {
    display: grid;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.review-row:first-of-type {
    border-top: 0;
}

.review-row-main {
    display: grid;
    grid-template-columns: minmax(170px, 0.35fr) minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: start;
}

.review-row-main div {
    display: grid;
    gap: 3px;
}

.review-row-main span {
    color: var(--muted);
}

.review-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.status-actions form {
    display: inline-flex;
}

.token-box {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.instruction-text {
    margin: 0;
    font-weight: 700;
}

.public-card {
    width: min(620px, 100%);
}

nav[role="navigation"] {
    margin-top: 16px;
}

nav[role="navigation"] > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

nav[role="navigation"] a,
nav[role="navigation"] span {
    font-size: 14px;
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .sidebar-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid,
    .two-column,
    .form-grid,
    .filter-bar,
    .filter-bar.compact-filter,
    .filter-bar.wide-filter,
    .inline-upload {
        grid-template-columns: 1fr;
    }

    .review-row-main {
        grid-template-columns: 1fr;
    }

    .review-actions {
        justify-content: flex-start;
    }

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

    .user-meta {
        text-align: left;
    }
}

@media (max-width: 560px) {
    .content,
    .topbar {
        padding: 18px;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

    .actions-cell {
        width: auto;
    }
}
