:root {
    --blue: #2563eb;
    --blue-dark: #101f46;
    --teal: #00a6b4;
    --green: #0f9f6e;
    --red: #c33a3a;
    --amber: #a15c00;
    --pink: #ff4f8b;
    --lime: #c7f464;
    --ink: #111827;
    --muted: #667085;
    --line: #dbe3f0;
    --soft: #f3f7fb;
    --white: #ffffff;
    --shadow: 0 18px 46px rgba(16, 31, 70, 0.1);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    font-family: Inter, Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(0, 166, 180, 0.08), transparent 34%),
        linear-gradient(225deg, rgba(255, 79, 139, 0.08), transparent 32%),
        var(--soft);
}

.minimal-page {
    background:
        linear-gradient(135deg, rgba(0, 166, 180, 0.1), transparent 38%),
        linear-gradient(225deg, rgba(199, 244, 100, 0.14), transparent 34%),
        #eef4fb;
}

a {
    color: var(--blue);
    text-decoration: none;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(16, 31, 70, 0.96);
    color: var(--white);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
}

.topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--white);
    font-size: 19px;
    font-weight: 800;
    white-space: nowrap;
}

.brand::before {
    content: "";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--lime), #5eead4);
    box-shadow: inset 0 0 0 7px rgba(16, 31, 70, 0.14);
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--white);
    border-radius: 6px;
    padding: 8px 10px;
    font-weight: 700;
    font-size: 14px;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.12);
}

.hero {
    padding: 38px 0 24px;
    background:
        linear-gradient(120deg, rgba(37, 99, 235, 0.16), rgba(0, 166, 180, 0.1) 45%, rgba(255, 79, 139, 0.09)),
        #f7fbff;
    border-bottom: 1px solid #e6ecf5;
}

.scan-hero {
    padding: 28px 0 20px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(0, 166, 180, 0.08)),
        #eef4fb;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: 42px;
    color: var(--blue-dark);
    line-height: 1.08;
}

.hero-kicker {
    display: inline-flex;
    width: fit-content;
    margin: 0 0 10px !important;
    border-radius: 999px;
    padding: 7px 11px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--teal) !important;
    border: 1px solid rgba(0, 166, 180, 0.24);
    font-size: 12px !important;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.55;
}

main > .container,
main > .container.grid {
    margin-top: 18px;
}

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.machine-card {
    position: relative;
    overflow: hidden;
}

.machine-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--blue), var(--teal), var(--pink), var(--lime));
}

.machine-card h2 {
    margin-top: 6px;
}

.panel h2 {
    margin-top: 0;
    color: var(--ink);
}

.grid {
    display: grid;
    gap: 18px;
    align-items: start;
}

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

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

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

.machine-status,
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-ready,
.status-paid,
.status-finished,
.status-waiting_start {
    color: #07543b;
    background: #dff7ec;
}

.status-running,
.status-queued,
.status-command_sent {
    color: var(--amber);
    background: #fff1cc;
}

.status-error,
.status-offline,
.status-failed {
    color: #8c1f1f;
    background: #ffe1e1;
}

.status-maintenance,
.status-pending {
    color: #344054;
    background: #edf2f7;
}

.package-option {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    gap: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.package-option:hover,
.package-option:has(input:checked) {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.package-option:hover {
    transform: translateY(-1px);
}

.package-option input {
    margin: 0;
    grid-row: 1 / span 2;
}

.package-name {
    font-weight: 800;
    display: block;
}

.package-meta {
    color: var(--muted);
    margin-top: 0;
    line-height: 1.45;
    grid-column: 2;
}

.form-row {
    display: grid;
    gap: 7px;
    margin-bottom: 15px;
}

label {
    font-weight: 800;
}

input:not([type="radio"]):not([type="checkbox"]),
select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 13px;
    font: inherit;
    background: #fff;
}

input:not([type="radio"]):not([type="checkbox"]):focus,
select:focus {
    outline: 0;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

input[type="radio"],
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    accent-color: var(--blue);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    padding: 11px 17px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
}

.button:hover {
    filter: brightness(0.96);
}

.button.secondary {
    background: #e8f0fb;
    color: var(--blue-dark);
}

.button.success {
    background: var(--green);
}

.button.danger {
    background: var(--red);
}

.action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
    vertical-align: top;
}

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

.stat {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 17px;
    box-shadow: var(--shadow);
}

.stat strong {
    color: var(--blue-dark);
}

.stat span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
}

.alert {
    border-radius: 8px;
    padding: 13px 15px;
    margin-bottom: 16px;
    background: #fff1cc;
    color: #7a4d00;
    line-height: 1.5;
}

.success-alert {
    background: #dff7ec;
    color: #07543b;
}

.status-summary {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f8fbff;
}

.status-summary strong {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
}

.status-summary p {
    margin: 0;
    font-weight: 800;
}

.service-notice {
    border: 1px solid #f3d591;
    border-radius: 8px;
    padding: 18px;
    margin: 18px 0;
    background: #fff8e6;
    color: #674000;
}

.service-notice.success-alert {
    border-color: #b7ebd0;
    background: #effcf5;
    color: #07543b;
}

.service-notice h2 {
    margin: 0 0 8px;
    color: inherit;
    font-size: 22px;
}

.service-notice p {
    margin: 0;
    line-height: 1.55;
}

.service-times {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.service-times span {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    padding: 12px;
}

.service-times strong {
    display: block;
    margin-bottom: 4px;
}

.primary-action {
    font-size: 16px;
    min-height: 52px;
}

.status-actions {
    margin-top: 12px;
}

.inline-edit {
    display: grid;
    gap: 8px;
    min-width: 260px;
}

.qris-image {
    display: block;
    max-width: 280px;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.qr-sheet {
    display: flex;
    justify-content: center;
}

.qr-card {
    width: min(520px, 100%);
    padding: 28px;
    border: 2px solid var(--ink);
    border-radius: 8px;
    text-align: center;
    background: #fff;
}

.qr-card h2 {
    margin: 10px 0 4px;
    font-size: 32px;
    line-height: 1.15;
}

.qr-card img {
    width: min(420px, 100%);
    height: auto;
    margin: 14px auto;
}

.qr-brand,
.qr-code {
    font-weight: 800;
    color: var(--blue-dark);
}

.qr-code {
    font-size: 26px;
    letter-spacing: 0;
}

.qr-caption {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.45;
}

.footer {
    padding: 32px 0;
    color: var(--muted);
    font-size: 13px;
}

.report-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
    gap: 14px;
    align-items: end;
}

.report-filter .form-row {
    margin-bottom: 0;
}

.report-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.report-stats,
.report-grid {
    margin-top: 18px;
}

@media print {
    body {
        background: #fff;
    }

    .no-print,
    .topbar,
    .footer {
        display: none !important;
    }

    .container {
        width: 100%;
    }

    .panel {
        box-shadow: none;
        border: 0;
    }

    .qr-sheet {
        min-height: 95vh;
        align-items: center;
    }
}

@media (max-width: 920px) {
    .grid.three,
    .grid.four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 24px, 1180px);
    }

    .topbar {
        position: static;
    }

    .topbar .container {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 0;
    }

    .nav-links {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }

    .nav-links a {
        flex: 0 0 auto;
        background: rgba(255, 255, 255, 0.08);
    }

    .hero {
        padding: 26px 0 18px;
    }

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

    .hero p {
        font-size: 15px;
    }

    .grid.two,
    .grid.three,
    .grid.four {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 16px;
    }

    .button,
    .action-row .button {
        width: 100%;
    }

    .package-option {
        padding: 13px;
    }

    .service-times {
        grid-template-columns: 1fr;
    }

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

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

    .qris-image {
        margin: 0 auto;
    }

    .qr-card {
        padding: 20px;
    }

    .qr-card h2 {
        font-size: 26px;
    }

    th,
    td {
        padding: 11px 10px;
    }
}
