/* Mechmech Health Center — admin panel */
:root {
    --blue: #0091d5; --teal: #13a39b; --green: #56b947;
    --ink: #10293a; --muted: #62778a; --line: #e3eaef; --bg: #f3f7f9; --card: #fff;
    --danger: #d64545; --ok: #2f9a3b;
    --grad: linear-gradient(120deg, var(--blue), var(--teal) 55%, var(--green));
    --radius: 16px; --shadow: 0 6px 24px -14px rgba(16,41,58,.25);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Outfit', 'Cairo', system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 15.5px; line-height: 1.5; }
a { color: #0573aa; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0 0 .6em; line-height: 1.2; }
h2 { font-size: 1.15rem; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.ar { font-family: 'Cairo', sans-serif; color: var(--muted); }
input, select, textarea, button { font: inherit; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1.5px solid transparent; font-weight: 600; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s; white-space: nowrap; color: var(--ink); background: #fff; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -10px rgba(0,145,213,.8); }
.btn--ghost { background: #fff; border-color: var(--line); }
.btn--ghost:hover { border-color: var(--teal); }
.btn--danger { background: #fff; color: var(--danger); border-color: #f2c9c9; }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--success { background: var(--ok); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: .88rem; border-radius: 10px; }
.btn--block { width: 100%; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; }
.alert--error { background: #fdecec; color: #9b2c2c; border: 1px solid #f5c2c2; }
.alert--success { background: #e7f6e6; color: #22662a; border: 1px solid #c3e6c0; }
.alert--info { background: #e6f3fa; color: #0d5f88; border: 1px solid #bfe0f1; }

/* Auth / installer */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 30px 16px; background: var(--grad); background-size: 200% 200%; animation: shift 14s ease-in-out infinite; }
@keyframes shift { 0%,100% { background-position: 0 50%; } 50% { background-position: 100% 50%; } }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 24px; padding: 36px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 14px; animation: rise .7s cubic-bezier(.22,.9,.3,1) both; }
.auth-card--wide { width: min(720px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.auth-logo { width: 90px; margin: 0 auto 6px; display: block; }
.auth-card h1 { text-align: center; font-size: 1.5rem; margin: 0; }
.auth-card > .muted { text-align: center; margin: 0; }
.auth-card label, .form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .93rem; }
.auth-back { text-align: center; font-size: .9rem; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input:not([type]), select, textarea {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fbfdfe; color: var(--ink); font-weight: 400;
    transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(19,163,155,.13); background: #fff; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin: 0; }
legend { font-weight: 700; padding: 0 8px; }
legend small { font-weight: 400; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.radio-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.radio-card { flex-direction: row !important; align-items: flex-start; gap: 10px !important; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--teal); background: rgba(19,163,155,.06); }
.radio-card span { display: flex; flex-direction: column; }
.radio-card small { font-weight: 400; color: var(--muted); }

/* Layout */
.admin { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex: none; background: #0d2433; color: rgba(255,255,255,.75); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 20px 14px; }
.sidebar__brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 6px 10px 18px; font-weight: 700; font-size: 1.1rem; }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img { width: 34px; }
.sidebar__brand small { display: block; font-weight: 400; font-size: .78rem; color: rgba(255,255,255,.55); }
.sidebar__group { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,.4); margin: 18px 10px 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: rgba(255,255,255,.78); transition: background .2s, color .2s; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar nav a.is-active { background: var(--grad); color: #fff; }
.sidebar nav a span { flex: 1; }
.count { background: #ff6b5b; color: #fff; font-size: .75rem; padding: 1px 8px; border-radius: 999px; }
.admin-main { flex: 1; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(255,255,255,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 1.35rem; flex: 1; }
.topbar__right { display: flex; align-items: center; gap: 10px; }
.topbar__right form { margin: 0; }
.topbar__user { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.topbar__menu { display: none; border: 0; background: var(--bg); border-radius: 10px; padding: 8px; cursor: pointer; }
.admin-content { padding: 26px 28px 60px; max-width: 1280px; }

/* Panels */
.panel { background: var(--card); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 22px; }
.panel--flush { padding: 0; overflow: hidden; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpis--3 { grid-template-columns: repeat(3, 1fr); }
.kpi { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); color: var(--ink); border: 2px solid transparent; transition: transform .2s; }
.kpi:hover { text-decoration: none; transform: translateY(-3px); }
.kpi.is-active { border-color: var(--teal); }
.kpi > span { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.kpi strong { font-size: 1.4rem; display: block; }
.kpi small { color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checklist a { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--bg); color: var(--ink); }
.checklist a:hover { background: #e6f3f2; text-decoration: none; }
.checklist .icon { color: var(--teal); }
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.type-chips span { padding: 3px 10px; background: #fdecee; color: #a52a3a; border-radius: 999px; font-size: .85rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 16px; background: #f8fbfc; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-unread td { background: #f0f8ff; }
.num { text-align: end; }
.actions { white-space: nowrap; }
.actions form { display: inline; margin: 0; }
.actions > * + * { margin-inline-start: 6px; }
.thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; display: block; }
.thumb--empty { background: var(--bg); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eef2f5; color: var(--muted); font-size: .8rem; font-weight: 600; }
.tag--ok, .tag--received { background: #e3f6df; color: #2c7a22; }
.tag--pending { background: #fff4d6; color: #8a6200; }
.tag--cancelled { background: #fdecec; color: #9b2c2c; }
.tag--blood { background: #fdecee; color: #b8283a; font-size: .95rem; }
.tag-btn { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 12px; cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--muted); }
.tag-btn.is-on { background: #e3f6df; color: #2c7a22; border-color: #c3e6c0; }
.note { margin-top: 6px; padding: 6px 10px; background: var(--bg); border-radius: 8px; font-size: .9rem; color: var(--muted); }
.empty-admin { padding: 30px; text-align: center; color: var(--muted); margin: 0; }
.inline-select select { padding: 6px 10px; width: auto; }

/* Toolbar & filters */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar p { margin: 0; max-width: 700px; }
.toolbar__actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters a { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); color: var(--ink); font-weight: 600; font-size: .9rem; }
.filters a.is-active { background: var(--grad); color: #fff; border-color: transparent; }
.filters a:hover { text-decoration: none; border-color: var(--teal); }
.search input { width: 240px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 18px; }
.form label > span { display: flex; gap: 6px; align-items: center; }
.form label.narrow { max-width: 420px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lang-tag { font-style: normal; font-weight: 500; font-size: .75rem; color: var(--teal); background: rgba(19,163,155,.1); padding: 1px 8px; border-radius: 999px; }
.req { color: var(--danger); }
.help { color: var(--muted); font-weight: 400; font-size: .85rem; margin-top: -10px; }
label > .help { margin-top: 0; }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }
.switch { flex-direction: row !important; align-items: center; gap: 12px !important; cursor: pointer; font-weight: 500 !important; }
.switch input { position: absolute; opacity: 0; }
.switch__ui { width: 46px; height: 26px; border-radius: 999px; background: #cfd9df; position: relative; transition: background .2s; flex: none; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .25s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.switch input:checked + .switch__ui { background: var(--teal); }
.switch input:checked + .switch__ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__ui { outline: 3px solid rgba(19,163,155,.4); outline-offset: 2px; }
.image-field { display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: .93rem; }
.image-field__row { display: flex; gap: 16px; align-items: center; }
.image-field__row img { width: 110px; height: 110px; object-fit: cover; border-radius: 14px; background: var(--bg); }
.image-field input[type=file] { font-weight: 400; }
.inline { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400 !important; }
.video-preview { max-width: 420px; border-radius: 12px; }
.tabs { position: sticky; top: 64px; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; padding: 8px; background: rgba(243,247,249,.92); backdrop-filter: blur(8px); border-radius: 14px; }
.tabs a { padding: 7px 14px; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 600; font-size: .9rem; }
.settings-form .panel { scroll-margin-top: 130px; }
.sticky-save { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; }
.sticky-save .btn { box-shadow: 0 14px 30px -10px rgba(0,145,213,.8); }

/* Messages */
.messages { display: flex; flex-direction: column; }
.message header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.message.is-unread { border-inline-start: 4px solid var(--blue); }
.message__body { margin: 12px 0; white-space: normal; }
.message footer { display: flex; flex-wrap: wrap; gap: 16px; font-size: .92rem; }
.message footer a { display: inline-flex; align-items: center; gap: 6px; }

/* Responsive */
@media (max-width: 1000px) {
    .kpis { grid-template-columns: 1fr 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .3s; }
    .sidebar-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.3); }
    .topbar__menu { display: inline-grid; }
}
@media (max-width: 720px) {
    .grid-2, .grid-3, .field-pair, .radio-row, .checklist, .kpis, .kpis--3 { grid-template-columns: 1fr; }
    .admin-content { padding: 18px 14px 50px; }
    .topbar { padding: 12px 14px; }
    .topbar__right .btn span, .topbar__user { display: none; }
    .table--list thead { display: none; }
    .table--list tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
    .table--list td { display: block; border: 0; padding: 6px 16px; }
    .table--list td.num { text-align: start; }
    .search input { width: 100%; }
}

/* Roles & permissions */
.perm-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 18px; }
.perm-group legend { grid-column: 1 / -1; }
.perm-group .switch small { display: block; font-weight: 400; font-size: .78rem; }
.topbar__user .tag { margin-inline-start: 6px; }
