/* كشف المعدات — تصميم: كحلي عميق + ذهبي. يستخدم خصائص منطقية (logical) فيشتغل RTL و LTR بدون تعديل */
:root {
    --navy: #1f2937;
    --navy-2: #374151;
    --ink: #17233a;
    --muted: #6b778c;
    --canvas: #eef1f6;
    --surface: #ffffff;
    --line: #dfe4ec;
    --gold: #f97316;
    --gold-2: #fed7aa;
    --valid: #1d7a5b;
    --soon: #b4690e;
    --expired: #b3261e;
    --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0; background: var(--canvas); color: var(--ink);
    font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif; line-height: 1.55;
}
a { color: inherit; }
h1 { font-size: 1.7rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; font-weight: 700; }
.muted { color: var(--muted); margin: .15rem 0 0; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
    width: 250px; flex-shrink: 0; background: var(--navy); color: #dfe6f1;
    display: flex; flex-direction: column; padding: 1.4rem 1rem;
    position: sticky; top: 0; height: 100vh;
    border-inline-end: 3px solid var(--gold);
}
.brand { display: flex; gap: .75rem; align-items: center; text-decoration: none; margin-bottom: 2rem; padding-inline: .4rem; }
.brand strong { display: block; font-size: 1.15rem; color: #fff; }
.brand small { color: #93a3bd; font-size: .78rem; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
    background: linear-gradient(145deg, var(--gold-2), var(--gold)); color: var(--navy); font-weight: 700; font-size: 1.4rem;
}
.brand-mark.big { width: 60px; height: 60px; font-size: 2rem; border-radius: 14px; margin-bottom: 1rem; }
.nav { display: grid; gap: .25rem; }
.nav a {
    display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 8px;
    text-decoration: none; color: #c5d0e2; font-weight: 500; transition: background .15s;
}
.nav a:hover { background: var(--navy-2); }
.nav a.on { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
[dir="rtl"] .nav a.on { box-shadow: inset -3px 0 0 var(--gold); }
.nav svg, .search svg, .burger svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.count {
    margin-inline-start: auto; background: var(--gold); color: var(--navy); font-size: .78rem; font-weight: 700;
    min-width: 22px; height: 22px; padding: 0 .4rem; border-radius: 11px; display: inline-grid; place-items: center;
}
.count.red { background: var(--expired); color: #fff; }
.side-foot { margin-top: auto; display: grid; gap: .8rem; padding: .4rem; font-size: .9rem; }
.side-foot form { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.who { color: #93a3bd; }
.lang { color: var(--gold-2); text-decoration: none; font-weight: 700; }
.linkbtn { background: none; border: 0; color: #c5d0e2; cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.page { padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem; max-width: 1700px; }

/* ---------- Head / buttons ---------- */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.head-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer;
    padding: .62rem 1.1rem; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: #fff;
    font: inherit; font-weight: 500; text-decoration: none; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn.gold { background: linear-gradient(145deg, var(--gold-2), var(--gold)); border-color: var(--gold); color: #ffffff; font-weight: 700; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #fff; filter: none; border-color: var(--gold); }
.btn.danger { background: transparent; color: var(--expired); border-color: #efc7c4; }
.btn.danger:hover { background: var(--expired); color: #fff; filter: none; }
.btn.sm { padding: .3rem .7rem; font-size: .85rem; }
.btn.block { width: 100%; padding: .8rem; }

.flash { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1.2rem; font-weight: 500; }
.flash.ok { background: #e3f4ec; color: #14553f; border: 1px solid #b9e0cf; }
.flash.err { background: #fbe7e5; color: #8a1d17; border: 1px solid #f0c1bd; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem;
    text-decoration: none; display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
    border-inline-start: 4px solid var(--navy); transition: border-color .15s;
}
.stat:hover { border-color: var(--gold); }
.stat b { font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-weight: 500; }
.stat.valid { border-inline-start-color: var(--valid); }
.stat.soon { border-inline-start-color: var(--soon); }
.stat.expired { border-inline-start-color: var(--expired); }

/* ---------- Filters ---------- */
.filters {
    display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: 1.2rem;
}
.search { position: relative; flex: 1 1 280px; }
.search svg { position: absolute; inset-inline-start: .8rem; top: 50%; translate: 0 -50%; color: var(--muted); }
.search input { padding-inline-start: 2.6rem; }
input, select {
    width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid var(--line);
    border-radius: 8px; padding: .62rem .8rem; min-height: 42px;
}
input:focus, select:focus { border-color: var(--gold); outline: 0; box-shadow: 0 0 0 3px rgba(249,115,22,.2); }
.sel { flex: 0 1 190px; }

/* ---------- Table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: .93rem; }
.grid th {
    background: var(--navy); color: #e7edf7; text-align: start; padding: .8rem .9rem; white-space: nowrap; font-weight: 500;
    position: sticky; top: 0;
}
.grid th a { text-decoration: none; }
.grid th i { font-style: normal; color: var(--gold-2); font-size: .7rem; }
.grid td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: #f8f9fc; }
.grid tbody tr td:first-child { border-inline-start: 4px solid transparent; }
.row-valid td:first-child { border-inline-start-color: var(--valid) !important; }
.row-soon td:first-child { border-inline-start-color: var(--soon) !important; }
.row-expired td:first-child { border-inline-start-color: var(--expired) !important; }
.acts { display: flex; gap: .4rem; align-items: center; }
.acts form { margin: 0; }
.files { display: flex; gap: .35rem; }
.chip { font-size: .8rem; padding: .15rem .55rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: #f6f8fb; }
.chip:hover { border-color: var(--gold); }

.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; margin-inline-start: .4rem; }
.badge.valid { background: #e3f4ec; color: var(--valid); }
.badge.soon { background: #fdefd9; color: var(--soon); }
.badge.expired { background: #fbe7e5; color: var(--expired); }

.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.2rem; color: var(--muted); }
.sec { margin: 2rem 0 .8rem; display: flex; align-items: center; gap: .6rem; font-size: 1.15rem; }
.empty { text-align: center; padding: 3rem 1rem; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty.slim { padding: 1.4rem; }
.empty p { margin: 0 0 .5rem; font-weight: 500; }

/* ---------- Form ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; }
.form h2 { padding-bottom: .5rem; margin: 1.6rem 0 1rem; border-bottom: 1px solid var(--line); color: var(--gold); }
.form h2:first-of-type { margin-top: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem 1.2rem; }
.field { display: grid; gap: .35rem; align-content: start; }
.field > span { font-weight: 500; font-size: .92rem; }
.field.bad input, .field.bad select { border-color: var(--expired); }
.err { color: var(--expired); font-style: normal; font-size: .85rem; }
.cur { color: var(--muted); }
.cur a { color: var(--ink); font-weight: 500; }
.drop { display: block; border: 1.5px dashed #c4ccda; border-radius: 8px; padding: .55rem .7rem; cursor: pointer; background: #fafbfd; }
.drop:hover { border-color: var(--gold); }
.drop input { border: 0; padding: 0; min-height: 0; background: none; }
.drop b { display: none; }
.form-actions { display: flex; gap: .6rem; margin-top: 2rem; }

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background: radial-gradient(900px 500px at 80% -10%, #374151 0%, transparent 60%), var(--navy);
}
.login-card {
    width: min(400px, 100%); background: var(--surface); border-radius: 16px; padding: 2.2rem 2rem;
    display: grid; gap: 1rem; border-top: 4px solid var(--gold); box-shadow: 0 30px 60px rgba(0,0,0,.35);
}
.login-card h1 { font-size: 1.6rem; }
.login-card .muted { margin-bottom: .6rem; }
.login-lang { position: fixed; top: 1rem; inset-inline-end: 1.2rem; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
    .topbar { display: flex; align-items: center; gap: .8rem; background: var(--navy); color: #fff; padding: .8rem 1rem; }
    .burger { background: none; border: 0; color: #fff; cursor: pointer; padding: 0; }
    .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 20; translate: 100% 0; transition: translate .2s; }
    [dir="ltr"] .side { translate: -100% 0; }
    .side.open { translate: 0 0 !important; }
    .shell { display: block; }
    .sel { flex: 1 1 45%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .side, .topbar, .filters, .acts, .head-actions { display: none !important; } }

/* ======== v2: selects, filters, table, bulk actions, menu ======== */
select {
    appearance: none; -webkit-appearance: none; cursor: pointer; text-overflow: ellipsis;
    padding-inline: .8rem 2.4rem;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b778c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right .75rem center / 16px;
}
[dir="rtl"] select { background-position: left .75rem center; }
select:hover { border-color: #c4ccda; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .7rem; }
.filters .search { grid-column: 1 / -1; }
.filters .btn { width: 100%; min-height: 42px; }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
    position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 15; min-width: 220px; padding: .35rem;
    background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(13,26,45,.18);
}
.menu-list small { display: block; padding: .4rem .7rem; color: var(--muted); }
.menu-list a { display: block; padding: .55rem .7rem; border-radius: 7px; text-decoration: none; font-weight: 500; }
.menu-list a:hover { background: #fff7ed; }

.grid { font-size: .88rem; }
.grid th, .grid td { padding: .65rem .8rem; text-align: start; white-space: nowrap; }
.grid td.wrap { white-space: normal; min-width: 11rem; }
.grid td.acts, .grid td.files { display: table-cell; }
.inline { display: inline-flex; align-items: center; gap: .4rem; }
.inline form { margin: 0; }
.grid th.chk, .grid td.chk { width: 44px; padding-inline-end: 0; }
.chk input { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--gold); cursor: pointer; }
.grid tbody tr.sel td { background: #fff7ed; }
.ibtn {
    width: 34px; height: 34px; display: inline-grid; place-items: center; cursor: pointer; padding: 0;
    border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink);
}
.ibtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ibtn:hover { border-color: var(--gold); background: #fff; }
.ibtn.danger { color: var(--expired); }
.ibtn.danger:hover { background: var(--expired); color: #fff; border-color: var(--expired); }

.bulkbar {
    position: fixed; bottom: 1.2rem; inset-inline: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 2rem);
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; z-index: 30;
    background: var(--navy); color: #fff; padding: .55rem .7rem; border-radius: 14px; border: 1px solid var(--gold);
    box-shadow: 0 14px 40px rgba(13,26,45,.35);
}
.bulkbar[hidden] { display: none; }
.bulkbar > span { padding-inline: .6rem; font-weight: 500; }
.bulkbar b { color: var(--gold-2); font-variant-numeric: tabular-nums; }
.bulkbar button {
    font: inherit; color: #fff; background: transparent; cursor: pointer;
    border: 1px solid rgba(255,255,255,.22); border-radius: 8px; padding: .4rem .85rem;
}
.bulkbar button:hover { background: var(--navy-2); border-color: var(--gold); }
.bulkbar button.danger { color: #ffb4ae; }
.bulkbar .sep { width: 1px; height: 22px; padding: 0; background: rgba(255,255,255,.22); }
body:has(.bulkbar:not([hidden])) .page { padding-bottom: 6rem; }

.chips-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; border-inline-start: 4px solid var(--navy); }
.mcard.row-valid { border-inline-start-color: var(--valid); }
.mcard.row-soon { border-inline-start-color: var(--soon); }
.mcard.row-expired { border-inline-start-color: var(--expired); }
.mcard header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; font-size: 1.1rem; }
.mcard dl { margin: 0; display: grid; gap: .35rem; }
.mcard dl div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--line); padding-bottom: .3rem; }
.mcard dt { color: var(--muted); }
.mcard dd { margin: 0; font-weight: 500; text-align: end; }
.mcard footer { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .8rem; }
@media print { .bulkbar { display: none !important; } }

/* ======== v3: Luxury theme (navy · gold · ivory) ======== */
:root {
    --navy: #1f2937;
    --navy-2: #374151;
    --ink: #101a2e;
    --muted: #7a8498;
    --canvas: #f5f5f4;
    --line: #e7e5e4;
    --gold: #f97316;
    --gold-2: #fed7aa;
    --gold-3: #c2410c;
    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(10,19,36,.05), 0 4px 14px rgba(10,19,36,.05);
    --shadow-md: 0 2px 4px rgba(10,19,36,.05), 0 18px 44px rgba(10,19,36,.10);
    --gold-grad: linear-gradient(135deg, #fb923c 0%, #ea580c 55%, #c2410c 100%);
}
body {
    background:
        radial-gradient(900px 420px at 100% -5%, rgba(249,115,22,.14), transparent 60%),
        radial-gradient(700px 380px at 0% 105%, rgba(18,31,56,.07), transparent 60%),
        var(--canvas);
    background-attachment: fixed;
}
h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.015em; position: relative; padding-bottom: .55rem; }
h1::after { content: ""; position: absolute; bottom: 0; inset-inline-start: 0; width: 54px; height: 3px; border-radius: 3px; background: var(--gold-grad); }

/* Sidebar */
.side {
    background:
        radial-gradient(420px 260px at 50% -40px, rgba(231,229,228,.16), transparent 70%),
        linear-gradient(180deg, #374151 0%, #111827 100%);
    border-inline-end: 0; padding: 1.6rem 1.1rem;
    box-shadow: inset -1px 0 0 rgba(231,229,228,.28);
}
[dir="rtl"] .side { box-shadow: inset 1px 0 0 rgba(231,229,228,.28); }
.brand { padding-bottom: 1.4rem; margin-bottom: 1.6rem; border-bottom: 1px solid rgba(231,229,228,.16); }
.brand strong { font-size: 1.2rem; font-weight: 800; letter-spacing: .01em; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 13px; background: var(--gold-grad); color: #ffffff;
    box-shadow: 0 6px 18px rgba(249,115,22,.35), inset 0 1px 0 rgba(255,255,255,.5);
}
.nav a { padding: .78rem .9rem; border-radius: 12px; color: #b9c5da; transition: all .2s; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.on {
    background: linear-gradient(90deg, rgba(231,229,228,.16), rgba(231,229,228,.03));
    color: #fff; box-shadow: inset 3px 0 0 var(--gold-2);
}
[dir="rtl"] .nav a.on { background: linear-gradient(270deg, rgba(231,229,228,.16), rgba(231,229,228,.03)); box-shadow: inset -3px 0 0 var(--gold-2); }
.nav a.on svg { color: var(--gold-2); }
.count { background: var(--gold-grad); }
.side-foot { border-top: 1px solid rgba(231,229,228,.16); padding-top: 1rem; }
.lang { letter-spacing: .04em; }

/* Page head */
.head { margin-bottom: 1.8rem; align-items: center; }

/* Buttons */
.btn { border-radius: 12px; padding: .68rem 1.25rem; transition: transform .15s, box-shadow .2s, filter .2s, background .2s; }
.btn:hover { filter: none; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(10,19,36,.18); }
.btn:active { transform: translateY(0); }
.btn.gold {
    background: var(--gold-grad); border-color: rgba(194,65,12,.6); color: #ffffff; font-weight: 800;
    box-shadow: 0 6px 16px rgba(249,115,22,.35), inset 0 1px 0 rgba(255,255,255,.55);
}
.btn.gold:hover { box-shadow: 0 10px 26px rgba(249,115,22,.5), inset 0 1px 0 rgba(255,255,255,.55); filter: brightness(1.05); }
.btn.ghost { background: rgba(255,255,255,.7); border-color: var(--line); backdrop-filter: blur(6px); }
.btn.ghost:hover { background: #fff; border-color: var(--gold); box-shadow: var(--shadow-sm); }

/* Cards */
.card {
    background: rgba(255,255,255,.92); border: 1px solid rgba(231,229,228,.9); border-radius: 20px;
    padding: 2rem 2.2rem; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--gold-grad); }

/* Form */
.form h2 {
    display: flex; align-items: center; gap: .7rem; font-size: 1.05rem; font-weight: 800; color: var(--gold-3);
    border-bottom: 0; padding-bottom: 0; margin: 2.2rem 0 1.2rem; letter-spacing: .01em;
}
.form h2::before { content: ""; width: 9px; height: 9px; transform: rotate(45deg); background: var(--gold-grad); border-radius: 2px; flex-shrink: 0; }
.form h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
[dir="rtl"] .form h2::after { background: linear-gradient(270deg, var(--line), transparent); }
.cols { gap: 1.2rem 1.4rem; }
.field > span { font-weight: 700; font-size: .86rem; color: #3a4560; letter-spacing: .01em; }
input, select {
    min-height: 48px; border-radius: 12px; border: 1.5px solid #d6d3d1; background: #fbfdfe;
    padding: .65rem .95rem; transition: border-color .2s, box-shadow .2s, background .2s;
}
input:hover, select:hover { border-color: #a8a29e; background: #fff; }
input:focus, select:focus { border-color: var(--gold); background: #fff; box-shadow: 0 0 0 4px rgba(249,115,22,.22); }
.field.bad input, .field.bad select { border-color: var(--expired); box-shadow: 0 0 0 3px rgba(179,38,30,.08); }
.drop {
    border: 1.5px dashed #a8a29e; border-radius: 12px; background: linear-gradient(180deg, #fbfdfe, #fafaf9);
    padding: .75rem .9rem; min-height: 48px; transition: all .2s;
}
.drop:hover { border-color: var(--gold); background: #fafaf9; box-shadow: 0 0 0 4px rgba(249,115,22,.12); }
.drop input::file-selector-button {
    font: inherit; font-weight: 700; margin-inline-end: .8rem; padding: .35rem .9rem; cursor: pointer;
    border: 0; border-radius: 8px; background: var(--navy); color: var(--gold-2); transition: background .2s;
}
.drop input::file-selector-button:hover { background: var(--navy-2); }
.form-actions { margin-top: 2.4rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.form-actions .btn.gold { min-width: 130px; }

/* Stats */
.stat {
    border: 1px solid rgba(231,229,228,.9); border-radius: 18px; padding: 1.2rem 1.4rem; background: rgba(255,255,255,.92);
    box-shadow: var(--shadow-sm); border-inline-start-width: 1px; position: relative; overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.stat::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--navy); }
.stat.valid::before { background: var(--valid); } .stat.soon::before { background: var(--soon); } .stat.expired::before { background: var(--expired); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--gold-2); }
.stat b { font-size: 2.3rem; font-weight: 800; }

/* Filters */
.filters {
    background: rgba(255,255,255,.85); border: 1px solid rgba(231,229,228,.9); border-radius: 18px;
    padding: 1rem; box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
}
select { background-color: #fbfdfe; }

/* Table */
.table-wrap { border-radius: 18px; border: 1px solid rgba(231,229,228,.9); box-shadow: var(--shadow-md); background: #fff; }
.grid th {
    background: linear-gradient(180deg, #374151, #1f2937); color: var(--gold-2); font-weight: 700;
    letter-spacing: .02em; border-bottom: 2px solid var(--gold); padding-block: .95rem;
}
.grid th a { color: inherit; }
.grid td { padding-block: .8rem; border-bottom: 1px solid #f5f5f4; }
.grid tbody tr { transition: background .15s; }
.grid tbody tr:nth-child(even) td { background: #f7fafb; }
.grid tbody tr:hover td { background: #fff7ed; }
.grid tbody tr.sel td { background: #e7e5e4; }
.chip { background: #fff7ed; border-color: #e7e5e4; }
.chip:hover { background: #fff; border-color: var(--gold); }
.badge { font-weight: 800; }
.ibtn { border-radius: 10px; background: #fff; transition: all .2s; }
.ibtn:hover { border-color: var(--gold); color: var(--gold-3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.mcard { border-radius: 16px; box-shadow: var(--shadow-sm); border-inline-start-width: 4px; }
.empty { border-radius: 18px; border-color: #d9cfb4; background: rgba(255,255,255,.7); }

/* Menu & bulk bar */
.menu-list { border-radius: 14px; border-color: var(--line); box-shadow: var(--shadow-md); padding: .45rem; }
.menu-list a { border-radius: 9px; }
.menu-list a:hover { background: #fff7ed; }
.bulkbar {
    background: linear-gradient(180deg, #374151, #1f2937); border: 1px solid rgba(231,229,228,.6);
    border-radius: 18px; box-shadow: 0 20px 50px rgba(10,19,36,.45);
}

/* Flash */
.flash { border-radius: 14px; box-shadow: var(--shadow-sm); }

/* Login */
.login-body {
    background:
        radial-gradient(700px 420px at 85% -10%, rgba(231,229,228,.22), transparent 60%),
        radial-gradient(800px 500px at 0% 110%, #374151 0%, transparent 60%),
        linear-gradient(180deg, #374151, #111827);
}
.login-card {
    border-radius: 24px; border-top: 0; padding: 2.6rem 2.2rem; background: rgba(255,255,255,.97);
    box-shadow: 0 40px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(231,229,228,.35); position: relative; overflow: hidden;
}
.login-card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--gold-grad); }
.login-card h1::after { display: none; }
.login-card h1 { padding-bottom: 0; }

@media (max-width: 900px) {
    .topbar { background: linear-gradient(180deg, #374151, #1f2937); border-bottom: 2px solid var(--gold); }
    .card { padding: 1.4rem 1.2rem; }
}

/* multi-file attachments */
.curfiles { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .35rem; }
.curfiles li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .45rem .8rem; background: #fff7ed; border: 1px solid #e7e5e4; border-radius: 10px; font-size: .88rem; }
.curfiles a { font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.curfiles a:hover { color: var(--gold-3); text-decoration: underline; }
.rm { display: inline-flex; align-items: center; gap: .3rem; color: var(--expired); cursor: pointer; white-space: nowrap; font-size: .82rem; }
.rm input { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--expired); }

/* file preview / remove */
.curfiles .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; flex: 1; min-width: 0; }
.curfiles .facts { display: inline-flex; gap: .4rem; flex-shrink: 0; }
.curfiles li.removed { opacity: .55; }
.curfiles li.removed .fname { text-decoration: line-through; }
.newfiles { margin: .5rem 0 .35rem; }
.newfiles:empty { display: none; }
.fthumb { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex-shrink: 0; }
.fbtn { font: inherit; font-size: .8rem; padding: .25rem .7rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.fbtn:hover { border-color: var(--gold); }
.fbtn.danger { color: var(--expired); }
.fbtn.danger:hover { border-color: var(--expired); }
.fmodal { position: fixed; inset: 0; z-index: 9999; background: rgba(5,10,20,.72); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.fmodal[hidden] { display: none; }
.fmodal-box { background: var(--surface); border-radius: 14px; width: min(960px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.fmodal-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
.fmodal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmodal-body { padding: 1rem; overflow: auto; display: flex; justify-content: center; align-items: flex-start; min-height: 120px; }
.fmodal-body img { max-width: 100%; max-height: 78vh; object-fit: contain; }
.fmodal-body iframe { width: 100%; height: 78vh; border: 0; }
[data-theme="dark"] .fbtn { background: #17223a; }

/* Login: centered title */
.login-card h1, .login-card .muted { text-align: center; }

/* Sidebar footer */
.side-foot { gap: .7rem; }
.side-foot .foot-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.side-foot form { display: grid; gap: .6rem; justify-content: stretch; }
.side-foot .who { font-size: .85rem; color: #b9c5da; }
.side-foot .linkbtn {
    width: 100%; text-align: center; text-decoration: none; padding: .55rem .8rem; border-radius: 10px;
    border: 1px solid rgba(231,229,228,.35); color: var(--gold-2); font-weight: 700; transition: background .2s, border-color .2s;
}
.side-foot .linkbtn:hover { background: rgba(231,229,228,.1); border-color: var(--gold-2); }
.theme-btn {
    width: 36px; height: 36px; display: inline-grid; place-items: center; cursor: pointer; padding: 0;
    border: 1px solid rgba(231,229,228,.35); border-radius: 10px; background: transparent; color: var(--gold-2); transition: background .2s;
}
.theme-btn:hover { background: rgba(231,229,228,.12); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: block; }
[data-theme="dark"] .theme-btn .i-moon { display: none; }
.login-theme { position: fixed; top: 1rem; inset-inline-start: 1.2rem; }

/* ======== Dark theme ======== */
[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e8edf6;
    --muted: #93a0b8;
    --canvas: #0a101d;
    --surface: #111b2f;
    --line: #243049;
    --gold: #f97316;
    --gold-3: #fdba74;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.3);
    --shadow-md: 0 2px 4px rgba(0,0,0,.3), 0 18px 44px rgba(0,0,0,.45);
}
[data-theme="dark"] body {
    background:
        radial-gradient(900px 420px at 100% -5%, rgba(249,115,22,.08), transparent 60%),
        radial-gradient(700px 380px at 0% 105%, rgba(31,58,95,.25), transparent 60%),
        var(--canvas);
    background-attachment: fixed;
}
[data-theme="dark"] .field > span { color: #c3cde0; }
[data-theme="dark"] input, [data-theme="dark"] select { background-color: #0d1627; border-color: #2a3855; color: var(--ink); }
[data-theme="dark"] input:hover, [data-theme="dark"] select:hover { background-color: #0f192d; border-color: #3a4b6e; }
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus { background-color: #0f192d; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(249,115,22,.18); }
[data-theme="dark"] input::placeholder { color: #6f7c95; }
[data-theme="dark"] select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a0b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px;
}
[dir="rtl"][data-theme="dark"] select, [data-theme="dark"] [dir="rtl"] select { background-position: left .75rem center; }
[data-theme="dark"] .card, [data-theme="dark"] .stat, [data-theme="dark"] .filters, [data-theme="dark"] .mcard {
    background: rgba(17,27,47,.94); border-color: var(--line);
}
[data-theme="dark"] .table-wrap { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .grid td { border-bottom-color: #1c283f; }
[data-theme="dark"] .grid tbody tr:nth-child(even) td { background: #0f192d; }
[data-theme="dark"] .grid tbody tr:hover td { background: #17243d; }
[data-theme="dark"] .grid tbody tr.sel td { background: #2a2713; }
[data-theme="dark"] .grid tbody tr:hover { background: transparent; }
[data-theme="dark"] .chip { background: #17223a; border-color: #2a3855; color: var(--ink); }
[data-theme="dark"] .chip:hover { background: #1d2b48; border-color: var(--gold); }
[data-theme="dark"] .ibtn { background: #0d1627; border-color: #2a3855; color: var(--ink); }
[data-theme="dark"] .ibtn:hover { background: #17243d; color: var(--gold-2); }
[data-theme="dark"] .ibtn.danger { color: #ff8a82; }
[data-theme="dark"] .ibtn.danger:hover { background: var(--expired); color: #fff; }
[data-theme="dark"] .btn.ghost { background: rgba(255,255,255,.04); color: var(--ink); border-color: #2a3855; }
[data-theme="dark"] .btn.ghost:hover { background: rgba(255,255,255,.09); border-color: var(--gold); }
[data-theme="dark"] .btn.danger { border-color: #5a2a2a; color: #ff8a82; }
[data-theme="dark"] .btn.danger:hover { background: var(--expired); color: #fff; }
[data-theme="dark"] .btn:not(.gold):not(.ghost):not(.danger) { background: #1a2745; border-color: #2f4068; }
[data-theme="dark"] .empty { background: rgba(17,27,47,.7); border-color: #2f4068; }
[data-theme="dark"] .menu-list { background: #111b2f; border-color: var(--line); }
[data-theme="dark"] .menu-list a:hover { background: #1b2946; }
[data-theme="dark"] .drop { background: linear-gradient(180deg, #0d1627, #0f192d); border-color: #2f4068; }
[data-theme="dark"] .drop:hover { background: #12203a; border-color: var(--gold); }
[data-theme="dark"] .drop input::file-selector-button { background: #1a2745; color: var(--gold-2); }
[data-theme="dark"] .curfiles li { background: #17223a; border-color: #2a3855; }
[data-theme="dark"] .curfiles a { color: var(--ink); }
[data-theme="dark"] .form h2 { color: var(--gold-2); }
[data-theme="dark"] .cur a { color: var(--ink); }
[data-theme="dark"] .badge.valid { background: rgba(29,122,91,.2); color: #55d6a4; }
[data-theme="dark"] .badge.soon { background: rgba(180,105,14,.22); color: #f5b45a; }
[data-theme="dark"] .badge.expired { background: rgba(179,38,30,.25); color: #ff8a82; }
[data-theme="dark"] .flash.ok { background: rgba(29,122,91,.18); color: #7ee2b8; border-color: rgba(29,122,91,.5); }
[data-theme="dark"] .flash.err { background: rgba(179,38,30,.2); color: #ff9d96; border-color: rgba(179,38,30,.5); }
[data-theme="dark"] .login-card { background: rgba(17,27,47,.97); }
[data-theme="dark"] .login-card h1 { color: #fff; }
[data-theme="dark"] .h1, [data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: var(--ink); }
[data-theme="dark"] .form h2 { color: var(--gold-2); }
[data-theme="dark"] .pager a { color: var(--ink); }
[data-theme="dark"] .side { background: radial-gradient(420px 260px at 50% -40px, rgba(231,229,228,.1), transparent 70%), linear-gradient(180deg, #080f1e 0%, #04070f 100%); }
[data-theme="dark"] .chk input, [data-theme="dark"] .rm input { color-scheme: dark; }
@media (max-width: 900px) { [data-theme="dark"] .topbar { background: linear-gradient(180deg, #080f1e, #04070f); } }
@media print {
    [data-theme="dark"] { --ink: #17233a; --muted: #6b778c; --surface: #fff; --line: #dfe4ec; }
    [data-theme="dark"] body { background: #fff; }
}


/* ======== تكبير الخط ======== */
html { font-size: 15px; }
.field > span { font-size: 1rem; }
input, select, .drop input { font-size: 1.02rem; }
.form h2 { font-size: 1.2rem; }
.field small, small.cur { font-size: .9rem; }
.curfiles li { font-size: 1rem; }
.fbtn { font-size: .9rem; }
.grid { font-size: 1rem; }
.nav a { font-size: 1.05rem; }
.count { color: #fff; }

/* ======== سجل الآلية ======== */
.timeline { display: grid; gap: 1rem; position: relative; padding-inline-start: 1.6rem; }
.timeline::before { content: ""; position: absolute; inset-block: .4rem; inset-inline-start: .45rem; width: 3px; border-radius: 3px; background: var(--line); }
.tl-item { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.4rem; box-shadow: var(--shadow-sm); }
.tl-item::before { content: ""; position: absolute; inset-inline-start: -1.6rem; top: 1.4rem; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--gold); }
.tl-item.now { border-color: var(--gold); }
.tl-item.now::before { background: var(--gold); }
.tl-item header { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tl-period { font-weight: 800; font-size: 1.1rem; color: var(--gold-3); }
.tl-tags { display: inline-flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.tl-item dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem 1.2rem; margin: 0; }
.tl-item dl > div { padding: .5rem .8rem; border-radius: 10px; border: 1px solid transparent; }
.tl-item dl > div.chg { background: #fff6dc; border-color: #f0d68a; }
.tl-item dt { font-size: .85rem; color: var(--muted); font-weight: 700; }
.tl-item dd { margin: .15rem 0 0; font-weight: 700; font-size: 1.05rem; }
[data-theme="dark"] .tl-item dl > div.chg { background: rgba(240,214,138,.12); border-color: rgba(240,214,138,.4); }
