:root {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;

    --bg: #f5f7fa;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #172033;
    --muted: #6b7280;

    --sidebar-width: 250px;
    --topbar-height: 70px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;

    width: var(--sidebar-width);

    background: #fff;
    border-right: 1px solid var(--border);

    display: flex;
    flex-direction: column;

    z-index: 100;
}

.sidebar-logo {
    height: var(--topbar-height);

    display: flex;
    align-items: center;

    padding: 0 20px;

    border-bottom: 1px solid var(--border);
}

.logo-mark {
    width: 38px;
    height: 38px;

    border-radius: 10px;

    background: var(--primary);
    color: white;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 800;
    font-size: 20px;

    margin-right: 10px;
}

.logo-title {
    font-size: 18px;
    font-weight: 800;
}

.logo-subtitle {
    font-size: 11px;
    color: var(--muted);
}

.sidebar-nav {
    flex: 1;
    padding: 18px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;

    color: #94a3b8;

    margin: 18px 10px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 11px 12px;

    border-radius: 9px;

    color: #475569;

    margin-bottom: 3px;

    transition: .15s ease;
}

.nav-item:hover {
    background: #f1f5f9;
}

.nav-item.active {
    background: #e6f4f2;
    color: var(--primary);
    font-weight: 700;
}

.nav-item span:first-child {
    width: 20px;
    text-align: center;
}

.nav-danger {
    color: var(--danger);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
}

.sidebar-footer small {
    color: #94a3b8;
}

.main {
    margin-left: var(--sidebar-width);
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
}

.topbar {
    height: var(--topbar-height);

    background: #fff;
    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 25px;

    position: sticky;
    top: 0;

    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-title {
    font-size: 20px;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
}

.user-avatar {
    width: 34px;
    height: 34px;

    border-radius: 50%;

    background: #dff4f1;
    color: var(--primary);

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 700;
}

.mobile-menu-button {
    display: none;

    border: 0;
    background: transparent;

    font-size: 22px;
    cursor: pointer;
}

.content {
    padding: 25px;
    min-height: calc(100vh - 125px);
}

.footer {
    height: 55px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 25px;

    border-top: 1px solid var(--border);

    background: #fff;

    color: var(--muted);
    font-size: 12px;
}

/* Cards */

.card {
    background: var(--card);

    border: 1px solid var(--border);
    border-radius: 14px;

    margin-bottom: 20px;

    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    margin: 0 0 5px;
    font-size: 18px;
}

.card-header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.card-body {
    padding: 20px;
}

/* Dashboard */

.grid-3 {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 20px;
}

.stat-card {
    background: #fff;

    border: 1px solid var(--border);
    border-radius: 14px;

    padding: 20px;

    display: flex;
    align-items: center;

    gap: 15px;
}

.stat-icon {
    width: 48px;
    height: 48px;

    border-radius: 12px;

    background: #e6f4f2;
    color: var(--primary);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 20px;
}

.stat-title {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 25px;
    font-weight: 800;
}

.hero-card {
    background: #fff;

    border: 1px solid var(--border);
    border-radius: 16px;

    padding: 30px;

    margin-bottom: 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 25px;
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 18px;
}

.hero-icon {
    width: 70px;
    height: 70px;

    border-radius: 18px;

    background: var(--primary);
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 20px;
    font-weight: 800;
}

.hero-card h1 {
    margin: 0 0 7px;
}

.hero-card p {
    margin: 0;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);

    background: #fff;
    color: var(--text);

    padding: 9px 15px;

    border-radius: 8px;

    cursor: pointer;

    transition: .15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
}

.btn-large {
    min-height: 48px;
    padding: 12px 22px;
}

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* Tables */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 13px 16px;

    text-align: left;

    border-bottom: 1px solid var(--border);

    font-size: 13px;

    white-space: nowrap;
}

.data-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    text-align: center !important;
    padding: 45px !important;
    color: var(--muted);
}

/* Page header */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0 0 5px;
}

.page-header p {
    margin: 0;
    color: var(--muted);
}

/* Forms */

.form-group {
    margin-bottom: 17px;
}

.form-group label {
    display: block;

    font-size: 13px;
    font-weight: 700;

    margin-bottom: 7px;
}

.form-control {
    width: 100%;

    min-height: 44px;

    padding: 10px 12px;

    border: 1px solid #d7dce2;
    border-radius: 8px;

    background: #fff;

    outline: none;
}

.form-control:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(15, 118, 110, .10);
}

/* Alerts */

.alert {
    padding: 12px 14px;

    border-radius: 8px;

    margin-bottom: 18px;

    font-size: 13px;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Badges */

.badge {
    display: inline-flex;

    padding: 4px 8px;

    border-radius: 20px;

    font-size: 11px;
    font-weight: 700;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Auth */

.auth-wrapper {
    min-height: calc(100vh - 130px);

    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 420px;

    background: #fff;

    border: 1px solid var(--border);
    border-radius: 16px;

    padding: 30px;

    text-align: center;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.auth-card h1 {
    margin: 0;
}

.auth-description {
    color: var(--muted);
    margin: 8px 0 25px;
}

/* Quick actions */

.quick-actions {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 15px;
}

.quick-action {
    border: 1px solid var(--border);

    border-radius: 12px;

    padding: 18px;

    display: flex;
    flex-direction: column;

    gap: 6px;
}

.quick-action:hover {
    border-color: var(--primary);
}

.quick-action strong {
    color: var(--primary);
}

.quick-action span {
    color: var(--muted);
    font-size: 12px;
}

/* Scanner */

.scanner-page {
    display: flex;
    justify-content: center;
}

.scanner-card {
    width: 100%;
    max-width: 550px;

    background: #fff;

    border: 1px solid var(--border);
    border-radius: 16px;

    padding: 25px;

    text-align: center;
}

.scanner-title {
    font-size: 22px;
    font-weight: 800;
}

.scanner-subtitle {
    color: var(--muted);
    margin-top: 7px;
}

.scanner-placeholder {
    margin: 25px 0;
}

.scanner-frame {
    height: 320px;

    background: #111827;

    border-radius: 14px;

    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #fff;
}

.scanner-message {
    color: #cbd5e1;
    font-size: 13px;
}

.scanner-status {
    margin-top: 15px;
    color: var(--muted);
    font-size: 13px;
}

/* Confirm */

.confirm-wrapper,
.success-wrapper {
    min-height: calc(100vh - 130px);

    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-card,
.success-card {
    width: 100%;
    max-width: 520px;

    background: #fff;

    border: 1px solid var(--border);
    border-radius: 16px;

    padding: 30px;

    text-align: center;
}

.confirm-icon,
.success-icon {
    width: 70px;
    height: 70px;

    border-radius: 50%;

    margin: 0 auto 18px;

    background: #dcfce7;
    color: #15803d;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 30px;
    font-weight: 800;
}

.confirm-card h1,
.success-card h1 {
    margin: 0 0 10px;
}

.confirm-card p,
.success-card p {
    color: var(--muted);
}

.confirm-info {
    text-align: left;

    background: #f8fafc;

    border-radius: 10px;

    padding: 15px;

    margin: 20px 0;
}

.confirm-info > div {
    display: flex;
    justify-content: space-between;

    gap: 20px;

    padding: 8px 0;

    border-bottom: 1px solid var(--border);
}

.confirm-info > div:last-child {
    border-bottom: 0;
}

.confirm-info span {
    color: var(--muted);
}

.confirm-actions {
    display: flex;
    gap: 10px;
}

.confirm-actions .btn {
    flex: 1;
}

.success-time {
    color: var(--primary);
    font-weight: 700;
    margin: 20px 0;
}

/* Responsive */

@media (max-width: 1000px) {

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }

}

@media (max-width: 760px) {

    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .mobile-menu-button {
        display: block;
    }

    .content {
        padding: 15px;
    }

    .hero-card {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .footer {
        padding: 0 15px;
    }

    .topbar {
        padding: 0 15px;
    }

    .user-mini span:last-child {
        display: none;
    }

}

/* =========================================================
   QR HOME
========================================================= */

.qr-home {
    min-height: calc(100vh - 125px);

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    padding: 25px 15px;
}

.qr-home-card {
    width: 100%;
    max-width: 480px;

    background: #fff;

    border: 1px solid var(--border);
    border-radius: 22px;

    padding: 40px 30px;

    text-align: center;

    box-shadow:
        0 10px 30px rgba(15, 23, 42, .05);
}

.qr-logo {
    display: flex;
    justify-content: center;

    margin-bottom: 20px;
}

.qr-logo-mark {
    width: 76px;
    height: 76px;

    border-radius: 20px;

    background: var(--primary);
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 22px;
    font-weight: 800;

    box-shadow:
        0 8px 20px rgba(15, 118, 110, .20);
}

.qr-home-card h1 {
    margin: 0;

    font-size: 30px;
    font-weight: 800;

    color: var(--text);
}

.qr-home-title {
    margin: 8px 0 0;

    font-size: 17px;
    font-weight: 700;

    color: var(--primary);
}

.qr-home-description {
    margin: 12px auto 28px;

    max-width: 360px;

    color: var(--muted);

    font-size: 14px;
    line-height: 1.6;
}

.qr-home-action {
    margin-bottom: 28px;
}

.qr-start-button {
    width: 100%;

    min-height: 62px;

    display: flex;

    align-items: center;
    justify-content: center;

    gap: 12px;

    border-radius: 13px;

    background: var(--primary);
    color: #fff;

    font-size: 17px;
    font-weight: 700;

    box-shadow:
        0 8px 20px rgba(15, 118, 110, .18);

    transition:
        background .15s ease,
        transform .15s ease,
        box-shadow .15s ease;
}

.qr-start-button:hover {
    background: var(--primary-dark);

    transform: translateY(-1px);

    box-shadow:
        0 10px 24px rgba(15, 118, 110, .22);
}

.qr-start-button:active {
    transform: translateY(0);
}

.qr-start-icon {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 2px solid rgba(255, 255, 255, .85);

    border-radius: 7px;

    font-size: 15px;
}

.qr-home-info {
    display: flex;

    flex-direction: column;

    gap: 10px;

    text-align: left;
}

.qr-info-item {
    display: flex;

    align-items: flex-start;

    gap: 12px;

    padding: 13px;

    background: #f8fafc;

    border: 1px solid var(--border);

    border-radius: 11px;
}

.qr-info-icon {
    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #e6f4f2;

    color: var(--primary);

    border-radius: 8px;

    font-size: 15px;
}

.qr-info-item strong {
    display: block;

    margin-bottom: 3px;

    font-size: 13px;
}

.qr-info-item small {
    display: block;

    color: var(--muted);

    font-size: 11px;

    line-height: 1.5;
}

.qr-home-footer {
    margin-top: 18px;

    color: #94a3b8;

    font-size: 11px;
}


/* =========================================================
   MOBILE QR HOME
========================================================= */

@media (max-width: 760px) {

    .qr-home {
        min-height: calc(100vh - 70px);

        padding: 15px;
    }

    .qr-home-card {
        max-width: 430px;

        padding: 32px 22px;

        border-radius: 18px;
    }

    .qr-logo-mark {
        width: 68px;
        height: 68px;

        border-radius: 18px;
    }

    .qr-home-card h1 {
        font-size: 27px;
    }

    .qr-home-title {
        font-size: 16px;
    }

    .qr-home-description {
        font-size: 13px;

        margin-bottom: 25px;
    }

    .qr-start-button {
        min-height: 60px;

        font-size: 16px;
    }

}

/* =========================================================
   PUBLIC HEADER / FOOTER
========================================================= */

.public-layout {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
}

.public-header {
    height: 70px;

    flex: 0 0 70px;

    background: #ffffff;

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;

    padding: 0 25px;
}

.public-brand {
    display: flex;
    align-items: center;

    gap: 10px;

    color: var(--text);

    text-decoration: none;
}

.public-brand-logo {
    width: 38px;
    height: 38px;

    border-radius: 10px;

    background: var(--primary);

    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 18px;
    font-weight: 800;
}

.public-brand-text {
    display: flex;
    flex-direction: column;

    line-height: 1.1;
}

.public-brand-text strong {
    font-size: 17px;
    font-weight: 800;
}

.public-brand-text small {
    margin-top: 3px;

    color: var(--muted);

    font-size: 10px;
}

.public-content {
    flex: 1;

    width: 100%;

    padding: 25px;

    background: var(--bg);
}

.public-footer {
    min-height: 55px;

    flex: 0 0 55px;

    background: #ffffff;

    border-top: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 25px;

    color: var(--muted);

    font-size: 12px;
}


/* =========================================================
   PUBLIC MOBILE
========================================================= */

@media (max-width: 760px) {

    .public-header {
        height: 60px;

        flex-basis: 60px;

        padding: 0 15px;
    }

    .public-content {
        padding: 15px;
    }

    .public-footer {
        min-height: 50px;

        flex-basis: 50px;

        padding: 0 15px;

        font-size: 11px;
    }

}