:root {
    --sidebar-width: 220px;
    --header-height: 64px;
    --bn-bg: #0b0e11;
    --bn-bg-elevated: #181a20;
    --bn-bg-card: #1e2329;
    --bn-bg-hover: #2b3139;
    --bn-border: #2b3139;
    --bn-border-light: #363c45;
    --bn-yellow: #f0b90b;
    --bn-yellow-hover: #fcd535;
    --bn-text: #eaecef;
    --bn-text-secondary: #b7bdc6;
    --bn-text-muted: #848e9c;
    --bn-green: #0ecb81;
    --bn-red: #f6465d;
    --bn-radius: 4px;
}

* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bn-bg);
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--bn-text);
    font-size: 14px;
    line-height: 1.5;
}

/* ── App shell (Binance layout) ── */
.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    height: var(--header-height);
    background: var(--bn-bg-elevated);
    border-bottom: 1px solid var(--bn-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--bn-text);
}

.header-logo {
    width: 28px;
    height: 28px;
    background: var(--bn-yellow);
    border-radius: var(--bn-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0b0e11;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.header-brand-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-user-info {
    text-align: right;
    line-height: 1.3;
}

.header-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--bn-text);
}

.header-user-role {
    font-size: 11px;
    color: var(--bn-text-muted);
    text-transform: capitalize;
}

.app-body {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bn-bg-elevated);
    border-right: 1px solid var(--bn-border);
    position: fixed;
    top: var(--header-height);
    left: 0;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    z-index: 1040;
    transition: transform .2s ease;
    padding: 12px 0;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--bn-text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: color .15s, background .15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a i {
    font-size: 16px;
    width: 18px;
    text-align: center;
    color: var(--bn-text-muted);
}

.sidebar-nav a:hover {
    color: var(--bn-text);
    background: var(--bn-bg-hover);
}

.sidebar-nav a:hover i {
    color: var(--bn-text-secondary);
}

.sidebar-nav a.active {
    color: var(--bn-yellow);
    background: rgba(240, 185, 11, 0.06);
    border-left-color: var(--bn-yellow);
}

.sidebar-nav a.active i {
    color: var(--bn-yellow);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--bn-border);
    margin-top: 12px;
}

/* ── Main content ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    background: var(--bn-bg);
}

.page-content {
    padding: 24px;
    max-width: 1400px;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--bn-border);
    color: var(--bn-text);
    width: 36px;
    height: 36px;
    border-radius: var(--bn-radius);
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.mobile-menu-btn:hover {
    background: var(--bn-bg-hover);
    color: var(--bn-yellow);
}

/* ── Page header ── */
.page-header h1 {
    color: var(--bn-text);
    font-weight: 600;
    font-size: 24px;
    letter-spacing: -0.02em;
}

.page-header .text-muted {
    color: var(--bn-text-muted) !important;
    font-size: 14px;
}

/* ── Stat cards (Binance metric tiles) ── */
.stat-card {
    background: var(--bn-bg-card) !important;
    border: 1px solid var(--bn-border) !important;
    border-radius: var(--bn-radius) !important;
    box-shadow: none !important;
    transition: border-color .15s;
}

.stat-card:hover {
    border-color: var(--bn-border-light) !important;
}

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

.stat-card .stat-label {
    font-size: 12px;
    color: var(--bn-text-muted);
    margin-bottom: 8px;
    font-weight: 400;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--bn-text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--bn-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--bn-bg-hover);
    color: var(--bn-yellow);
    flex-shrink: 0;
}

/* ── Cards ── */
.card {
    background: var(--bn-bg-card);
    border: 1px solid var(--bn-border);
    border-radius: var(--bn-radius);
    box-shadow: none;
    color: var(--bn-text);
}

.card-header {
    background: var(--bn-bg-card) !important;
    border-bottom: 1px solid var(--bn-border);
    padding: 16px 20px;
    font-weight: 500;
    font-size: 14px;
    color: var(--bn-text);
}

.card-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header-bar a {
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
    color: var(--bn-yellow);
}

.card-header-bar a:hover {
    color: var(--bn-yellow-hover);
}

.card-body {
    padding: 20px;
}

/* ── Tables ── */
.table-responsive {
    border-radius: 0;
}

.table {
    margin-bottom: 0;
    color: var(--bn-text);
    --bs-table-bg: transparent;
    --bs-table-color: var(--bn-text);
    --bs-table-border-color: var(--bn-border);
    --bs-table-hover-bg: var(--bn-bg-hover);
    --bs-table-hover-color: var(--bn-text);
}

.table thead th {
    background: var(--bn-bg-elevated);
    border-bottom: 1px solid var(--bn-border);
    white-space: nowrap;
    font-size: 12px;
    font-weight: 400;
    color: var(--bn-text-muted);
    padding: 12px 20px;
    text-transform: none;
    letter-spacing: 0;
}

.table tbody td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--bn-border);
    color: var(--bn-text);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-hover > tbody > tr:hover > * {
    background: var(--bn-bg-hover);
    color: var(--bn-text);
}

/* ── List groups ── */
.list-group-item {
    background: var(--bn-bg-card);
    border-color: var(--bn-border);
    color: var(--bn-text);
    padding: 14px 20px;
    font-size: 14px;
}

.list-group-item strong {
    color: var(--bn-text);
}

.list-group-flush > .list-group-item {
    border-left: 0;
    border-right: 0;
}

/* ── Forms ── */
.form-label {
    font-size: 12px;
    font-weight: 400;
    color: var(--bn-text-muted);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    background-color: var(--bn-bg);
    border: 1px solid var(--bn-border);
    border-radius: var(--bn-radius);
    color: var(--bn-text);
    font-size: 14px;
    padding: 10px 12px;
    transition: border-color .15s;
}

.form-control::placeholder {
    color: var(--bn-text-muted);
}

.form-control:focus {
    background-color: var(--bn-bg);
    border-color: var(--bn-yellow);
    color: var(--bn-text);
    box-shadow: none;
}

.form-select {
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23848e9c' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.form-select:focus {
    background-color: var(--bn-bg);
    border-color: var(--bn-yellow);
    color: var(--bn-text);
    box-shadow: none;
}

/* ── Buttons ── */
.btn {
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--bn-radius);
    padding: 10px 16px;
    transition: all .15s ease;
}

.btn-sm {
    font-size: 13px;
    padding: 6px 12px;
}

.btn-primary {
    background: var(--bn-yellow);
    border-color: var(--bn-yellow);
    color: #0b0e11;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: var(--bn-yellow-hover) !important;
    border-color: var(--bn-yellow-hover) !important;
    color: #0b0e11 !important;
    box-shadow: none !important;
}

.btn-outline-primary {
    color: var(--bn-yellow);
    border-color: var(--bn-border);
    background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: rgba(240, 185, 11, 0.08);
    border-color: var(--bn-yellow);
    color: var(--bn-yellow);
}

.btn-outline-light {
    color: var(--bn-text-secondary);
    border-color: var(--bn-border);
    background: transparent;
}

.btn-outline-light:hover {
    background: var(--bn-bg-hover);
    border-color: var(--bn-border-light);
    color: var(--bn-text);
}

.btn-outline-danger {
    color: var(--bn-red);
    border-color: var(--bn-border);
}

.btn-outline-danger:hover {
    background: rgba(246, 70, 93, 0.1);
    border-color: var(--bn-red);
    color: var(--bn-red);
}

.btn-secondary {
    background: var(--bn-bg-hover);
    border-color: var(--bn-border);
    color: var(--bn-text);
}

.btn-secondary:hover {
    background: var(--bn-border-light);
    border-color: var(--bn-border-light);
    color: var(--bn-text);
}

.btn-close {
    filter: invert(1) grayscale(1);
    opacity: 0.5;
}

/* ── Badges ── */
.badge {
    font-weight: 500;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--bn-radius);
}

.badge-status-success { background: rgba(14, 203, 129, 0.15); color: var(--bn-green); }
.badge-status-danger { background: rgba(246, 70, 93, 0.15); color: var(--bn-red); }
.badge-status-warning { background: rgba(240, 185, 11, 0.15); color: var(--bn-yellow); }
.badge-status-info { background: rgba(56, 136, 255, 0.15); color: #3888ff; }
.badge-status-secondary { background: var(--bn-bg-hover); color: var(--bn-text-muted); }
.badge-status-primary { background: rgba(240, 185, 11, 0.12); color: var(--bn-yellow); }

/* ── Alerts ── */
.alert {
    border-radius: var(--bn-radius);
    border: 1px solid var(--bn-border);
    font-size: 14px;
    font-weight: 400;
}

.alert-success {
    background: rgba(14, 203, 129, 0.1);
    border-color: rgba(14, 203, 129, 0.3);
    color: var(--bn-green);
}

.alert-danger {
    background: rgba(246, 70, 93, 0.1);
    border-color: rgba(246, 70, 93, 0.3);
    color: var(--bn-red);
}

.alert-warning {
    background: rgba(240, 185, 11, 0.1);
    border-color: rgba(240, 185, 11, 0.3);
    color: var(--bn-yellow);
}

/* ── Filter bar ── */
.filter-bar {
    background: var(--bn-bg-card);
    border-radius: var(--bn-radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--bn-border);
}

/* ── Empty states ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--bn-text-muted);
}

.empty-state i {
    font-size: 32px;
    opacity: 0.3;
    display: block;
    margin-bottom: 12px;
}

/* ── Highlight card ── */
.highlight-card {
    border-top: 2px solid var(--bn-yellow) !important;
}

.highlight-card .display-6 {
    font-weight: 600;
    color: var(--bn-text);
    font-size: 32px;
}

.highlight-card a {
    color: var(--bn-yellow);
    text-decoration: none;
    font-size: 13px;
}

.highlight-card a:hover {
    color: var(--bn-yellow-hover);
}

/* ── Login page (Binance style) ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bn-bg);
    padding: 24px;
}

.login-card {
    max-width: 384px;
    width: 100%;
    background: var(--bn-bg-card);
    border: 1px solid var(--bn-border);
    border-radius: var(--bn-radius);
    box-shadow: none;
}

.login-brand {
    text-align: center;
}

.login-brand-icon {
    width: 48px;
    height: 48px;
    background: var(--bn-yellow);
    border-radius: var(--bn-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.login-brand-icon i {
    font-size: 22px;
    color: #0b0e11;
}

.login-brand h2 {
    font-weight: 600;
    font-size: 24px;
    color: var(--bn-text);
    letter-spacing: -0.02em;
}

.login-brand p {
    color: var(--bn-text-muted) !important;
}

.login-footer {
    text-align: center;
    font-size: 12px;
    color: var(--bn-text-muted);
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--bn-border);
}

.input-group-icon {
    position: relative;
}

.input-group-icon .form-control {
    padding-left: 40px;
}

.input-group-icon .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bn-text-muted);
    font-size: 14px;
    z-index: 4;
    pointer-events: none;
}

/* ── Text utilities override ── */
.text-muted { color: var(--bn-text-muted) !important; }
.text-success { color: var(--bn-green) !important; }
.text-danger { color: var(--bn-red) !important; }
.text-primary { color: var(--bn-yellow) !important; }

/* ── Pagination ── */
.page-link {
    background: var(--bn-bg-card);
    border-color: var(--bn-border);
    color: var(--bn-text-secondary);
}

.page-link:hover {
    background: var(--bn-bg-hover);
    border-color: var(--bn-border);
    color: var(--bn-yellow);
}

.page-item.active .page-link {
    background: var(--bn-yellow);
    border-color: var(--bn-yellow);
    color: #0b0e11;
}

/* ── Modal ── */
.modal-content {
    background: var(--bn-bg-card);
    border: 1px solid var(--bn-border);
    color: var(--bn-text);
}

.modal-header {
    border-bottom-color: var(--bn-border);
}

.modal-footer {
    border-top-color: var(--bn-border);
}

/* ── Dropdown ── */
.dropdown-menu {
    background: var(--bn-bg-card);
    border: 1px solid var(--bn-border);
}

.dropdown-item {
    color: var(--bn-text-secondary);
}

.dropdown-item:hover {
    background: var(--bn-bg-hover);
    color: var(--bn-text);
}

/* ── Bootstrap overrides (dark theme everywhere) ── */
.card.shadow-sm,
.card.shadow-sm.border-0,
.card.border-0 {
    background: var(--bn-bg-card) !important;
    border: 1px solid var(--bn-border) !important;
    box-shadow: none !important;
}

.card-header.bg-white,
.card-header {
    background: var(--bn-bg-card) !important;
    color: var(--bn-text) !important;
    border-bottom: 1px solid var(--bn-border) !important;
}

.bg-white { background: var(--bn-bg-card) !important; }
.bg-light { background: var(--bn-bg) !important; color: var(--bn-text-muted) !important; }

.form-control.bg-light {
    border: 1px solid var(--bn-border);
}

h4, h5, h6, .h4, .h5, .h6 {
    color: var(--bn-text);
}

.text-warning { color: var(--bn-yellow) !important; }

hr {
    border-color: var(--bn-border);
    opacity: 1;
}

a {
    color: var(--bn-yellow);
}

a:hover {
    color: var(--bn-yellow-hover);
}

/* ── Arabic text ── */
.arabic-text {
    direction: rtl;
    text-align: right;
    font-family: 'Traditional Arabic', 'Segoe UI', serif;
}

/* ── User avatar ── */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bn-bg-hover);
    border: 1px solid var(--bn-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    color: var(--bn-yellow);
}

/* ── Sidebar overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .header-user-info {
        display: none;
    }

    .page-content {
        padding: 16px;
    }
}

@media (min-width: 992px) {
    .sidebar-footer {
        display: none;
    }
}

/* ── Schedule grid ── */
.day-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.day-tab {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--bn-border);
    border-radius: var(--bn-radius);
    color: var(--bn-text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all .15s;
}

.day-tab:hover {
    border-color: var(--bn-yellow);
    color: var(--bn-yellow);
}

.day-tab.active {
    background: rgba(240, 185, 11, 0.1);
    border-color: var(--bn-yellow);
    color: var(--bn-yellow);
}

.schedule-grid-card {
    overflow: hidden;
}

.schedule-grid-scroll {
    max-height: 70vh;
    overflow-y: auto;
}

.schedule-grid .slot-time {
    font-family: 'IBM Plex Sans', monospace;
    font-size: 13px;
    color: var(--bn-text-secondary);
    white-space: nowrap;
}

.schedule-grid tr.slot-assigned td:nth-child(2) strong {
    color: var(--bn-text);
}

.schedule-grid tr.slot-empty td:nth-child(2) {
    color: var(--bn-text-muted);
}

.slot-assign-form .form-select-sm {
    min-width: 140px;
    font-size: 13px;
    padding: 6px 10px;
}

.schedule-grid tbody tr:hover {
    background: var(--bn-bg-hover);
}
