:root {
  --blue: #004ea8;
  --blue-dark: #003d84;
  --orange: #e05319;
  --orange-dark: #bf4213;
  --ink: #17365d;
  --muted: #65758a;
  --line: #dfe7f1;
  --surface: #fff;
  --background: #f4f7fb;
  --shadow: 0 16px 45px rgba(15, 43, 78, .075);
  font-family: 'Cairo', 'Tajawal', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--ink); min-width: 320px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
input, select { min-width: 0; }
a { color: inherit; }

.boot { min-height: 60vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid #dbe7f5; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); background: white; }
.login-brand { position: relative; overflow: hidden; display: flex; min-height: 100vh; flex-direction: column; justify-content: center; padding: clamp(45px, 7vw, 110px); color: white; background: linear-gradient(145deg, #0056ba 0%, #00428f 58%, #00346f 100%); }
.login-brand::before, .login-brand::after { content: ''; position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.login-brand::before { width: 560px; height: 560px; left: -250px; top: -190px; }
.login-brand::after { width: 380px; height: 380px; right: -170px; bottom: -150px; }
.login-brand > * { position: relative; z-index: 1; }
.login-brand > img { width: 120px; height: auto; margin-bottom: 70px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: #dbeafe; font-size: 12px; font-weight: 900; letter-spacing: .02em; }
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.eyebrow.orange { color: var(--orange); }
.login-brand h1 { margin: 15px 0 20px; font-size: clamp(38px, 5vw, 68px); line-height: 1.2; letter-spacing: -.04em; }
.login-brand p { max-width: 610px; margin: 0; color: #d6e8ff; font-size: 17px; line-height: 2; }
.login-features { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 50px; color: #eef6ff; font-size: 13px; font-weight: 700; }
.login-panel { display: grid; place-items: center; padding: 40px 24px; background: radial-gradient(circle at top right, #eef6ff 0, white 42%); }
.login-card { width: min(440px, 100%); }
.mobile-logo { display: none; padding: 16px 20px; margin-bottom: 35px; border-radius: 14px; background: var(--blue); }
.mobile-logo img { height: 44px; }
.login-card h2 { margin: 8px 0; color: var(--ink); font-size: 34px; font-weight: 900; }
.login-card > p { margin: 0 0 30px; color: var(--muted); line-height: 1.8; }
.login-help { display: block; margin-top: 18px; color: #8997a9; text-align: center; line-height: 1.7; }

.field { display: block; margin-bottom: 18px; }
.field > span, .field > legend { display: block; margin-bottom: 8px; color: #334a68; font-size: 13px; font-weight: 800; }
.field input, .field select, .filters input, .filters select, .status-select, [data-role] { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 11px; outline: 0; padding: 0 13px; color: var(--ink); background: white; transition: .15s ease; }
.field input:focus, .field select:focus, .filters input:focus, .filters select:focus, .status-select:focus, [data-role]:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 78, 168, .1); }
.field input::placeholder { color: #a1adbc; }

.btn { min-height: 42px; border: 0; border-radius: 10px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; transition: .15s ease; }
.btn.primary { background: var(--blue); color: white; box-shadow: 0 10px 25px rgba(0, 78, 168, .22); }
.btn.primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn.orange { color: white; background: var(--orange); box-shadow: 0 10px 24px rgba(224, 83, 25, .18); }
.btn.orange:hover { background: var(--orange-dark); }
.btn.outline { border: 1px solid var(--line); color: var(--blue); background: white; }
.btn.outline:hover { border-color: #abc2dc; background: #f8fbff; }
.btn.ghost { color: #536982; background: #f2f5f9; }
.btn.wide { width: 100%; }
.btn.small { min-height: 36px; padding-inline: 13px; font-size: 12px; }
.btn.tiny { min-height: 32px; padding-inline: 10px; font-size: 11px; }
.arrow { margin-right: auto; font-size: 18px; }

.alert { padding: 12px 14px; margin: 0 0 18px; border-radius: 10px; font-size: 13px; font-weight: 700; line-height: 1.7; }
.alert.error { border: 1px solid #fecaca; color: #b91c1c; background: #fef2f2; }
.toast { position: fixed; left: 24px; bottom: 24px; z-index: 100; min-width: 260px; max-width: min(420px, calc(100vw - 48px)); padding: 14px 18px; border-radius: 12px; color: white; background: #16844f; box-shadow: 0 18px 45px rgba(15,43,78,.25); transform: translateY(30px); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #c52828; }

.topbar { position: sticky; top: 0; z-index: 30; min-height: 78px; padding: 10px clamp(18px, 3vw, 44px); display: grid; grid-template-columns: minmax(300px, 1fr) auto minmax(300px, 1fr); align-items: center; gap: 24px; color: white; background: var(--blue); box-shadow: 0 8px 30px rgba(0,34,84,.17); }
.brand-button { min-width: 0; border: 0; padding: 0; display: flex; align-items: center; gap: 14px; color: white; background: transparent; text-align: right; }
.brand-button img { height: 45px; width: auto; flex: 0 0 auto; }
.brand-divider { width: 1px; height: 36px; background: rgba(255,255,255,.25); }
.brand-button strong, .brand-button small { display: block; }
.brand-button strong { font-size: 14px; }
.brand-button small { margin-top: 3px; color: #cfe3ff; font-size: 10px; }
.desktop-nav { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.1); }
.nav-button { border: 0; border-radius: 999px; padding: 9px 15px; display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,.84); font-size: 12px; font-weight: 800; background: transparent; }
.nav-button.active { color: var(--blue); background: white; }
.account-menu { justify-self: end; display: flex; align-items: center; gap: 9px; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--blue); background: white; font-weight: 900; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.user-chip small { color: #cae0ff; font-size: 10px; }
.icon-button { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.22); border-radius: 10px; color: inherit; background: rgba(255,255,255,.08); font-size: 20px; }
.mobile-nav { display: none; }

.content { width: min(1480px, 100%); margin: auto; padding: 34px clamp(16px, 3vw, 44px) 70px; }
.page-intro { margin-bottom: 26px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.page-intro h1 { margin: 7px 0 4px; color: var(--ink); font-size: clamp(25px, 3vw, 34px); letter-spacing: -.025em; }
.page-intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.panel { border: 1px solid rgba(223,231,241,.9); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.panel-head { min-height: 78px; padding: 18px 22px; border-bottom: 1px solid #edf1f6; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 20px; }
.stats-grid.two-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card { min-height: 135px; border: 1px solid rgba(223,231,241,.9); border-radius: 15px; padding: 21px; display: flex; flex-direction: row-reverse; align-items: flex-start; justify-content: space-between; background: white; box-shadow: 0 12px 35px rgba(15,43,78,.055); }
.stat-card p { margin: 0 0 11px; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card strong { display: block; color: var(--ink); font-size: 31px; }
.stat-card small { color: #94a1b2; font-size: 10px; }
.stat-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 19px; font-weight: 900; }
.stat-icon.blue { color: var(--blue); background: #e9f2ff; }
.stat-icon.green { color: #16844f; background: #e8f8ef; }
.stat-icon.orange-bg { color: var(--orange); background: #fff1e9; }
.stat-icon.violet { color: #6d4bd1; background: #f0ecff; }

.filters { padding: 15px 18px; border-bottom: 1px solid #edf1f6; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(230px, .7fr) 180px; gap: 10px; }
.filters.with-creator { grid-template-columns: minmax(230px, 1fr) minmax(190px, .65fr) minmax(210px, .7fr) 160px; }
.search-field { position: relative; }
.search-field span { position: absolute; right: 14px; top: 10px; color: #8c9aac; font-size: 20px; }
.filters .search-field input { padding-right: 41px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 13px 14px; color: #62748b; background: #f8fafc; text-align: right; font-size: 11px; white-space: nowrap; }
td { height: 63px; padding: 10px 14px; border-top: 1px solid #edf1f6; color: #5f7086; vertical-align: middle; }
td strong { color: var(--ink); }
.wrap-cell { min-width: 230px; max-width: 320px; line-height: 1.65; }
.link-button { display: inline-flex; min-width: 55px; justify-content: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; color: var(--blue); text-decoration: none; font-weight: 800; background: white; }
.status-select { width: 125px; height: 34px; border: 0; border-radius: 999px; padding: 0 10px; font-size: 10px; font-weight: 800; }
.status-pill { min-width: 92px; height: 32px; border-radius: 999px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-verified { color: #087443; background: #e8f8ef; }
.status-review { color: #a65708; background: #fff5db; }
.status-new { color: #085ca8; background: #e9f2ff; }
.creator-chip { max-width: 190px; display: inline-flex; align-items: center; gap: 7px; color: #3e5572; font-weight: 800; }
.creator-chip > span:first-child { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: var(--blue); background: #e9f2ff; font-size: 14px; }
.creator-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delete-button { width: 36px; height: 36px; border: 1px solid #fecaca; border-radius: 9px; display: inline-grid; place-items: center; color: #b91c1c; background: #fff7f7; font-size: 18px; transition: .15s ease; }
.delete-button:hover { border-color: #fca5a5; color: white; background: #c52828; transform: translateY(-1px); }
.delete-button:focus-visible { outline: 3px solid rgba(197,40,40,.18); outline-offset: 2px; }
.delete-button svg { display: block; }
.muted-action { color: #94a3b8; }
.empty-state { min-height: 250px; display: grid; place-content: center; justify-items: center; color: #8a98aa; }
.empty-state span { font-size: 34px; }
.empty-state strong { margin-top: 6px; }
.empty-state p { margin: 4px 0; }

.entry-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.form-panel form { padding: 26px; }
.secure-badge { border-radius: 999px; padding: 7px 11px; color: #087443; background: #e8f8ef; font-size: 10px; font-weight: 800; }
.form-section { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid #edf1f6; }
.section-title { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.section-title > span { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: var(--blue); background: #e9f2ff; font-size: 10px; font-weight: 900; }
.section-title h3 { margin: 0; font-size: 15px; }
.section-title p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset.field { min-width: 0; padding: 0; border: 0; }
.activity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.activity-option { min-height: 56px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; display: flex; align-items: flex-start; gap: 10px; color: #55677d; font-size: 11px; font-weight: 700; line-height: 1.65; background: white; transition: .15s ease; }
.activity-option:hover { border-color: #9bb9d9; background: #f8fbff; }
.activity-option:has(input:checked) { border-color: var(--blue); color: var(--ink); background: #eef6ff; box-shadow: 0 0 0 3px rgba(0,78,168,.07); }
.activity-option input { margin-top: 4px; accent-color: var(--blue); }
.hint { display: block; min-height: 18px; margin-top: 5px; font-size: 10px; font-weight: 800; }
.success-text { color: #087443; }
.error-text { color: #c52828; }
.muted { color: var(--muted); }
.upload-zone { min-height: 150px; border: 1.5px dashed #9cb9d8; border-radius: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--ink); background: #f7fbff; cursor: pointer; transition: .15s ease; }
.upload-zone:hover { border-color: var(--blue); background: #eef6ff; }
.upload-zone small { color: var(--muted); }
.upload-icon { color: var(--blue); font-size: 28px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.entry-aside { position: sticky; top: 98px; display: grid; gap: 15px; }
.blue-card { border-radius: 16px; padding: 24px; color: white; background: linear-gradient(145deg, #0057ba, #004187); box-shadow: var(--shadow); }
.blue-card > span { width: 45px; height: 45px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.13); font-size: 22px; }
.blue-card h3 { margin: 18px 0 7px; }
.blue-card p { margin: 0; color: #d6e8ff; font-size: 12px; line-height: 1.9; }
.tips { padding: 21px; }
.tips h3 { margin: 0 0 15px; font-size: 14px; }
.tips ul { margin: 0; padding-right: 18px; color: #65758a; font-size: 11px; line-height: 2.2; }

.users-layout { display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 20px; align-items: start; }
.create-user-panel { position: sticky; top: 98px; }
.user-form { padding: 21px; }
.team-panel { min-width: 0; }
.inline-input { width: 160px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 9px; color: var(--ink); }
.must-change { display: block; margin-top: 4px; color: #a65708; font-size: 9px; }
.switch-label { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.switch-label input { accent-color: var(--blue); }
.row-actions { display: flex; gap: 5px; min-width: 200px; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 80; padding: 20px; display: grid; place-items: center; background: rgba(9,27,52,.58); backdrop-filter: blur(4px); }
.dialog-card { width: min(480px, 100%); border-radius: 17px; padding: 25px; background: white; box-shadow: 0 28px 80px rgba(6,25,50,.35); }
.dialog-head { margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.dialog-head h2 { margin: 6px 0 4px; font-size: 23px; }
.dialog-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.dialog-head .icon-button { border-color: var(--line); color: #607089; background: white; }
.dialog-form .field { margin-bottom: 14px; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr auto; }
  .desktop-nav { display: none; }
  .mobile-nav { position: fixed; right: 50%; bottom: 16px; z-index: 50; transform: translateX(50%); display: flex; gap: 3px; padding: 5px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: var(--blue); box-shadow: 0 14px 35px rgba(0,43,94,.3); }
  .mobile-nav .nav-button { font-size: 11px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid.two-cards { grid-template-columns: 1fr 1fr; }
  .entry-layout, .users-layout { grid-template-columns: 1fr; }
  .entry-aside { position: static; grid-template-columns: 1fr 1fr; }
  .create-user-panel { position: static; }
}

@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; }
  .mobile-logo { display: block; }
  .topbar { min-height: 70px; grid-template-columns: 1fr auto; padding: 10px 14px; }
  .brand-divider, .brand-button small, .user-chip > span:last-child, #change-password { display: none; }
  .brand-button img { height: 39px; }
  .brand-button strong { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding-top: 25px; }
  .filters, .filters.with-creator { grid-template-columns: 1fr; }
  .two-cols, .activity-grid, .entry-aside { grid-template-columns: 1fr; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  table { min-width: 1040px; }
}

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid.two-cards { grid-template-columns: 1fr; }
  .stat-card { min-height: 115px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .form-panel form { padding: 18px; }
  .secure-badge { align-self: flex-start; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .avatar { display: none; }
  .btn.small { padding-inline: 10px; }
  .mobile-nav .nav-button { padding-inline: 12px; }
}
