:root {
    --ink: #17243b;
    --muted: #78859b;
    --primary: #176b70;
    --primary-dark: #10565b;
    --accent: #e6a84b;
    --surface: #fff;
    --canvas: #f3f6fa;
    --line: #e7edf3;
    --shadow: 0 14px 40px rgba(24, 43, 67, .075);
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Tajawal", sans-serif;
    font-size: 1rem;
    line-height: 1.65;
}

a { text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-navbar {
    position: relative;
    z-index: 20;
    padding: .8rem 0;
    color: #fff;
    background: linear-gradient(112deg, #123f54 0%, #176b70 58%, #21827b 100%);
    box-shadow: 0 8px 26px rgba(18, 63, 84, .18);
}

.app-navbar::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 1px;
    background: rgba(255, 255, 255, .18);
    content: "";
}

.navbar-container { gap: 1.5rem; }
.navbar-brand { gap: .75rem; color: #fff; font-size: 1.12rem; white-space: nowrap; }
.navbar-brand:hover, .navbar-brand:focus { color: #fff; }
.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 14px;
    background: rgba(255,255,255,.13);
    color: #fff;
    font-size: 1.25rem;
}
.navbar-toggler { border-color: rgba(255,255,255,.3); }
.navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(255,255,255,.2); }
.navbar-collapse { align-items: center; gap: 1rem; }
.app-nav-links { gap: .2rem; }
.nav-account { display: flex; align-items: center; gap: .75rem; }
.logout-form { display: flex; flex: 0 0 auto; margin-inline-start: .5rem; }
.app-nav-links .nav-link {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem .72rem;
    border-radius: 11px;
    color: rgba(255,255,255,.78);
    font-size: .94rem;
    white-space: nowrap;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}
.app-nav-links .nav-link:hover { color: #fff; background: rgba(255,255,255,.11); transform: translateY(-1px); }
.app-nav-links .nav-link.active { color: #fff; background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.11); }
.nav-icon { font-size: 1rem; }
.user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem .7rem;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    background: rgba(255,255,255,.09);
    white-space: nowrap;
}
.user-avatar {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
}
.user-name { font-size: .9rem; }
.user-role { display: block; color: rgba(255,255,255,.7); font-size: .76rem; line-height: 1.1; }
.app-navbar .logout-button { min-height: 40px; border: 1px solid #f4cb7c; border-radius: 11px; background: #f4cb7c; color: #123f54; font-weight: 800; white-space: nowrap; }
.app-navbar .logout-button:hover, .app-navbar .logout-button:focus-visible { border-color: #ffdc9c; background: #ffdc9c; color: #123f54; box-shadow: 0 0 0 .2rem rgba(244,203,124,.25); }

main.container-fluid { padding-top: 2rem !important; padding-bottom: 3rem !important; }
.container-xl { max-width: 1440px; }
.card {
    overflow: hidden;
    border: 1px solid rgba(223, 231, 239, .82);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: box-shadow .2s ease, transform .2s ease;
}
.card-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: 58px;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 1.08rem;
    font-weight: 800;
}
.card-body { padding: 1.35rem; }
.card-header .bi { color: var(--primary); }

h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 800; }
.page-heading { margin-bottom: 1.4rem; }
.page-heading h1, .page-heading h2 { margin: 0; font-size: clamp(1.45rem, 2.2vw, 2rem); }
.page-heading p { margin: .25rem 0 0; color: var(--muted); }
.page-heading-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 16px;
    background: #e4f2f1;
    color: var(--primary);
    font-size: 1.4rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: .52rem .9rem;
    border-radius: 11px;
    font-weight: 700;
    transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { border-color: var(--primary); background: var(--primary); }
.btn-primary:hover, .btn-primary:focus { border-color: var(--primary-dark); background: var(--primary-dark); box-shadow: 0 6px 15px rgba(23,107,112,.2); }
.btn-outline-primary { border-color: rgba(23,107,112,.35); color: var(--primary); }
.btn-outline-primary:hover { border-color: var(--primary); background: var(--primary); }
.btn-light { color: var(--ink); }
.btn-sm { min-height: 34px; padding: .32rem .65rem; border-radius: 9px; font-size: .88rem; }

.form-label { margin-bottom: .4rem; color: #34445c; font-weight: 700; }
.form-control, .form-select {
    min-height: 46px;
    border: 1px solid #dfe6ee;
    border-radius: 11px;
    background-color: #fff;
    color: var(--ink);
    transition: border-color .16s ease, box-shadow .16s ease;
}
textarea.form-control { min-height: 100px; }
.form-control::placeholder { color: #a2adbc; }
.form-control:focus, .form-select:focus {
    border-color: rgba(23,107,112,.58);
    box-shadow: 0 0 0 .22rem rgba(23,107,112,.11);
}
.form-control[readonly] { background: #f5f8fa; }
.form-text, .text-muted { color: var(--muted) !important; }
.form-check-input:checked { border-color: var(--primary); background-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(23,107,112,.15); }

.table-responsive { border-radius: 13px; }
.table { margin-bottom: 0; color: var(--ink); vertical-align: middle; }
.table > :not(caption) > * > * { padding: .82rem .8rem; border-bottom-color: #edf1f5; }
.table thead th {
    border-bottom: 1px solid #e6ebf0;
    background: #f6f8fa;
    color: #64738a;
    font-size: .88rem;
    font-weight: 800;
    white-space: nowrap;
}
.table tbody tr { transition: background-color .14s ease; }
.table tbody tr:hover { background: #f7fafb; }
.table tbody tr:last-child > * { border-bottom: 0; }
.actions-cell { min-width: 160px; white-space: nowrap; }
.actions-cell form { display: inline-block; }
.session-summary { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; padding: 1rem; border: 1px solid #dcecea; border-radius: 12px; background: #f3f9f8; }
.session-summary strong { color: var(--primary-dark); }

.stat {
    position: relative;
    display: flex;
    min-height: 144px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    overflow: hidden;
    padding: 1.35rem;
    border: 1px solid rgba(223,231,239,.9);
    border-radius: var(--radius);
    background: linear-gradient(145deg,#fff 20%,#f8fbfc 100%);
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: 0 18px 38px rgba(24,43,67,.11); }
.stat::after {
    position: absolute;
    top: -30px;
    left: -24px;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: rgba(23,107,112,.045);
    content: "";
}
.stat-label { color: var(--muted); font-weight: 700; }
.stat .num { margin-top: .2rem; color: var(--ink); font-size: 2rem; font-weight: 800; line-height: 1.1; }
.stat-icon {
    display: grid;
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    place-items: center;
    border-radius: 17px;
    background: #e4f2f1;
    color: var(--primary);
    font-size: 1.4rem;
}
.stat-blue .stat-icon { background: #e8efff; color: #5478cb; }
.stat-gold .stat-icon { background: #fff4df; color: #c58a2d; }
.stat-violet .stat-icon { background: #f0ebff; color: #8160bc; }
.badge-soft { padding: .55rem .8rem; border: 1px solid #dcecea; border-radius: 999px; background: #eaf5f3; color: var(--primary); font-weight: 700; }
.shortcut-card { height: 100%; padding: 1.35rem; border: 1px solid var(--line); border-radius: 15px; background: #fff; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.shortcut-card:hover { transform: translateY(-3px); border-color: #b7d7d4; box-shadow: 0 12px 26px rgba(24,43,67,.08); }
.shortcut-icon { display: grid; width: 44px; height: 44px; margin-bottom: .9rem; place-items: center; border-radius: 14px; background: #eaf5f3; color: var(--primary); font-size: 1.2rem; }
.shortcut-card strong { display: block; color: var(--ink); }
.shortcut-card span:last-child { color: var(--muted); font-size: .9rem; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .9rem 1rem;
    border: 1px solid transparent;
    border-radius: 13px;
    font-weight: 600;
}
.alert-success { border-color: #c8e8d8; background: #effaf4; color: #176c43; }
.alert-danger { border-color: #f1cece; background: #fff4f3; color: #a43e3e; }
.alert-warning { border-color: #f2dfb6; background: #fff9eb; color: #85621c; }
.alert-info { border-color: #c8e4ed; background: #eff9fc; color: #246579; }
.alert-icon { flex: 0 0 auto; font-size: 1.15rem; }
.alert .btn-close { margin: .1rem 0 0 auto; padding: .55rem; }
.toast-container { z-index: 1090; }
.app-toast {
    min-width: min(360px, calc(100vw - 2rem));
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 42px rgba(24,43,67,.2);
}
.app-toast .toast-body { display: flex; align-items: center; gap: .7rem; padding: .95rem 1rem; font-weight: 700; }
.app-toast-icon { font-size: 1.2rem; }
.app-toast-success .app-toast-icon { color: #198754; }
.app-toast-danger .app-toast-icon { color: #dc3545; }
.app-toast-warning .app-toast-icon { color: #b98216; }
.app-toast-info .app-toast-icon { color: #0b7285; }

.ajax-box { position: relative; }
.ajax-results {
    position: absolute;
    z-index: 1050;
    top: 100%;
    right: 0;
    left: 0;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(24,43,67,.15);
}
.ajax-results:empty { display: none; }
.ajax-result-item { display: block; width: 100%; padding: .75rem .9rem; border: 0; border-bottom: 1px solid #edf1f5; background: #fff; text-align: right; }
.ajax-result-item:hover, .ajax-result-item:focus { background: #eff7f6; }
.ajax-empty-state { display: grid; justify-items: start; gap: .55rem; padding: .85rem .95rem; }
.ajax-empty-message { display: flex; align-items: center; gap: .5rem; color: #80621f; font-weight: 700; }
.ajax-empty-message::before { color: #c28b29; font-family: "bootstrap-icons"; content: "\f33a"; }
.price-edit { max-width: 120px; }

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(ellipse at 12% 14%, rgba(32,130,123,.12), transparent 34%),
        radial-gradient(ellipse at 88% 90%, rgba(230,168,75,.12), transparent 30%),
        #f2f6f8;
}
.login-layout {
    display: grid;
    width: min(100%, 1040px);
    min-height: 610px;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border: 1px solid rgba(223,231,239,.8);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(19,54,69,.15);
}
.login-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(2rem,5vw,4rem);
    background: linear-gradient(145deg,#123f54 0%,#176b70 65%,#21827b 100%);
    color: #fff;
}
.login-brand-panel::before, .login-brand-panel::after { position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; content: ""; }
.login-brand-panel::before { top: 12%; left: -130px; width: 360px; height: 360px; }
.login-brand-panel::after { bottom: -180px; right: -120px; width: 430px; height: 430px; }
.login-brand-content, .login-brand-footer { position: relative; z-index: 1; }
.login-brand-mark {
    display: grid;
    width: 72px;
    height: 72px;
    margin-bottom: 2rem;
    place-items: center;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 23px;
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: 2rem;
    box-shadow: 0 12px 28px rgba(0,0,0,.1);
}
.login-brand-panel h1 { max-width: 400px; margin-bottom: 1rem; color: #fff; font-size: clamp(1.8rem,3vw,2.7rem); line-height: 1.35; }
.login-brand-panel p { max-width: 400px; color: rgba(255,255,255,.78); font-size: 1.08rem; }
.login-feature { display: flex; align-items: center; gap: .65rem; margin-top: 1.5rem; color: rgba(255,255,255,.9); }
.login-feature .bi { color: #f2c371; }
.login-brand-footer { color: rgba(255,255,255,.65); font-size: .9rem; }
.login-form-panel { display: grid; align-content: center; padding: clamp(2rem,5vw,4rem); }
.login-card { width: 100%; }
.login-card h2 { margin-bottom: .35rem; font-size: 1.8rem; }
.login-card .login-subtitle { margin-bottom: 2rem; color: var(--muted); }
.login-submit { min-height: 50px; margin-top: .6rem; font-size: 1.05rem; }
.password-field { position: relative; }
.password-field .form-control { padding-left: 3rem; }
.password-toggle { position: absolute; top: 50%; left: .55rem; width: 36px; height: 36px; transform: translateY(-50%); border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.password-toggle:hover { background: #f1f5f7; color: var(--primary); }

@media (max-width: 1199.98px) {
    .navbar-container { gap: .7rem; }
    .navbar-brand { font-size: 1rem; }
    .app-nav-links .nav-link { padding: .5rem .55rem; font-size: .88rem; }
    .app-nav-links .nav-icon { display: none; }
}
@media (max-width: 991.98px) {
    .navbar-collapse { padding-top: 1rem; }
    .app-nav-links { align-items: stretch !important; }
    .app-nav-links .nav-link { padding: .65rem .8rem; font-size: .98rem; }
    .app-nav-links .nav-icon { display: inline; }
    .nav-account { display: flex; align-items: center; justify-content: flex-start; gap: .75rem; padding-top: .8rem; border-top: 1px solid rgba(255,255,255,.16); }
    .logout-form { margin-inline-start: auto; }
}
@media (max-width: 767.98px) {
    main.container-fluid { padding-top: 1.2rem !important; }
    .card-body { padding: 1rem; }
    .card-header { min-height: 52px; padding: .8rem 1rem; }
    .stat { min-height: 122px; padding: 1rem; }
    .stat-icon { width: 44px; height: 44px; flex-basis: 44px; border-radius: 14px; }
    .stat .num { font-size: 1.65rem; }
    .table { font-size: .92rem; }
    .table > :not(caption) > * > * { padding: .7rem .6rem; }
    .login-page { padding: 1rem; }
    .login-layout { min-height: auto; grid-template-columns: 1fr; border-radius: 22px; }
    .login-brand-panel { min-height: 225px; padding: 1.6rem; }
    .login-brand-mark { width: 54px; height: 54px; margin-bottom: 1rem; border-radius: 17px; font-size: 1.5rem; }
    .login-brand-panel h1 { margin-bottom: .4rem; font-size: 1.65rem; }
    .login-brand-panel p { margin-bottom: .5rem; font-size: .95rem; }
    .login-feature, .login-brand-footer { display: none; }
    .login-form-panel { padding: 1.6rem; }
}
@media (max-width: 575.98px) {
    .navbar-container { gap: .5rem; }
    .navbar-brand { gap: .45rem; font-size: .92rem; white-space: normal; }
    .brand-mark { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 12px; }
    .logout-button { width: 40px; min-height: 40px; padding: .4rem; }
    .logout-button span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media print {
    nav, .no-print, .btn, .toast-container { display: none !important; }
    body { background: #fff; }
    .card { border: 0; box-shadow: none; }
    .container-xl { max-width: 100%; }
}
