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

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

.btn-login,
.btn-register {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

table {
    width: 100%;
}

.dashboard-container,
.admin-shell {
    min-width: 0;
}

.table-card,
.admin-card,
.market-card,
.metric-card,
.support-card,
.account-card,
.password-card {
    max-width: 100%;
}

.app-flash {
    position: fixed;
    top: 88px;
    left: 50%;
    z-index: 9999;
    width: min(92vw, 520px);
    padding: 0.9rem 1rem;
    border-radius: 8px;
    transform: translateX(-50%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

.app-flash-error {
    background: #be123c;
}

.app-flash-success {
    background: #047857;
}

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

@media (max-width: 1024px) {
    header,
    .header {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    nav ul {
        gap: 1rem !important;
        flex-wrap: wrap;
    }

    .dashboard-container,
    .main-content {
        min-width: 0;
    }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    body:not(.panel-shell) header {
        position: sticky !important;
        flex-wrap: wrap;
        gap: 1rem;
    }

    body:not(.panel-shell) header nav {
        display: block !important;
        width: 100%;
        order: 3;
    }

    body:not(.panel-shell) header .auth-buttons {
        display: flex !important;
    }

    body:not(.panel-shell) header nav ul {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem !important;
    }

    body:not(.panel-shell) .auth-buttons {
        width: 100%;
        justify-content: stretch;
    }

    body:not(.panel-shell) .auth-buttons a,
    body:not(.panel-shell) .auth-buttons button,
    body:not(.panel-shell) .btn-login,
    body:not(.panel-shell) .btn-register {
        flex: 1 1 0;
        min-width: 0;
        white-space: normal;
    }

    body:not(.panel-shell) .sidebar {
        width: 100% !important;
        min-height: auto !important;
        position: relative !important;
    }

    body:not(.panel-shell) .menu-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem;
    }

    body:not(.panel-shell) .menu-item a {
        transform: none !important;
        min-height: 44px;
    }

    body:not(.panel-shell) .main-content {
        width: 100%;
        min-height: auto;
    }

    body:not(.panel-shell) .header {
        height: auto !important;
        min-height: 64px;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    body:not(.panel-shell) .header h1 {
        font-size: clamp(1rem, 6vw, 1.45rem) !important;
        line-height: 1.25;
    }

    .dashboard-container {
        padding: 1rem !important;
    }

    .table-card,
    .admin-card,
    .market-card,
    .support-card,
    .account-card,
    .password-card {
        border-radius: 8px !important;
    }

    .page-action-row,
    .month-filter-group,
    .right-actions,
    .support-grid,
    .form-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100%;
    }

    .drawer {
        width: min(100%, 420px) !important;
    }

    table {
        min-width: 640px;
    }

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

@media (max-width: 480px) {
    body:not(.panel-shell) header nav ul,
    body:not(.panel-shell) .menu-list {
        grid-template-columns: 1fr;
    }

    body:not(.panel-shell) .logo,
    body:not(.panel-shell) .brand {
        font-size: 1.1rem !important;
    }

    body:not(.panel-shell) .btn-login,
    body:not(.panel-shell) .btn-register,
    body:not(.panel-shell) .action-btn,
    body:not(.panel-shell) .btn-submit,
    body:not(.panel-shell) .btn-submit-income {
        width: 100%;
    }

    .dashboard-container,
    .admin-shell {
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
    }
}

.inline-delete-form { display: inline-flex; margin: 0; }
.inline-delete-form button { cursor: pointer; }

a.calendar-day-cell {
    color: inherit;
    text-decoration: none;
}

button.timeline-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    line-height: 1;
}

.date-control {
    position: relative;
}

.date-control .date-display {
    cursor: pointer;
    padding-right: 2.75rem;
}

.date-control::after {
    content: "\f073";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.date-picker-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(100%, 320px);
    z-index: 10000;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
    padding: 0.85rem;
    color: #e2e8f0;
}

.date-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.date-picker-title {
    font-weight: 700;
    font-size: 0.92rem;
    text-transform: capitalize;
}

.date-picker-nav {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    cursor: pointer;
}

.date-picker-grid,
.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
}

.date-picker-weekdays {
    margin-bottom: 0.35rem;
    color: #94a3b8;
    font-size: 0.7rem;
    text-align: center;
    font-weight: 700;
}

.date-picker-day {
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 0.86rem;
}

.date-picker-day:hover {
    background: rgba(59, 130, 246, 0.22);
}

.date-picker-day.is-selected {
    background: #2563eb;
    color: #fff;
    font-weight: 800;
}

.date-picker-day.is-today {
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.75);
}

.date-picker-empty {
    min-height: 34px;
}
/* Shared panel logout controls */
.header-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.header-logout:hover,
.logout-btn:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.18);
}

.static-market-card {
    display: none !important;
}
