@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --ink: #172033;
    --nav: #101827;
    --nav-soft: #1b2638;
    --orange: #f28c28;
    --orange-deep: #d96f11;
    --teal: #0e7c86;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #dde4ee;
    --line-strong: #c8d3e1;
    --muted: #697386;
    --green: #1f9d72;
    --red: #d94b58;
    --blue: #2563eb;
    --shadow-sm: 0 1px 2px rgba(23, 32, 51, .06);
    --shadow-md: 0 14px 34px rgba(23, 32, 51, .08);
    --focus: 0 0 0 4px rgba(242, 140, 40, .16);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Cairo, Arial, sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
}

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

button {
    cursor: pointer;
}

.sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    z-index: 20;
    width: 260px;
    padding: 22px 16px;
    overflow: auto;
    background: linear-gradient(180deg, var(--nav), #162033);
    color: #fff;
}

.logo {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 8px 20px;
    color: #fff;
    text-decoration: none;
}

.logo small,
.logo b {
    display: block;
}

.logo small {
    opacity: .6;
}

.brand-mark {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--orange), #ffb158);
    color: #fff;
    direction: ltr;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(242, 140, 40, .28);
}

.sidebar nav a {
    min-height: 42px;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 4px;
    padding: 10px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #bac2d1;
    font-size: 14px;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.sidebar nav a i {
    font-style: normal;
    font-size: 11px;
    opacity: .62;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .08);
    color: #fff;
}

.sidebar nav a:hover {
    transform: translateX(-2px);
}

.sidebar nav a.active {
    border-inline-end: 3px solid var(--orange);
}

.partner {
    margin: 25px 12px;
    color: #8390a6;
    font-size: 12px;
}

.partner b {
    color: #fff;
}

.theme-options { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; margin-bottom:24px; }
.theme-choice { display:flex; align-items:center; gap:9px; padding:12px; border:1px solid var(--line); border-radius:9px; background:var(--surface); cursor:pointer; }
.theme-choice span { width:28px; height:28px; border-radius:50%; background:var(--swatch); box-shadow:0 0 0 2px #fff,0 0 0 3px var(--line-strong); }
.theme-choice code { margin-inline-start:auto; direction:ltr; }
.schedule-break td { background:color-mix(in srgb,var(--theme-primary) 10%,#fff); color:var(--theme-primary); border-block:2px dashed color-mix(in srgb,var(--theme-primary) 35%,#fff); }

.page {
    margin-inline-end: 260px;
}

.topbar {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 32px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(14px);
}

.global-search input {
    width: min(340px, 38vw);
    border-color: transparent;
    background: #f2f5f9;
}

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

.account a,
.account button {
    border: 0;
    background: none;
    color: var(--ink);
    font-family: inherit;
    text-decoration: none;
}

.content {
    max-width: 1500px;
    margin: auto;
    padding: 30px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 24px;
}

.page-head h1 {
    margin: 3px 0;
    font-size: 28px;
    line-height: 1.3;
}

.eyebrow {
    margin: 0;
    color: var(--orange);
    font-size: 12px;
    font-weight: 800;
}

.muted {
    color: var(--muted);
}

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

.card,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
    line-height: 1;
}

.stat span {
    color: var(--muted);
    font-size: 13px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    margin-top: 18px;
}

.admin-dashboard-cards { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; }
.admin-stat { position:relative; min-height:112px; overflow:hidden; padding:18px 22px 16px 28px; }
.admin-stat::before { content:''; position:absolute; inset:17px auto 17px 0; width:5px; border-radius:8px; background:#2457b4; }
.admin-stat--teal::before { background:#28a6b5; }.admin-stat--gold::before { background:#e0a52b; }.admin-stat--green::before { background:#28a57d; }
.admin-stat strong { margin:8px 0 4px; color:#17223a; font-size:28px; }.admin-stat small { display:block; color:#7b8797; font-size:12px; }
.admin-dashboard-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; margin-top:18px; }
.admin-chart-panel { min-height:280px; }.admin-chart-value { color:#2457a9; font-size:20px; font-weight:800; }
.admin-bars { display:flex; align-items:end; justify-content:space-around; gap:14px; height:190px; padding:20px 14px 0; border-bottom:1px solid #e8edf5; }
.admin-bar-item { display:flex; flex:1; height:100%; flex-direction:column; align-items:center; justify-content:end; gap:8px; }.admin-bar { width:min(34px,70%); min-height:8px; border-radius:8px 8px 0 0; background:linear-gradient(180deg,#3c68c4,#7f9fe2); }.admin-bar-item small { color:#697386; font-size:12px; }
.admin-distribution { display:flex; flex-direction:column; gap:17px; padding-top:14px; }.admin-distribution-row { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center; color:#52617c; font-size:13px; }.admin-distribution-row b { color:#17223a; font-size:16px; }.admin-distribution-row i { grid-column:1/-1; display:block; height:8px; overflow:hidden; border-radius:99px; background:#edf1f7; }.admin-distribution-row em { display:block; height:100%; border-radius:inherit; background:#27a6b5; }
.admin-performance-row { display:grid; grid-template-columns:90px 1fr 35px; gap:12px; align-items:center; padding:13px 0; border-top:1px solid #edf1f5; color:#52617c; font-size:13px; }.admin-performance-row i { display:block; height:8px; overflow:hidden; border-radius:99px; background:#edf1f7; }.admin-performance-row em { display:block; height:100%; border-radius:inherit; background:#315bb4; }.admin-performance-row b { color:#17223a; text-align:left; }
.admin-activity { display:flex; align-items:flex-start; gap:10px; }.admin-activity-dot { width:8px; height:8px; flex:0 0 8px; margin-top:8px; border-radius:50%; background:#27a6b5; }.admin-activity small { display:block; margin-top:3px; color:#7b8797; font-size:11px; }.admin-attendance-table { margin-top:18px; }

.panel h2 {
    margin-top: 0;
    font-size: 18px;
}

.activity {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.activity:last-child {
    border: 0;
}

.activity small {
    display: block;
    color: var(--muted);
}

.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font: 700 14px Cairo;
    text-decoration: none;
    transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn.primary {
    background: linear-gradient(135deg, var(--orange), var(--orange-deep));
    color: #fff;
    box-shadow: 0 10px 24px rgba(242, 140, 40, .25);
}

.btn.secondary {
    border: 1px solid var(--line);
    background: #eef3f8;
    color: var(--ink);
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.filters input {
    min-width: 240px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
    width: auto;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background-color: var(--surface);
    color: var(--ink);
    padding: 10px 13px;
    outline: 0;
    box-shadow: 0 1px 0 rgba(23, 32, 51, .02);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
select:hover,
textarea:hover {
    border-color: var(--line-strong);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
select:focus,
textarea:focus {
    border-color: var(--orange);
    box-shadow: var(--focus);
}

input::placeholder,
textarea::placeholder {
    color: #9aa4b2;
}

textarea {
    min-height: 112px;
    resize: vertical;
    line-height: 1.8;
}

select {
    cursor: pointer;
}

select:not([multiple]) {
    appearance: none;
    -webkit-appearance: none;
    padding-inline-start: 44px;
    padding-inline-end: 13px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        left 18px center,
        left 12px center;
    background-repeat: no-repeat;
    background-size: 7px 7px;
}

select[multiple] {
    min-height: 136px;
    padding: 8px;
    cursor: default;
}

select[multiple] option {
    border-radius: 7px;
    padding: 8px 10px;
}

select[multiple] option:checked {
    background: linear-gradient(135deg, rgba(15, 118, 110, .16), rgba(242, 140, 40, .14));
    color: var(--ink);
}

input[type="file"] {
    padding: 7px;
}

input[type="file"]::file-selector-button {
    margin-inline-end: 10px;
    border: 0;
    border-radius: 7px;
    background: #eef3f8;
    color: var(--ink);
    padding: 8px 12px;
    font: 700 13px Cairo;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--orange);
}

select.native-select-hidden {
    position: absolute !important;
    inline-size: 1px !important;
    block-size: 1px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.select-ui {
    position: relative;
    display: inline-block;
    width: 100%;
    min-width: 0;
    vertical-align: middle;
}

.filters .select-ui {
    width: auto;
    min-width: 180px;
}

.select-ui__button {
    position: relative;
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    padding: 10px 13px 10px 44px;
    text-align: right;
    box-shadow: 0 1px 0 rgba(23, 32, 51, .02);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.select-ui__button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 17px;
    width: 8px;
    height: 8px;
    border-inline-end: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-65%) rotate(45deg);
    transition: transform .18s ease, border-color .18s ease;
}

.select-ui__button:hover,
.select-ui--open .select-ui__button {
    border-color: var(--line-strong);
    background: #fff;
}

.select-ui__button.is-placeholder {
    color: #8b95a5;
}

.select-ui__button:focus-visible,
.select-ui--open .select-ui__button {
    border-color: var(--orange);
    box-shadow: var(--focus);
    outline: 0;
}

.select-ui--open .select-ui__button::after {
    border-color: var(--orange);
    transform: translateY(-35%) rotate(225deg);
}

.select-ui__menu {
    position: fixed;
    z-index: 1000;
    display: none;
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(23, 32, 51, .16);
    padding: 6px;
    direction: rtl;
}

.select-ui__menu.open {
    display: grid;
    gap: 3px;
}

.select-ui__option {
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink);
    padding: 8px 10px;
    text-align: right;
}

.select-ui__option:hover,
.select-ui__option:focus-visible {
    background: #f3f6fa;
    outline: 0;
}

.select-ui__option.is-selected {
    background: linear-gradient(135deg, rgba(242, 140, 40, .16), rgba(15, 118, 110, .12));
    color: var(--ink);
    font-weight: 800;
}

.select-ui__option:disabled {
    color: #9aa4b2;
    cursor: not-allowed;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    min-width: 750px;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 16px;
    text-align: right;
    font-size: 14px;
}

th {
    background: var(--surface-soft);
    color: var(--muted);
    font-weight: 800;
}

td a {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

td form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

td .select-ui {
    width: auto;
    min-width: 128px;
}

td input[type="number"] {
    width: 140px;
}

tbody tr:hover {
    background: #fbfcfe;
}

.badge {
    display: inline-block;
    border-radius: 999px;
    background: #eef1f5;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.badge.active,
.badge.present,
.badge.published {
    background: #e5f6ef;
    color: var(--green);
}

.badge.inactive,
.badge.absent {
    background: #fdebee;
    color: var(--red);
}

.empty {
    padding: 55px;
    color: var(--muted);
    text-align: center;
}

.alert {
    margin-bottom: 18px;
    border-radius: 8px;
    padding: 13px 16px;
}

.success {
    background: #e5f6ef;
    color: #147252;
}

.error {
    background: #fdebee;
    color: #a92535;
}

.form-card {
    max-width: 950px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    padding: 22px;
}

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

.form-grid label {
    display: grid;
    gap: 7px;
    color: #344056;
    font-size: 14px;
    font-weight: 700;
}

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

.form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.form-grid select,
.form-grid textarea,
.login-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    width: 100%;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.pagination {
    margin-top: 16px;
}

.menu-toggle {
    display: none;
}

.login-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(135deg, #eef6f3 0%, #dcefeb 42%, #fff7e7 100%);
}

.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(120deg, transparent 0 18%, rgba(15, 118, 110, .1) 18% 32%, transparent 32% 100%),
        linear-gradient(60deg, transparent 0 56%, rgba(242, 140, 40, .16) 56% 68%, transparent 68% 100%);
}

.login-card {
    position: relative;
    width: min(430px, 92vw);
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 24px 60px rgba(15, 45, 55, .18);
    backdrop-filter: blur(18px) saturate(1.12);
    padding: 35px;
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, #0e7c86, #14b8a6, #f28c28);
}

.login-card h1 {
    margin-bottom: 4px;
}

.login-card label {
    display: grid;
    gap: 7px;
    margin: 15px 0;
    color: #344056;
    font-weight: 700;
}

.login-card .btn {
    width: 100%;
}

@media (prefers-reduced-motion: no-preference) {
    .login-card {
        animation: loginRise .42s cubic-bezier(.2, .8, .2, 1) both;
    }
}

@keyframes loginRise {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.check {
    display: flex !important;
    grid-template-columns: auto 1fr !important;
    align-items: center;
    color: var(--ink) !important;
}

.check input {
    width: 18px;
}

@media (max-width: 1024px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .admin-dashboard-cards { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 768px) {
    .sidebar {
        inset-inline-end: auto;
        inset-inline-start: 0;
        transform: translateX(105%);
        transition: transform .25s ease;
    }

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

    .page {
        margin-inline-end: 0;
    }

    .menu-toggle {
        position: fixed;
        top: 18px;
        right: 12px;
        z-index: 30;
        display: block;
        border: 0;
        border-radius: 8px;
        background: var(--orange);
        color: #fff;
        padding: 8px;
    }

    .topbar {
        padding: 0 60px 0 15px;
    }

    .global-search {
        display: none;
    }

    .content {
        padding: 20px 14px;
    }

    .grid-2,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-dashboard-grid { grid-template-columns:1fr; }

    .form-grid .wide {
        grid-column: auto;
    }
}

@media (max-width: 480px) {
    .cards {
        grid-template-columns: 1fr;
    }

    .admin-dashboard-cards { grid-template-columns:1fr 1fr; gap:10px; }

    .admin-stat { min-height:104px; padding:16px 14px 14px 21px; }
    .admin-stat strong { font-size:24px; }

    .page-head {
        align-items: start;
        gap: 12px;
    }

    .page-head h1 {
        font-size: 23px;
    }

    .filters input,
    .filters .select-ui,
    .filters select {
        width: 100%;
        min-width: 0;
    }
}
