/* ============================================================================
   ExtraHours — app layer on top of the utility-clean design pack.
   Pack files (themes.css / motion-ui.css) are vendored and untouched; this file
   only extends them: app tokens, list+editor patterns, dark-canvas Bootstrap
   retune, RTL and mobile rules.
   ========================================================================== */

[data-theme="utility-clean"] {
    --eh-accent: var(--m-indigo);
    --eh-accent-2: var(--m-cyan);
    --eh-line: var(--m-border);
    --eh-surface: var(--m-surface);
    --eh-radius: var(--m-r);
    --eh-gap: 1rem;
    --eh-ok: #4ade80;
    --eh-warn: var(--m-amber);
    --eh-idle: #98a2b3;
}

/* ---------------------------------------------------------------- canvas */
html,
body { background: var(--m-bg); }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--m-text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1 0 auto;
    padding-block: 1.25rem 2.5rem;
}

::selection { background: var(--eh-accent); color: #08090b; }

a { color: var(--eh-accent-2); text-decoration: none; }
a:hover { color: var(--m-text); }

:focus-visible {
    outline: 2px solid var(--eh-accent-2);
    outline-offset: 2px;
    border-radius: 6px;
}

/* --------------------------------------------------------------- topbar */
.navbar.eh-top {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(11, 12, 14, .82) !important;
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--eh-line);
    padding-block: .55rem;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.05rem;
    height: 2.05rem;
    border-radius: 9px;
    background: var(--m-grad);
    color: #0a0b0d;
    font-weight: 800;
    font-size: .78rem;
    letter-spacing: .06em;
}

.navbar-brand .eh-brand-name { font-weight: 700; letter-spacing: -.01em; color: var(--m-text); }
.navbar-brand .eh-brand-sub { font-size: .68rem; color: var(--m-muted); display: block; line-height: 1.2; }

.eh-top .nav-link {
    color: var(--m-muted);
    font-size: .9rem;
    padding: .35rem .7rem;
    border-radius: 8px;
    transition: color var(--m-base) var(--m-ease), background var(--m-base) var(--m-ease);
}
.eh-top .nav-link:hover { color: var(--m-text); background: var(--m-surface-2); }
.eh-top .nav-link.is-active { color: var(--m-text); background: var(--m-surface-2); box-shadow: inset 0 -2px 0 var(--eh-accent-2); }
.navbar-toggler { border-color: var(--eh-line); }

/* language switcher: two visible options, current one marked */
.eh-lang {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--eh-line);
    border-radius: 999px;
    padding: 2px;
    background: var(--m-surface);
    font-size: .78rem;
}
.eh-lang a,
.eh-lang span {
    padding: .1rem .5rem;
    border-radius: 999px;
    color: var(--m-muted);
    line-height: 1.6;
}
.eh-lang a:hover { color: var(--m-text); }
.eh-lang .is-on { background: var(--m-surface-2); color: var(--m-text); font-weight: 700; }

.eh-user {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .8rem;
    color: var(--m-muted);
    max-width: 16ch;
}
.eh-user b { color: var(--m-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------- page header */
.eh-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.1rem;
}
.eh-head h1 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); margin: 0; font-weight: 800; letter-spacing: -.02em; }
.eh-head .eh-meta { font-size: .8rem; color: var(--m-muted); }

/* ------------------------------------------------------------ KPI strip */
.eh-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--eh-gap);
    margin-bottom: 1.15rem;
}
.eh-kpi-unit { font-size: .78rem; color: var(--m-muted); font-weight: 500; margin-inline-start: .25rem; }
.eh-kpi-note { font-size: .74rem; color: var(--m-muted); margin-top: .3rem; }

/* --------------------------------------------------- list + editor shell */
.eh-panel {
    background: var(--eh-surface);
    border: 1px solid var(--eh-line);
    border-radius: var(--eh-radius);
    overflow: hidden;
}
.eh-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--eh-line);
    background: var(--m-surface-2);
}
.eh-panel__title { font-size: .85rem; font-weight: 700; letter-spacing: .01em; }

.eh-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: flex-end;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--eh-line);
}
.eh-filters .form-label { font-size: .72rem; color: var(--m-muted); margin-bottom: .2rem; }
.eh-filters > div { min-width: 0; }

/* -------------------------------------------------------------- tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--m-text);
    --bs-table-border-color: var(--eh-line);
    --bs-table-hover-bg: rgba(255, 255, 255, .04);
    --bs-table-hover-color: var(--m-text);
    --bs-table-striped-bg: rgba(255, 255, 255, .02);
    margin: 0;
    font-size: .875rem;
}
.table > thead th {
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--m-muted);
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 1px solid var(--eh-line);
    padding: .6rem .75rem;
    background: transparent;
}
.table > tbody > tr > td { padding: .62rem .75rem; vertical-align: middle; border-color: rgba(255, 255, 255, .06); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table > tfoot > tr > th { border-top: 1px solid var(--eh-line); padding: .6rem .75rem; font-size: .8rem; color: var(--m-text); background: transparent; }
.table .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.table .code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .8rem; color: var(--eh-accent-2); letter-spacing: -.02em; }
.muted-sm { color: var(--m-muted); font-size: .78rem; }

/* avatar initial for list rows */
.eh-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 7px;
    background: var(--m-surface-2);
    border: 1px solid var(--eh-line);
    font-size: .72rem;
    font-weight: 700;
    color: var(--m-text);
    flex: 0 0 auto;
}
.eh-who { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.eh-who__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bootstrap's default table colour is near-black; on this canvas every cell
   must take the pack's text token explicitly (contrast defect found in the
   1440px render: name/department/number cells fell back to #212529). */
.table > tbody > tr > td,
.table > tbody > tr > th,
.table > tfoot > tr > td,
.table > tfoot > tr > th { color: var(--m-text); }
.table .muted-sm { color: var(--m-muted); }
.table .code { color: var(--eh-accent-2); }

/* -------------------------------------------------------------- badges */
.badge {
    font-weight: 600;
    font-size: .7rem;
    letter-spacing: .02em;
    padding: .28em .55em;
    border-radius: 6px;
    border: 1px solid transparent;
}
.badge.bg-success { background: rgba(74, 222, 128, .13) !important; color: var(--eh-ok) !important; border-color: rgba(74, 222, 128, .28); }
.badge.bg-warning { background: rgba(255, 206, 107, .14) !important; color: var(--eh-warn) !important; border-color: rgba(255, 206, 107, .3); }
.badge.bg-secondary { background: rgba(152, 162, 179, .14) !important; color: var(--eh-idle) !important; border-color: rgba(152, 162, 179, .28); }

/* --------------------------------------------------------- empty states */
.eh-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: 2.5rem 1rem;
    text-align: center;
}
.eh-empty__mark {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 12px;
    border: 1px dashed var(--eh-line);
    background: linear-gradient(140deg, rgba(124, 140, 255, .16), rgba(99, 216, 255, .08));
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: var(--m-muted);
    margin-bottom: .35rem;
}
.eh-empty__title { font-weight: 700; font-size: .92rem; }
.eh-empty__body { font-size: .8rem; color: var(--m-muted); max-width: 44ch; }

/* ------------------------------------------------------------ controls */
.btn { border-radius: 8px; font-size: .85rem; font-weight: 600; transition: transform var(--m-base) var(--m-ease), background var(--m-base) var(--m-ease), border-color var(--m-base) var(--m-ease); }
.btn-sm { font-size: .78rem; padding: .3rem .6rem; }
.btn-primary {
    --bs-btn-bg: var(--eh-accent);
    --bs-btn-border-color: var(--eh-accent);
    --bs-btn-hover-bg: #8f9dff;
    --bs-btn-hover-border-color: #8f9dff;
    --bs-btn-active-bg: #6b7bf0;
    --bs-btn-color: #08090b;
    --bs-btn-hover-color: #08090b;
    --bs-btn-active-color: #08090b;
}
.btn-outline-primary { --bs-btn-color: var(--eh-accent-2); --bs-btn-border-color: rgba(99, 216, 255, .35); --bs-btn-hover-bg: rgba(99, 216, 255, .12); --bs-btn-hover-color: var(--m-text); --bs-btn-hover-border-color: var(--eh-accent-2); --bs-btn-active-bg: rgba(99, 216, 255, .18); }
.btn-outline-secondary { --bs-btn-color: var(--m-muted); --bs-btn-border-color: var(--eh-line); --bs-btn-hover-bg: var(--m-surface-2); --bs-btn-hover-color: var(--m-text); --bs-btn-hover-border-color: rgba(255, 255, 255, .24); }
.btn-outline-warning { --bs-btn-color: var(--eh-warn); --bs-btn-border-color: rgba(255, 206, 107, .35); --bs-btn-hover-bg: rgba(255, 206, 107, .14); --bs-btn-hover-color: var(--m-text); }
.btn-outline-light { --bs-btn-color: var(--m-text); --bs-btn-border-color: var(--eh-line); --bs-btn-hover-bg: var(--m-surface-2); --bs-btn-hover-color: var(--m-text); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }

.form-control, .form-select {
    background: var(--m-surface);
    border: 1px solid var(--eh-line);
    color: var(--m-text);
    border-radius: 8px;
    font-size: .875rem;
}
.form-control::placeholder { color: #6b7280; }
.form-control:focus, .form-select:focus {
    background: var(--m-surface-2);
    border-color: var(--eh-accent-2);
    color: var(--m-text);
    box-shadow: 0 0 0 3px rgba(99, 216, 255, .14);
}
.form-select option { background: #121418; color: var(--m-text); }
.form-check-input { background-color: var(--m-surface-2); border-color: var(--eh-line); }
.form-check-input:checked { background-color: var(--eh-accent); border-color: var(--eh-accent); }
.form-label { font-size: .8rem; color: var(--m-muted); }
.form-check-label { font-size: .85rem; color: var(--m-text); }

.alert { border-radius: 10px; border: 1px solid var(--eh-line); font-size: .85rem; }
.alert-success { background: rgba(74, 222, 128, .1); color: var(--eh-ok); border-color: rgba(74, 222, 128, .3); }
.alert-danger { background: rgba(248, 113, 113, .1); color: #f87171; border-color: rgba(248, 113, 113, .3); }
.text-danger { color: #f87171 !important; }

/* login = split panel: brand story on the inline-start half, form on the other */
.eh-auth { display: grid; grid-template-columns: 1.05fr .95fr; max-width: 940px; margin: 1.5rem auto; border: 1px solid var(--eh-line); border-radius: var(--m-r-lg); overflow: hidden; background: var(--eh-surface); }
.eh-auth__aside {
    padding: 2.2rem;
    background:
        radial-gradient(120% 90% at 0% 0%, rgba(124, 140, 255, .22), transparent 60%),
        radial-gradient(90% 80% at 100% 100%, rgba(99, 216, 255, .14), transparent 65%),
        var(--m-bg-2);
    border-inline-end: 1px solid var(--eh-line);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
}
.eh-auth__form { padding: 2.2rem; }
.eh-auth__facts { display: grid; gap: .55rem; font-size: .82rem; color: var(--m-muted); padding: 0; margin: 0; list-style: none; }
.eh-auth__facts li { display: flex; gap: .5rem; align-items: flex-start; }
.eh-auth__facts i { color: var(--eh-accent-2); font-style: normal; }
.eh-auth h1 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }

/* footer */
.eh-foot { border-top: 1px solid var(--eh-line); padding-block: .9rem; font-size: .76rem; color: var(--m-muted); }

/* ---------------------------------------------------------------- RTL */
[dir="rtl"] body { font-family: "Segoe UI", "Noto Naskh Arabic", system-ui, sans-serif; }
[dir="rtl"] .table > thead th { letter-spacing: 0; }
/* numeric + code cells stay LTR inside an RTL row */
[dir="rtl"] .code, [dir="rtl"] .num, [dir="rtl"] .eh-user b { direction: ltr; unicode-bidi: isolate; text-align: start; }

/* ------------------------------------------------------------- mobile */
@media (max-width: 991.98px) {
    .eh-auth { grid-template-columns: 1fr; margin: 0; border-radius: var(--m-r); }
    .eh-auth__aside { border-inline-end: 0; border-bottom: 1px solid var(--eh-line); gap: 1rem; padding: 1.4rem; }
    .eh-auth__form { padding: 1.4rem; }
    .eh-top .navbar-collapse { padding-block: .6rem; }
    .eh-top .eh-lang { margin-block: .4rem; }
}

@media (max-width: 575.98px) {
    main { padding-block: .9rem 2rem; }
    .eh-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .eh-kpis .m-kpi { padding: .8rem .85rem; }
    .m-kpi__value { font-size: 1.35rem; }
    /* low-priority columns fold away so the page itself never scrolls sideways */
    .col-sm-hide { display: none !important; }
    .table > tbody > tr > td, .table > thead th { padding: .5rem .55rem; font-size: .8rem; }
    .eh-filters { padding: .7rem .8rem; }
    .eh-panel__head { padding: .65rem .8rem; }
    .eh-user { display: none; }
}

/* respect the OS preference: no reveals, no tilt, no counters */
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
    .m-card, .btn { transition: none !important; }
    .m-card:hover, .btn:hover { transform: none !important; }
    .m-aurora { display: none !important; }
}

/* ---------------------------------------------- forms: sheet, not bootstrap card
   list+editor pack pattern: every create/edit screen is a sheet with a
   hairline header, a two-column field grid and a sticky action bar. */
.card {
    background: var(--eh-surface);
    border: 1px solid var(--eh-line) !important;
    border-radius: var(--m-r-lg);
    box-shadow: none !important;
}
.card-body { padding: 1.15rem 1.2rem; }

.eh-sheet {
    position: relative;
    max-width: 880px;
    margin-inline: auto;
    background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 42%), var(--eh-surface);
    border: 1px solid var(--eh-line);
    border-radius: var(--m-r-lg);
    overflow: hidden;
    box-shadow: 0 24px 60px -40px rgba(0, 0, 0, .9);
}
.eh-sheet::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--eh-accent), var(--eh-accent-2));
    opacity: .8;
}
.eh-sheet--narrow { max-width: 560px; }
.eh-sheet__body { padding: 1.35rem 1.4rem 1.1rem; }

.eh-title {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -.025em;
    margin: 1.1rem auto .9rem;
    max-width: 880px;
}
.eh-title::before {
    content: "ExtraHours";
    display: block;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--eh-accent-2);
    margin-block-end: .35rem;
}
[dir="rtl"] .eh-title::before { content: "إكسترا آورز"; letter-spacing: 0; }
.eh-subtitle { font-size: .95rem; font-weight: 700; margin-block: 1.2rem .6rem; }

.eh-sheet .form-control, .eh-sheet .form-select { padding-block: .55rem; }
.eh-sheet input[type="number"] { font-variant-numeric: tabular-nums; font-weight: 600; }

.eh-actions {
    position: sticky;
    bottom: 0;
    margin-block-start: .4rem;
    padding-block: .8rem .2rem;
    background: linear-gradient(180deg, rgba(18, 20, 24, 0), var(--eh-surface) 42%);
    z-index: 2;
}

@media (max-width: 575.98px) {
    .eh-title { font-size: 1.2rem; margin-block: .8rem .7rem; }
    .eh-sheet__body { padding: 1rem .95rem .9rem; }
    .eh-sheet { margin-inline: 0; border-radius: var(--m-r); }
    .eh-actions .btn { flex: 1 1 auto; }
}
