:root {
    --bg: #07101d;
    --surface: #111d2d;
    --surface-2: #162438;
    --border: #25364d;
    --text: #f4f7fb;
    --muted: #93a2b6;
    --gold: #f6b73c;
    --green: #29c482;
    --red: #f26a73;
    --blue: #54a5ff;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        "Segoe UI",
        Arial,
        sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

.hidden {
    display: none !important;
}

.login-view {
    min-height: 100vh;
    padding: 25px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(
            circle at top right,
            rgba(246, 183, 60, 0.12),
            transparent 36%
        ),
        var(--bg);
}

.login-card,
.modal-card {
    width: 100%;
    max-width: 440px;
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background:
        linear-gradient(
            145deg,
            rgba(22, 36, 56, 0.99),
            rgba(10, 20, 34, 0.99)
        );
    box-shadow:
        0 35px 90px rgba(0, 0, 0, 0.38);
}

.logo {
    width: 68px;
    height: 68px;
    margin-bottom: 23px;
    border: 1px solid rgba(246, 183, 60, 0.55);
    border-radius: 19px;
    background: #080e18;
    color: var(--gold);
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 900;
}

.logo.small {
    width: 49px;
    height: 49px;
    margin: 0;
    border-radius: 14px;
    font-size: 16px;
}

.login-card h1 {
    margin: 0;
}

.login-card p,
.modal-card p {
    margin: 8px 0 25px;
    color: var(--muted);
}

.login-card small {
    min-height: 18px;
    margin-top: 12px;
    color: var(--red);
    display: block;
    text-align: center;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    padding: 23px 18px;
    border-right: 1px solid var(--border);
    background:
        linear-gradient(
            180deg,
            #0c1828,
            #08111e
        );
    display: flex;
    flex-direction: column;
}

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

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: 16px;
}

.brand span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.sidebar nav {
    margin-top: 30px;
    display: grid;
    gap: 8px;
}

.nav-button,
.nav-link {
    width: 100%;
    min-height: 45px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    text-align: left;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
}

.nav-button:hover,
.nav-button.active,
.nav-link:hover {
    border-color:
        rgba(246, 183, 60, 0.26);
    background:
        rgba(246, 183, 60, 0.09);
    color: var(--gold);
}

.sidebar-user {
    margin-top: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.025);
}

.sidebar-user strong,
.sidebar-user span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user strong {
    font-size: 12px;
}

.sidebar-user span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}

.sidebar-user button {
    width: 100%;
    min-height: 36px;
    margin-top: 13px;
    border: 1px solid rgba(242, 106, 115, 0.32);
    border-radius: 9px;
    background: rgba(242, 106, 115, 0.08);
    color: #ff9ea5;
    font-size: 10px;
    font-weight: 800;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 91px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 16, 29, 0.94);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

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

.topbar p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.page {
    display: none;
    padding: 25px 28px 42px;
}

.page.active {
    display: block;
}

.button {
    min-height: 43px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button.full {
    width: 100%;
}

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

.button.secondary {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.button.small {
    min-height: 37px;
    padding: 0 12px;
    font-size: 10px;
}

.link-button {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.stats-grid {
    margin-bottom: 19px;
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat-card,
.panel {
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        linear-gradient(
            145deg,
            rgba(22, 36, 56, 0.97),
            rgba(12, 23, 38, 0.97)
        );
    box-shadow:
        0 17px 38px rgba(0, 0, 0, 0.15);
}

.stat-card {
    min-height: 125px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-card strong {
    margin-top: 12px;
    font-size: 29px;
}

.stat-card.warning strong {
    color: var(--gold);
}

.stat-card.revenue strong {
    color: var(--green);
}

.panel {
    padding: 21px;
}

.panel + .panel {
    margin-top: 18px;
}

.panel-header {
    margin-bottom: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.panel-header.compact {
    align-items: flex-start;
}

.panel-header h2,
.panel h3 {
    margin: 0;
}

.panel-header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11px;
}

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

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

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

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

td {
    font-size: 11px;
}

.badge {
    display: inline-flex;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 9px;
    font-weight: 800;
}

.badge.green {
    border-color: rgba(41, 196, 130, 0.35);
    color: #68e8b1;
}

.badge.gold {
    border-color: rgba(246, 183, 60, 0.35);
    color: #ffd47a;
}

.badge.red {
    border-color: rgba(242, 106, 115, 0.35);
    color: #ffabb1;
}

.status-select {
    min-height: 34px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0a1422;
    color: var(--text);
    font-size: 10px;
}

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

.restaurant-list-panel {
    position: sticky;
    top: 115px;
}

.restaurant-list {
    max-height: calc(100vh - 225px);
    overflow-y: auto;
    display: grid;
    gap: 9px;
}

.restaurant-card {
    width: 100%;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(7, 15, 27, 0.42);
    color: var(--text);
    text-align: left;
}

.restaurant-card:hover,
.restaurant-card.active {
    border-color: rgba(246, 183, 60, 0.48);
    background: rgba(246, 183, 60, 0.08);
}

.restaurant-card strong,
.restaurant-card span {
    display: block;
}

.restaurant-card strong {
    font-size: 12px;
}

.restaurant-card span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
}

.empty-manager,
.empty {
    min-height: 160px;
    color: var(--muted);
    display: grid;
    place-items: center;
    font-size: 11px;
}

.tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.tab {
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #0a1422;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.tab.active {
    border-color: var(--gold);
    color: var(--gold);
}

.tab-page {
    display: none;
}

.tab-page.active {
    display: block;
}

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

.field {
    margin-bottom: 15px;
    display: grid;
    gap: 8px;
}

.field.wide {
    grid-column: 1 / -1;
}

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

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: #0a1422;
    color: var(--text);
}

.field textarea {
    min-height: 92px;
    padding: 12px 13px;
    resize: vertical;
}

.check-field {
    min-height: 40px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 11px;
}

.check-field.wide {
    grid-column: 1 / -1;
}

.check-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
}

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

.actions {
    display: flex;
    gap: 9px;
}

.items-list {
    display: grid;
    gap: 9px;
}

.item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(7, 15, 27, 0.38);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.item strong,
.item span,
.item small {
    display: block;
}

.item strong {
    font-size: 11px;
}

.item span,
.item small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.item-actions {
    display: flex;
    gap: 7px;
}

.mini-button {
    min-height: 33px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 9px;
    font-weight: 800;
}

.mini-button.gold {
    border-color: rgba(246, 183, 60, 0.4);
    color: var(--gold);
}

.product-content {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.product-image {
    width: 48px;
    height: 48px;
    border-radius: 9px;
    object-fit: cover;
    background: #0a1422;
}

.url-text {
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #a9d3ff !important;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    padding: 22px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(7px);
    display: grid;
    place-items: center;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.modal-head h2 {
    margin: 0;
}

.modal-head button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    font-size: 22px;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 300;
    max-width: 380px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #17263a;
    opacity: 0;
    transform: translateY(12px);
    transition: 0.2s ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    color: #ffb1b7;
}

@media (max-width: 1200px) {
    .manager-layout {
        grid-template-columns: 270px minmax(0, 1fr);
    }

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

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

    .manager-layout {
        grid-template-columns: 1fr;
    }

    .restaurant-list-panel {
        position: static;
    }
}


.info-text {
    margin: 0 0 17px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.secret-box {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid rgba(246, 183, 60, 0.42);
    border-radius: 12px;
    background: rgba(246, 183, 60, 0.07);
}

.secret-box strong,
.secret-box p {
    display: block;
}

.secret-box strong {
    color: var(--gold);
    font-size: 12px;
}

.secret-box textarea {
    width: 100%;
    min-height: 115px;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #07101d;
    color: #ffffff;
    font-family: Consolas, monospace;
    font-size: 11px;
    resize: none;
    word-break: break-all;
}

.secret-box p {
    margin: 0 0 13px;
    color: var(--muted);
    font-size: 9px;
}

.mini-button.danger {
    border-color: rgba(242, 106, 115, 0.42);
    background: rgba(242, 106, 115, 0.08);
    color: #ffabb1;
}

.table-content {
    min-width: 0;
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: center;
    gap: 13px;
}

.qr-preview {
    width: 88px;
    height: 105px;
    padding: 4px;
    border-radius: 9px;
    background: #ffffff;
    object-fit: contain;
}

.api-key-prefix {
    font-family: Consolas, monospace;
    color: #a9d3ff !important;
}

@media (max-width: 700px) {
    .table-content {
        grid-template-columns: 70px minmax(0, 1fr);
    }

    .qr-preview {
        width: 70px;
        height: 85px;
    }

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

    .item-actions {
        flex-wrap: wrap;
    }
}


.settings-stack {
    display: grid;
    gap: 18px;
}

.settings-panel,
.auto-tables-panel {
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.99),
            rgba(247, 249, 252, 0.99)
        );
    color: #111827;
}

.settings-panel .field span,
.settings-panel .check-field,
.auto-tables-panel p {
    color: #5f6b7a;
}

.settings-panel .field input,
.settings-panel .field select,
.settings-panel .field textarea {
    border-color: #d9dee7;
    background: #ffffff;
    color: #111827;
}

.settings-heading {
    margin-bottom: 22px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.settings-heading.compact-heading {
    margin: 0;
}

.settings-heading h3 {
    margin: 0;
    font-size: 16px;
}

.settings-heading p {
    margin: 6px 0 0;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.5;
}

.settings-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(47, 111, 55, 0.1);
    color: #2f6f37;
    display: grid;
    place-items: center;
    font-size: 17px;
    font-weight: 900;
}

.logo-settings {
    margin-bottom: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid #e4e8ee;
    display: flex;
    align-items: center;
    gap: 17px;
}

.logo-settings strong {
    margin-bottom: 11px;
    display: block;
    font-size: 12px;
}

.logo-preview-box {
    width: 74px;
    height: 74px;
    overflow: hidden;
    border: 1px solid #dce1e8;
    border-radius: 15px;
    background: #f4f4f2;
    display: grid;
    place-items: center;
}

.logo-preview-box img {
    width: 100%;
    height: 100%;
    padding: 7px;
    object-fit: contain;
}

.logo-preview-box span {
    color: #2f6f37;
    font-weight: 900;
}

.upload-button {
    min-height: 38px;
    background: #ffffff !important;
    color: #111827 !important;
    display: inline-flex;
    align-items: center;
}

.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.currency-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.currency-button {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid #d5dae2;
    border-radius: 11px;
    background: #f3f4f6;
    color: #111827;
    font-size: 11px;
    font-weight: 800;
}

.currency-button.active {
    border-color: #2f6f37;
    background: #2f6f37;
    color: #ffffff;
}

.auto-tables-header {
    margin-bottom: 21px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

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

.quantity-stepper {
    min-height: 44px;
    padding: 4px;
    border-radius: 13px;
    background: #eff1f4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-stepper button {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #d6dae1;
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    font-size: 21px;
    font-weight: 500;
}

.quantity-stepper strong {
    min-width: 35px;
    color: #111827;
    text-align: center;
    font-size: 14px;
}

.quantity-stepper span {
    padding-right: 8px;
    color: #6b7280;
    font-size: 10px;
}

.settings-qr-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fill,
            minmax(205px, 1fr)
        );
    gap: 17px;
}

.settings-qr-item {
    min-width: 0;
    padding: 12px;
    border-radius: 13px;
    background: #f8f9fb;
}

.settings-qr-card {
    min-height: 300px;
    padding: 18px 14px 15px;
    border-radius: 18px;
    color: #111111;
    display: flex;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

.settings-card-logo {
    width: 51px;
    height: 51px;
    color: #2f6f37;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.settings-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.settings-card-brand-small {
    margin-top: 5px;
    color: rgba(130, 83, 0, 0.8);
    font-size: 8px;
    font-weight: 800;
}

.settings-card-brand {
    margin-top: 4px;
    font-size: 15px;
}

.settings-card-scan {
    margin: 21px 0 12px;
    font-size: 10px;
}

.settings-card-bottom {
    width: 100%;
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        61px;
    gap: 8px;
}

.settings-card-qr {
    min-height: 126px;
    padding: 5px;
    border-radius: 13px;
    background: #ffffff;
    display: grid;
    place-items: center;
}

.settings-card-qr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.settings-table-badge {
    border-radius: 13px;
    background: #2f9e44;
    color: #ffffff;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
}

.settings-table-badge span {
    font-size: 8px;
    font-weight: 900;
}

.settings-table-badge strong {
    margin-top: 8px;
    font-size: 36px;
    line-height: 1;
}

.settings-download-button {
    width: 100%;
    min-height: 36px;
    margin-top: 8px;
    border: none;
    background: transparent;
    color: #2f6f37;
    font-size: 10px;
    font-weight: 800;
}

@media (max-width: 850px) {
    .auto-tables-header {
        flex-direction: column;
    }

    .table-quantity-actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 560px) {
    .logo-settings {
        align-items: flex-start;
    }

    .table-quantity-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .quantity-stepper {
        justify-content: space-between;
    }

    .settings-qr-grid {
        grid-template-columns: 1fr;
    }
}


.qr-colors-title {
    margin: 7px 0 15px;
    padding: 14px 15px;
    border: 1px solid #dfe4eb;
    border-radius: 11px;
    background: #f7f8fa;
}

.qr-colors-title strong,
.qr-colors-title span {
    display: block;
}

.qr-colors-title strong {
    color: #111827;
    font-size: 12px;
}

.qr-colors-title span {
    margin-top: 5px;
    color: #6b7280;
    font-size: 10px;
}

.settings-panel input[type="color"] {
    height: 44px;
    padding: 4px;
    cursor: pointer;
}

/* MZ_MODAL_SCROLL_FIX_V1 */
#restaurantModal {
    overflow-y: auto;
    padding: 20px;
    align-items: flex-start;
}

#restaurantModal .modal-card {
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    margin: auto;
}

#restaurantModal .modal-card .actions {
    position: sticky;
    bottom: -1px;
    z-index: 10;
    margin-top: 18px;
    padding: 14px 0 4px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

@media (max-height: 700px) {
    #restaurantModal {
        padding: 10px;
    }

    #restaurantModal .modal-card {
        max-height: calc(100vh - 20px);
    }
}


/* MZ_PRINT_SERVER_ACTIVATION_UI_V1 */

.mz-print-management {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.mz-print-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.mz-print-device-row,
.mz-activation-code-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
}

.mz-print-device-content {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.mz-print-device-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mz-print-info-line,
.mz-activation-code-row small {
    display: block;
    color: #64748b;
    line-height: 1.5;
}

.mz-print-status {
    font-size: 12px;
    font-weight: 700;
}

.mz-print-status.online {
    color: #15803d;
}

.mz-print-status.offline {
    color: #d97706;
}

.mz-print-status.revoked {
    color: #dc2626;
}

@media (max-width: 760px) {
    .mz-print-panel-head,
    .mz-print-device-row,
    .mz-activation-code-row {
        align-items: stretch;
        flex-direction: column;
    }
}
