:root {
    --ui-bg: #f5f7fb;
    --ui-surface: #ffffff;
    --ui-surface-soft: #f9fafb;
    --ui-text: #172033;
    --ui-muted: #667085;
    --ui-border: #d9e1ec;
    --ui-primary: #2563eb;
    --ui-primary-strong: #1d4ed8;
    --ui-accent: #f97316;
    --ui-success: #16a34a;
    --ui-danger: #dc2626;
    --ui-warning: #f59e0b;
    --ui-shadow: 0 10px 28px rgba(23, 32, 51, 0.10);
    --ui-shadow-soft: 0 4px 14px rgba(23, 32, 51, 0.08);
    --ui-radius: 8px;
    --ui-sidebar-width: 272px;
}

html,
body {
    min-height: 100%;
    margin: 0;
    direction: rtl;
    letter-spacing: 0;
    background: var(--ui-bg);
    color: var(--ui-text);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    text-rendering: optimizeLegibility;
}

body {
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
canvas,
svg,
video {
    max-width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ui-text);
    letter-spacing: 0;
    line-height: 1.25;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.55rem; }
h4 { font-size: 1.25rem; }

p {
    color: var(--ui-muted);
    line-height: 1.7;
}

a {
    color: var(--ui-primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

main {
    width: 100%;
    min-height: 100vh;
    display: block !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 24px;
}

.content {
    width: 100%;
    max-width: 1180px;
    min-height: 0;
    min-height: auto !important;
    margin: 0 auto;
    display: block !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 8px 0 40px;
}

main.full-width,
main.full-width .content {
    max-width: none;
    padding: 0;
}

.container,
.container-fluid {
    width: 100%;
    max-width: 1180px;
    min-height: 0;
    min-height: auto !important;
    margin-inline: auto;
    padding: 24px;
    display: block !important;
    text-align: initial;
}

.page {
    min-height: 100vh;
    background: var(--ui-bg);
}

.menu-toggle {
    position: fixed !important;
    top: 14px !important;
    right: 14px !important;
    left: auto !important;
    z-index: 1100 !important;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: var(--ui-radius) !important;
    background: var(--ui-text) !important;
    box-shadow: var(--ui-shadow-soft);
}

.sidebar {
    right: 0 !important;
    left: auto !important;
    width: min(var(--ui-sidebar-width), 86vw) !important;
    padding: 18px !important;
    background: #172033 !important;
    transform: translateX(100%) !important;
    box-shadow: -18px 0 36px rgba(23, 32, 51, 0.20);
    overflow-y: auto;
}

.sidebar.visible {
    transform: translateX(0) !important;
}

.nav-menu {
    gap: 10px !important;
    min-height: calc(100vh - 36px);
}

.user-info {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--ui-radius) !important;
    padding: 14px !important;
    color: #fff;
}

.nav-button {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    gap: 10px !important;
    border-radius: var(--ui-radius) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    color: #fff !important;
    font-weight: 600;
    line-height: 1.35;
}

.nav-button:hover,
.nav-button:focus-visible {
    background: rgba(255, 255, 255, 0.15) !important;
}

.admin-button {
    background: rgba(249, 115, 22, 0.22) !important;
    border-color: rgba(249, 115, 22, 0.35) !important;
}

.logout-button {
    background: rgba(220, 38, 38, 0.18) !important;
    border-color: rgba(220, 38, 38, 0.32) !important;
}

.login-container,
.register-page {
    min-height: 100vh !important;
    padding: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(249, 115, 22, 0.08)),
        var(--ui-bg) !important;
}

.register-container {
    width: 100%;
    min-height: 0;
    min-height: auto !important;
}

.login-box,
.register-box,
.card,
.modal-content,
.chart-container,
.loading-message,
.no-debts-message {
    border-radius: var(--ui-radius) !important;
    border: 1px solid var(--ui-border) !important;
    background: var(--ui-surface) !important;
    box-shadow: var(--ui-shadow-soft) !important;
}

.login-box,
.register-box {
    width: min(100%, 460px) !important;
    padding: 26px !important;
}

.register-box {
    width: min(100%, 680px) !important;
}

.login-box h2,
.register-header h2 {
    color: var(--ui-text) !important;
    margin-bottom: 10px !important;
    font-size: 1.75rem !important;
}

.register-header {
    margin-bottom: 24px !important;
}

.register-header p {
    margin-bottom: 0;
    color: var(--ui-muted) !important;
}

.form-group,
.mb-3 {
    text-align: start;
}

.form-label,
.form-group label,
label {
    color: var(--ui-text) !important;
    font-weight: 700;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 44px;
    border-radius: var(--ui-radius) !important;
    border-color: var(--ui-border) !important;
    background-color: #fff !important;
    color: var(--ui-text) !important;
}

.input-group .form-control {
    min-width: 0;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ui-primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16) !important;
}

.form-check-input {
    cursor: pointer;
}

.btn {
    min-height: 44px;
    border-radius: var(--ui-radius) !important;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: none !important;
}

.btn-sm {
    min-height: 36px;
    padding: 0.42rem 0.7rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--ui-primary) !important;
    border-color: var(--ui-primary) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--ui-primary-strong) !important;
    border-color: var(--ui-primary-strong) !important;
}

.btn-secondary {
    background: #475467 !important;
    border-color: #475467 !important;
    color: #fff !important;
}

.btn-success {
    background: var(--ui-success) !important;
    border-color: var(--ui-success) !important;
}

.btn-danger {
    background: var(--ui-danger) !important;
    border-color: var(--ui-danger) !important;
}

.btn-warning,
.btn-info {
    background: var(--ui-accent) !important;
    border-color: var(--ui-accent) !important;
    color: #fff !important;
}

.alert {
    max-width: none !important;
    border-radius: var(--ui-radius) !important;
    text-align: start !important;
}

.card {
    overflow: hidden;
}

.card-body {
    padding: 18px !important;
}

.card-title {
    margin-bottom: 8px !important;
    font-size: 0.95rem !important;
    color: inherit !important;
}

.card-text {
    margin: 0 !important;
    font-size: 1.25rem !important;
    font-weight: 800;
}

.bg-success,
.bg-danger,
.bg-warning {
    color: #fff !important;
}

.bg-success .amount,
.bg-danger .amount,
.bg-warning .amount,
.card.text-white .amount {
    color: #fff !important;
}

.content > h3,
.content > h4,
.content > .d-flex,
.content > .row,
.content > .table-responsive,
.content > .text-center,
.content > .mb-3,
.content > .mb-4,
.content > .mb-5,
.content > .main-content,
.content > .alert {
    width: 100%;
}

.content > h3 {
    margin: 0 0 18px;
    text-align: start;
    font-weight: 800;
}

.content > .d-flex.justify-content-between {
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow-soft);
}

.content > .d-flex.justify-content-between h4 {
    margin: 0;
    text-align: center;
    color: var(--ui-text);
    font-weight: 800;
}

.row {
    row-gap: 16px;
}

.table-responsive {
    width: 100%;
    margin-top: 16px !important;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow-soft);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    min-width: 760px;
    margin-bottom: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 14px 12px !important;
    background: #eef4ff !important;
    color: var(--ui-text) !important;
    border-bottom: 1px solid var(--ui-border) !important;
    white-space: nowrap;
    text-align: center;
}

.table td {
    padding: 13px 12px !important;
    color: var(--ui-text) !important;
    background: #fff !important;
    border-bottom: 1px solid #edf1f7 !important;
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: 0 !important;
}

.table td:last-child {
    min-width: 220px;
}

.table td .btn,
.table td button {
    margin: 3px !important;
}

.badge {
    border-radius: 999px !important;
    padding: 0.45rem 0.7rem;
    font-weight: 800;
}

.modal.show,
.modal.d-block {
    padding: 18px !important;
    overflow-y: auto;
}

.modal-dialog {
    max-width: min(620px, calc(100vw - 28px));
    margin: 28px auto !important;
}

.modal-header,
.modal-footer {
    gap: 10px;
    border-color: var(--ui-border) !important;
}

.modal-footer {
    justify-content: flex-start;
}

.main-content {
    width: 100%;
    min-height: auto !important;
    padding: 8px 0 32px !important;
    justify-content: flex-start !important;
}

.welcome-message {
    width: 100%;
    margin-bottom: 24px !important;
    padding: 22px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow-soft);
}

.welcome-message h1,
.welcome-message h1[style] {
    margin-bottom: 8px !important;
    color: var(--ui-text) !important;
    font-size: 2rem !important;
}

.welcome-message p,
.welcome-message p[style] {
    margin-bottom: 0 !important;
    color: var(--ui-muted) !important;
    font-size: 1.1rem !important;
}

.chart-container {
    width: 100% !important;
    max-width: 860px !important;
    height: 440px !important;
    margin: 16px auto 36px !important;
    padding: 18px !important;
}

.total-debt {
    color: var(--ui-text) !important;
}

.amount {
    color: inherit !important;
    font-weight: 800;
    white-space: nowrap;
}

@media (min-width: 992px) {
    .menu-toggle {
        display: none !important;
    }

    .sidebar,
    .sidebar.hidden,
    .sidebar.visible {
        transform: translateX(0) !important;
        position: fixed !important;
        right: 0 !important;
        left: auto !important;
    }

    .page main:not(.full-width) {
        margin-right: var(--ui-sidebar-width);
        width: calc(100% - var(--ui-sidebar-width));
        padding: 28px;
    }
}

@media (max-width: 991.98px) {
    main {
        padding: 70px 14px 24px;
    }

    main.full-width {
        padding: 0;
    }

    .content {
        padding-bottom: 24px;
    }

    .container,
    .container-fluid {
        padding: 14px;
    }

    .content > .d-flex.justify-content-between {
        flex-wrap: wrap;
        justify-content: center !important;
    }

    .content > .d-flex.justify-content-between h4 {
        width: 100%;
        order: -1;
    }

    .content > .d-flex.justify-content-between .btn {
        flex: 1 1 150px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 16px;
    }

    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.45rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.05rem; }

    .login-container,
    .register-page {
        padding: 14px !important;
        align-items: flex-start !important;
    }

    .login-box,
    .register-box {
        padding: 20px !important;
        margin-top: 18px;
    }

    .register-header h2,
    .login-box h2 {
        font-size: 1.45rem !important;
    }

    .input-group {
        flex-wrap: nowrap;
    }

    .register-form .input-group {
        flex-wrap: wrap;
        gap: 8px;
    }

    .register-form .input-group .form-control,
    .register-form .input-group .btn {
        width: 100%;
        flex: 1 1 100%;
    }

    .btn-group,
    .button-group,
    .modal-footer,
    .col-12.d-flex {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    .col-12.d-flex .btn,
    .modal-footer .btn,
    form > .btn,
    form > button.btn {
        width: 100% !important;
    }

    .table-responsive {
        margin-inline: -2px;
    }

    .table {
        min-width: 680px;
        font-size: 0.92rem;
    }

    .table th,
    .table td {
        padding: 10px 8px !important;
    }

    .table td:last-child {
        min-width: 190px;
    }

    .chart-container {
        height: 330px !important;
        padding: 12px !important;
    }

    .welcome-message {
        padding: 18px;
    }

    .welcome-message h1,
    .welcome-message h1[style] {
        font-size: 1.55rem !important;
    }

    .welcome-message p,
    .welcome-message p[style] {
        font-size: 1rem !important;
    }
}
/* Wolt tracker */
.wolt-shell {
    display: grid;
    gap: 16px;
    width: 100%;
}

.wolt-panel,
.wolt-stat {
    background: var(--app-surface, #fff);
    border: 1px solid var(--app-border, #d8e0ea);
    border-radius: 8px;
    box-shadow: var(--app-shadow-soft, 0 2px 10px rgba(15, 23, 42, 0.07));
    padding: 18px;
}

.wolt-entry-panel {
    display: grid;
    gap: 16px;
}

.wolt-eyebrow {
    margin: 0 0 4px;
    color: var(--app-primary, #2563eb);
    font-size: 0.84rem;
    font-weight: 800;
}

.wolt-panel h4 {
    margin: 0;
    color: var(--app-text, #182230);
    font-size: 1.2rem;
}

.wolt-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.wolt-stat {
    min-height: 116px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
}

.wolt-stat span,
.wolt-result-table span {
    color: var(--app-muted, #64748b);
    font-weight: 700;
}

.wolt-stat strong {
    color: var(--app-text, #182230);
    font-size: 1.35rem;
    line-height: 1.25;
}

.wolt-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.wolt-result-table {
    display: grid;
    border: 1px solid var(--app-border, #d8e0ea);
    border-radius: 8px;
    overflow: hidden;
}

.wolt-result-table div {
    display: grid;
    grid-template-columns: minmax(160px, 0.65fr) minmax(0, 1fr);
    gap: 12px;
    padding: 13px 14px;
    background: #fff;
    border-bottom: 1px solid var(--app-border, #d8e0ea);
}

.wolt-result-table div:nth-child(even) {
    background: #f8fafc;
}

.wolt-result-table div:last-child {
    border-bottom: 0;
}

.wolt-result-table strong {
    color: var(--app-text, #182230);
    overflow-wrap: anywhere;
}

.wolt-holiday-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.wolt-holiday {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid var(--app-border, #d8e0ea);
    border-radius: 999px;
    background: #fff;
    color: var(--app-text, #182230);
    padding: 8px 12px;
    cursor: pointer;
}

.wolt-holiday span {
    color: var(--app-muted, #64748b);
}

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

@media (max-width: 640px) {
    .wolt-panel,
    .wolt-stat {
        padding: 15px;
    }

    .wolt-summary-grid {
        grid-template-columns: 1fr;
    }

    .wolt-section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .wolt-section-header .btn {
        width: 100%;
    }

    .wolt-result-table div {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}
