:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef8f6;
    --ink: #152126;
    --muted: #65747b;
    --line: #dce5e8;
    --brand: #12a79d;
    --brand-dark: #0f3d3d;
    --accent: #f2b84b;
    --danger: #d84f64;
    --success: #178b66;
    --shadow: 0 18px 50px rgba(22, 37, 43, 0.11);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

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

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

button,
input,
select,
textarea {
    font: inherit;
    min-width: 0;
}

.auth-body {
    background:
        radial-gradient(circle at top left, rgba(18, 167, 157, 0.14), transparent 30rem),
        linear-gradient(135deg, #ffffff 0%, #eef8f6 48%, #f5f7fb 100%);
}

.auth-wrap {
    display: grid;
    width: 100%;
    min-height: 100vh;
    place-items: center;
    padding: 32px;
}

.auth-card {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(420px, 1fr);
    width: min(1120px, 100%);
    min-height: 620px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(15, 61, 61, 0.12);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-panel {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
    padding: 42px;
}

.auth-brand {
    width: fit-content;
}

.auth-heading h1,
.topbar h1,
.panel h2 {
    margin: 0;
    letter-spacing: 0;
}

.auth-heading h1 {
    font-size: 34px;
    line-height: 1.1;
}

.auth-heading p {
    max-width: 34ch;
    margin: 10px 0 0;
    color: var(--muted);
}

.auth-visual {
    display: grid;
    place-items: center;
    min-height: 100%;
    padding: 38px;
    background: #f2fbfa;
}

.auth-visual img {
    width: min(620px, 100%);
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(15, 61, 61, 0.14);
}

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

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 8px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 800;
}

.brand strong,
.user-chip strong {
    display: block;
    line-height: 1.2;
}

.brand small,
.user-chip small,
td small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.mini-label {
    display: block;
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.form-stack,
.form-grid {
    display: grid;
    gap: 16px;
    min-width: 0;
}

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

.form-actions {
    grid-column: 1 / -1;
}

.compact {
    gap: 12px;
}

.field {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: var(--muted);
    font-weight: 700;
}

.field input,
.field select,
.field textarea,
.field-control {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
}

.field input,
.field select,
.field textarea {
    padding: 11px 13px;
}

.field textarea {
    resize: vertical;
}

.field-control {
    display: grid;
    grid-template-columns: 1fr 44px;
    align-items: center;
    min-width: 0;
    overflow: hidden;
}

.field-control input {
    min-height: 44px;
    border: 0;
    outline: 0;
}

.field-control svg {
    width: 18px;
    justify-self: center;
    color: var(--muted);
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-weight: 600;
}

.btn,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}

.btn {
    min-height: 46px;
    padding: 0 18px;
}

.btn svg,
.icon-button svg,
.nav-link svg,
.action-row svg,
.metric-icon svg,
.support-callout svg,
.download-card svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--brand);
    color: #ffffff;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-light {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
}

.full-button {
    width: 100%;
    margin-top: 14px;
}

.icon-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
}

.icon-button.small {
    width: 34px;
    height: 34px;
}

.icon-button.danger {
    color: var(--danger);
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}

.auth-links a,
.sidebar-card a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--brand-dark);
    font-weight: 800;
}

.app-shell {
    display: grid;
    grid-template-columns: 272px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 28px;
    height: 100vh;
    padding: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--brand-dark);
    color: #ffffff;
}

.sidebar .brand small,
.sidebar .mini-label {
    color: rgba(255, 255, 255, 0.66);
}

.nav {
    display: grid;
    gap: 8px;
}

.nav-section {
    margin: 10px 12px 0;
    color: rgba(255, 255, 255, 0.52);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.76);
    font-weight: 800;
}

.nav-link.is-active,
.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.sidebar-card {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-card strong {
    display: block;
    margin: 4px 0 12px;
}

.main {
    min-width: 0;
    padding: 28px;
}

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

.topbar h1 {
    font-size: 28px;
    line-height: 1.2;
}

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

.menu-button {
    display: none;
}

.user-chip {
    display: flex;
    align-items: center;
    min-width: 190px;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 800;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.alert-success {
    border: 1px solid rgba(23, 139, 102, 0.28);
    background: rgba(23, 139, 102, 0.1);
    color: var(--success);
}

.alert-error {
    border: 1px solid rgba(216, 79, 100, 0.28);
    background: rgba(216, 79, 100, 0.1);
    color: var(--danger);
}

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

.metric-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(22, 37, 43, 0.06);
}

.metric-card {
    display: grid;
    min-height: 142px;
    gap: 12px;
    padding: 18px;
}

.metric-card.primary {
    background: var(--brand-dark);
    color: #ffffff;
}

.metric-card.primary .mini-label {
    color: rgba(255, 255, 255, 0.72);
}

.metric-card strong {
    font-size: 24px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.metric-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--brand-dark);
}

.primary .metric-icon {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
}

.split-grid.reverse {
    grid-template-columns: minmax(0, 1fr) 360px;
}

.panel {
    min-width: 0;
    padding: 18px;
}

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

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

.panel h2 {
    font-size: 20px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin-bottom: 14px;
}

.search-box {
    display: grid;
    min-width: min(360px, 100%);
    flex: 1;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.search-box input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 13px;
    background: #ffffff;
    color: var(--ink);
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td {
    color: var(--ink);
}

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

td textarea {
    min-height: 70px;
    resize: vertical;
}

.positive {
    color: var(--success);
    font-weight: 800;
}

.negative {
    color: var(--danger);
    font-weight: 800;
}

.muted,
.empty-state {
    color: var(--muted);
}

.empty-state {
    padding: 26px 10px;
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.badge-approved,
.badge-active,
.badge-closed {
    background: rgba(23, 139, 102, 0.11);
    color: var(--success);
}

.badge-pending,
.badge-open {
    background: rgba(242, 184, 75, 0.18);
    color: #94620d;
}

.badge-rejected,
.badge-suspended,
.badge-inactive {
    background: rgba(216, 79, 100, 0.12);
    color: var(--danger);
}

.table-link {
    color: var(--brand-dark);
    font-weight: 800;
}

.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination-links a {
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--brand-dark);
    font-weight: 800;
}

.pagination-links a.is-current {
    border-color: var(--brand);
    background: var(--surface-soft);
    color: var(--brand-dark);
}

.action-row {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.action-row > span,
.support-callout > i,
.download-card > i {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--brand-dark);
}

.action-row strong,
.download-card strong,
.support-callout strong,
.ticket strong {
    display: block;
}

.action-row small,
.download-card p {
    color: var(--muted);
}

.download-card {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.download-card p {
    margin: 0;
}

.inline-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.ticket-list {
    display: grid;
    gap: 12px;
}

.ticket {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.ticket p {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
}

.support-callout {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 12px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.support-callout a {
    color: var(--brand-dark);
    font-weight: 800;
}

.info-list,
.detail-list {
    display: grid;
    gap: 12px;
}

.info-row,
.detail-list > div,
.note-box {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.info-row strong,
.detail-list strong {
    display: block;
}

.info-row small,
.detail-list span,
.detail-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.timing-head {
    margin-top: 18px;
}

.timing-form input,
.timing-form select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
}

.spaced-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

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

.detail-grid > div {
    min-height: 74px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.detail-grid strong {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.note-box {
    margin-top: 16px;
}

.note-box p {
    margin: 6px 0 0;
    color: var(--muted);
}

.receipt-preview {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.receipt-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.receipt-preview-head strong {
    display: block;
}

.receipt-preview img {
    width: 100%;
    max-height: 680px;
    object-fit: contain;
    background: #f7faf9;
}

.receipt-preview object {
    width: 100%;
    min-height: 560px;
    border: 0;
    background: #f7faf9;
}

@media (max-width: 1100px) {
    .auth-card {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 320px;
    }

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

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

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

    .sidebar {
        position: fixed;
        z-index: 20;
        inset: 0 auto 0 0;
        width: min(280px, 86vw);
        transform: translateX(-102%);
        transition: transform 180ms ease;
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .main {
        padding: 18px;
    }

    .menu-button {
        display: inline-flex;
    }

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

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

    .user-chip {
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .auth-wrap {
        padding: 16px;
    }

    .auth-card {
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        min-height: auto;
    }

    .auth-panel .form-stack,
    .auth-panel .field,
    .auth-panel .field-control,
    .auth-panel .btn {
        width: min(100%, calc(100vw - 80px));
    }

    .auth-panel,
    .auth-visual {
        padding: 24px;
    }

    .auth-heading h1 {
        font-size: 28px;
    }

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

    .topbar {
        display: grid;
        grid-template-columns: auto 1fr;
    }

    .topbar-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

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