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

/* ═══════════════════════════════════════════════════════════════
   IEMA DESIGN TOKENS
   ─────────────────────────────────────────────────────────────
   All colours/sizes live here. Edit these to retheme the whole
   dashboard shell AND the inner admin pages.
   ═══════════════════════════════════════════════════════════════ */
:root {
  /* ── Brand palette ── */
  --navy:          #0f2035;   /* sidebar / topbar background          */
  --navy-light:    #162c47;   /* sidebar gradient end                 */
  --navy-border:   rgba(255,255,255,.10);  /* dividers on dark bg     */
  --navy-hover:    rgba(255,255,255,.10);  /* nav item hover on dark  */
  --gold:          #C89B3C;   /* primary accent (logo, active items)  */
  --gold-light:    #d4af5a;   /* lighter accent variant               */
  --gold-subtle:   rgba(200,155,60,.18);  /* active nav bg tint      */

  /* ── Content palette ── */
  --primary:       #0f6fb2;
  --primary-700:   #0a4f80;
  --primary-50:    #eaf6ff;
  --accent:        #c9a959;
  --success:       #148a5b;
  --danger:        #c83e3e;
  --warning:       #b7791f;
  --info:          #2563eb;
  --bg:            #f4f7fb;
  --surface:       #ffffff;
  --surface-muted: #f8fafc;
  --text:          #172033;
  --muted:         #64748b;
  --border:        #dbe3ef;

  /* ── Shadows ── */
  --shadow-sm:  0 4px 14px rgba(15,35,55,.08);
  --shadow-md:  0 16px 40px rgba(15,35,55,.12);
  --shadow-topbar: 0 2px 12px rgba(0,0,0,.28);

  /* ── Geometry ── */
  --radius:     8px;
  --radius-lg:  10px;
  --radius-xl:  14px;
  --sidebar-w:  272px;   /* sidebar width (desktop)   */
  --topbar-h:   64px;    /* topbar height             */

  /* ── Focus ring ── */
  --focus-ring: 0 0 0 3px rgba(200,155,60,.45);

  /* ── Typography ── */
  --font-ui: "Inter", "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;

  /* ── Legacy aliases (keep for inner pages) ── */
  --card-shadow:  var(--shadow-md);
  --background:   var(--bg);
  --secondary:    var(--success);
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD SHELL — reusable utility classes
   ─────────────────────────────────────────────────────────────
   These classes are used exclusively in index.php / sidebar.php.
   They do NOT affect inner admin pages loaded in the iframe.
   ═══════════════════════════════════════════════════════════════ */

/* ── Layout: app shell root ── */
.db-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Sidebar ── */
.db-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-light) 100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

/* Off-canvas on mobile */
html[dir="ltr"] .db-sidebar { transform: translateX(-100%); }
html[dir="rtl"] .db-sidebar { transform: translateX(100%); }
.db-sidebar.is-open            { transform: translateX(0); }

/* Always visible on large screens */
@media (min-width: 1024px) {
  .db-sidebar { transform: translateX(0) !important; }
}

/* ── Sidebar: logo strip ── */
.db-sidebar__logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--navy-border);
  flex-shrink: 0;
}

.db-sidebar__logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.db-sidebar__logo-icon i { color: var(--navy); font-size: .85rem; }

.db-sidebar__brand-name {
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.15;
}

.db-sidebar__brand-sub {
  color: var(--gold);
  font-size: .7rem;
  opacity: .85;
  line-height: 1;
}

/* ── Sidebar: close btn (mobile) ── */
.db-sidebar__close {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.db-sidebar__close:hover { color: #fff; background: var(--navy-hover); }
@media (min-width: 1024px) { .db-sidebar__close { display: none; } }

/* ── Sidebar: search ── */
.db-sidebar__search-wrap {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--navy-border);
  flex-shrink: 0;
}

.db-sidebar__search {
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  color: #fff;
  font-size: .78rem;
  padding: .5rem 1rem .5rem 2.25rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
html[dir="rtl"] .db-sidebar__search { padding: .5rem 2.25rem .5rem 1rem; }
.db-sidebar__search::placeholder { color: rgba(255,255,255,.38); }
.db-sidebar__search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(200,155,60,.25);
}

.db-sidebar__search-icon {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,.38);
  font-size: .72rem;
  pointer-events: none;
}
html[dir="ltr"] .db-sidebar__search-icon { left: .85rem; }
html[dir="rtl"] .db-sidebar__search-icon { right: .85rem; }

/* ── Sidebar: nav scroll area ── */
.db-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: .6rem .75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,155,60,.4) transparent;
}
.db-sidebar__nav::-webkit-scrollbar { width: 4px; }
.db-sidebar__nav::-webkit-scrollbar-thumb {
  background: rgba(200,155,60,.4); border-radius: 999px;
}

/* ── Sidebar: section label ── */
.db-nav-section {
  padding: .5rem .75rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(200,155,60,.75);
}

/* ── Sidebar: parent button (has children) ── */
.db-nav-parent {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.78);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, background .15s;
  text-align: start;
}
.db-nav-parent:hover { color: #fff; background: var(--navy-hover); }

.db-nav-parent__label { display: flex; align-items: center; gap: .75rem; }
.db-nav-parent__icon  { width: 16px; text-align: center; font-size: .85rem; flex-shrink: 0; }

.db-nav-parent__arrow {
  font-size: .62rem;
  color: rgba(255,255,255,.35);
  transition: transform .25s ease;
  flex-shrink: 0;
}
.db-nav-parent__arrow.is-open {
  transform: rotate(180deg);
}
html[dir="rtl"] .db-nav-parent__arrow.is-open {
  transform: rotate(-180deg);
}

/* ── Sidebar: children container ── */
.db-nav-children {
  display: none;
  padding-inline-start: .85rem;
  margin-top: .2rem;
}
.db-nav-children.is-open {
  display: block;
  animation: dbSlideDown .18s ease-out;
}
@keyframes dbSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Sidebar: leaf button (no children) ── */
.db-nav-leaf {
  display: flex; align-items: center; gap: .75rem;
  width: 100%;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.78);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, background .15s;
  text-align: start;
}
.db-nav-leaf:hover { color: #fff; background: var(--navy-hover); }

/* ── Sidebar: child item inside children ── */
.db-nav-child {
  display: flex; align-items: center; gap: .6rem;
  width: 100%;
  padding: .5rem .75rem;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.6);
  font-size: .78rem;
  cursor: pointer;
  transition: color .15s, background .15s;
  text-align: start;
}
.db-nav-child:hover { color: #fff; background: rgba(255,255,255,.08); }

/* ── Active state ── */
.db-nav-leaf.is-active,
.db-nav-child.is-active {
  background: var(--gold-subtle) !important;
  color: var(--gold) !important;
}
.db-nav-leaf.is-active i,
.db-nav-child.is-active i {
  color: var(--gold) !important;
}

/* ── Sidebar: language switcher ── */
.db-lang-switch {
  display: flex; gap: .5rem;
  padding: .6rem .75rem;
}
.db-lang-btn {
  flex: 1; text-align: center;
  padding: .4rem .5rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.65);
  font-size: .75rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s, background .15s;
  border: 1px solid transparent;
}
.db-lang-btn:hover { color: #fff; background: rgba(255,255,255,.15); }
.db-lang-btn.is-active {
  background: var(--gold-subtle);
  color: var(--gold);
  border-color: rgba(200,155,60,.3);
}

/* ── Sidebar: logout area ── */
.db-sidebar__footer {
  flex-shrink: 0;
  padding: .75rem 1rem;
  border-top: 1px solid var(--navy-border);
}

.db-logout-btn {
  display: flex; align-items: center; gap: .75rem;
  width: 100%;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: #f87171;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.db-logout-btn:hover { color: #fca5a5; background: rgba(239,68,68,.08); }

/* ── Overlay (mobile) ── */
.db-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
}
.db-overlay.is-open { display: block; }

/* ── Main wrapper ── */
.db-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
  margin-inline-start: var(--sidebar-w);
  transition: margin .3s cubic-bezier(.4,0,.2,1);
  background: var(--bg);
}
@media (max-width: 1023px) {
  .db-main { margin-inline-start: 0 !important; }
}

/* ── Topbar ── */
.db-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--navy);
  box-shadow: var(--shadow-topbar);
  flex-shrink: 0;
}

.db-topbar__start { display: flex; align-items: center; gap: .75rem; }
.db-topbar__end   { display: flex; align-items: center; gap: .5rem; }

/* Hamburger */
.db-hamburger {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.db-hamburger:hover { color: #fff; background: rgba(255,255,255,.1); }
@media (min-width: 1024px) { .db-hamburger { display: none; } }

/* Mobile brand (topbar) */
.db-topbar__mobile-brand {
  display: flex; align-items: center; gap: .5rem;
}
@media (min-width: 1024px) { .db-topbar__mobile-brand { display: none; } }

.db-topbar__mobile-logo {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
}
.db-topbar__mobile-logo i { color: var(--navy); font-size: .7rem; }
.db-topbar__mobile-name   { color: #fff; font-weight: 700; font-size: .85rem; }

/* Desktop page title */
.db-topbar__page-title {
  display: none;
  flex-direction: column;
}
@media (min-width: 1024px) { .db-topbar__page-title { display: flex; } }
.db-topbar__page-title h1 {
  color: #fff !important;
  font-size: .85rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
  line-height: 1.2;
}
.db-topbar__page-title time {
  color: rgba(255,255,255,.45);
  font-size: .7rem;
}

/* Topbar divider */
.db-topbar__divider {
  width: 1px; height: 24px;
  background: rgba(255,255,255,.12);
  margin: 0 .25rem;
}

/* ── Topbar: icon action button ── */
.db-topbar-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  transition: color .15s, background .15s;
  text-decoration: none;
}
.db-topbar-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Notification badge */
.db-badge {
  position: absolute;
  top: 5px; inset-inline-end: 5px;
  min-width: 16px; height: 16px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--navy);
}

/* ── Topbar: quick-access text buttons ── */
.db-topbar-quick {
  display: none;
  align-items: center;
  gap: .25rem;
}
@media (min-width: 640px) { .db-topbar-quick { display: flex; } }

.db-topbar-quick__btn {
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.7);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.db-topbar-quick__btn:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ── Topbar: user profile chip ── */
.db-profile {
  display: flex; align-items: center; gap: .5rem;
  padding-inline-start: .75rem;
  border-inline-start: 1px solid rgba(255,255,255,.12);
}

.db-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-size: .75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
}

.db-profile__info { display: none; }
@media (min-width: 640px) { .db-profile__info { display: flex; flex-direction: column; } }
.db-profile__name { color: #fff; font-size: .78rem; font-weight: 600; line-height: 1.2; }
.db-profile__role { color: rgba(255,255,255,.42); font-size: .65rem; line-height: 1; }

/* ── Topbar: logout button ── */
.db-topbar-logout {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: #f87171;
  cursor: pointer;
  transition: color .15s, background .15s;
  text-decoration: none;
}
.db-topbar-logout:hover { color: #fca5a5; background: rgba(239,68,68,.1); }

/* ── Content area ── */
.db-content {
  flex: 1;
  position: relative;
}

/* ── Welcome screen ── */
.db-welcome {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #e8eef6 100%);
}

.db-welcome__icon-wrap {
  width: 76px; height: 76px;
  border-radius: var(--radius-xl);
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
}
.db-welcome__icon-wrap i { font-size: 1.75rem; color: var(--gold); }

.db-welcome__title {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  color: var(--navy) !important;
  margin: 0 0 .5rem !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.db-welcome__subtitle {
  color: var(--muted);
  font-size: .88rem;
  max-width: 440px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* ── Quick-access card grid ── */
.db-cards {
  display: grid;
  gap: .75rem;
  width: 100%;
  max-width: 680px;
  /* 1 col mobile → 2 col tablet → 4 col large */
  grid-template-columns: 1fr;
}
@media (min-width: 480px) {
  .db-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .db-cards { grid-template-columns: repeat(4, 1fr); }
}

.db-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.1rem .75rem;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
  transition: box-shadow .18s, transform .18s;
  text-align: center;
}
.db-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.db-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.db-card__icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .6rem;
  transition: background .18s;
}

.db-card__label { font-size: .78rem; font-weight: 600; color: #334155; }

/* colour variants for each card */
.db-card--blue   .db-card__icon { background: #eff6ff; }
.db-card--blue   .db-card__icon i { color: #3b82f6; }
.db-card--blue:hover .db-card__icon { background: #dbeafe; }

.db-card--purple .db-card__icon { background: #f5f3ff; }
.db-card--purple .db-card__icon i { color: #8b5cf6; }
.db-card--purple:hover .db-card__icon { background: #ede9fe; }

.db-card--amber  .db-card__icon { background: #fffbeb; }
.db-card--amber  .db-card__icon i { color: #f59e0b; }
.db-card--amber:hover .db-card__icon { background: #fef3c7; }

.db-card--green  .db-card__icon { background: #ecfdf5; }
.db-card--green  .db-card__icon i { color: #10b981; }
.db-card--green:hover .db-card__icon { background: #d1fae5; }

/* ── Iframe ── */
.db-iframe {
  border: none;
  width: 100%;
  height: calc(100vh - var(--topbar-h));
  display: block;
}

/* ── Focus ring (accessibility) ── */
.db-shell *:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ── RTL sidebar offset ── */
html[dir="rtl"] .db-main { margin-inline-start: var(--sidebar-w); margin-inline-end: 0; }
@media (max-width: 1023px) {
  html[dir="rtl"] .db-main { margin-inline-start: 0 !important; margin-inline-end: 0 !important; }
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 111, 178, 0.06), rgba(255, 255, 255, 0) 240px),
    var(--bg) !important;
  color: var(--text) !important;
  font-family: var(--font-ui) !important;
  line-height: 1.55;
}

a {
  color: var(--primary);
}

h1,
h2,
h3,
h4 {
  color: var(--text) !important;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0 0 1rem;
}

h2 {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding-bottom: .85rem !important;
  border-bottom: 1px solid var(--border) !important;
}

h2::after {
  display: none !important;
}

.main-content,
.container,
.card,
.form-section,
.box,
.panel,
.section {
  background: var(--surface) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}

.main-content,
.container {
  width: min(1600px, calc(100% - 2rem));
  margin: 1.25rem auto !important;
  padding: 1.25rem !important;
}

.form-section,
.card,
.panel,
.section {
  padding: 1.1rem !important;
}

.muted,
.no-file,
small {
  color: var(--muted) !important;
}

.table-container,
.table-wrap,
.responsive-table,
div[style*="overflow-x:auto"],
div[style*="overflow-x: auto"] {
  width: 100%;
  overflow-x: auto !important;
  background: var(--surface) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  margin: 1rem 0 !important;
}

table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: var(--surface) !important;
  color: var(--text);
}

thead th,
table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--primary) !important;
  color: #fff !important;
  font-size: .82rem !important;
  font-weight: 800 !important;
  text-align: left;
  padding: .85rem .9rem !important;
  border: 0 !important;
  white-space: nowrap;
}

table td {
  padding: .8rem .9rem !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: .88rem !important;
  vertical-align: middle;
}

tbody tr:nth-child(even) {
  background: var(--surface-muted) !important;
}

tbody tr:hover {
  background: var(--primary-50) !important;
  transform: none !important;
  box-shadow: none !important;
}

tbody tr:last-child td {
  border-bottom: 0 !important;
}

.btn,
button,
input[type="submit"],
input[type="button"],
a.btn {
  min-height: 38px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .55rem .9rem !important;
  border: 1px solid transparent !important;
  border-radius: var(--radius) !important;
  background: #eef4fb !important;
  color: var(--text) !important;
  font-family: var(--font-ui) !important;
  font-size: .88rem !important;
  font-weight: 800 !important;
  line-height: 1;
  text-decoration: none !important;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
  white-space: nowrap;
}

.btn:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
a.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary,
.btn-view,
.btn-edit,
.edit-btn {
  background: var(--primary) !important;
  color: #fff !important;
}

.btn-success,
.btn-add {
  background: var(--success) !important;
  color: #fff !important;
}

.btn-danger,
.btn-delete,
.delete-btn {
  background: var(--danger) !important;
  color: #fff !important;
}

.btn-purple,
.btn-secondary {
  background: #5b5fc7 !important;
  color: #fff !important;
}

.btn-print,
.btn-light {
  background: var(--surface) !important;
  color: var(--primary) !important;
  border-color: var(--border) !important;
}

.actions,
.action-buttons,
.btn-group {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

label {
  display: inline-block;
  margin-bottom: .35rem;
  color: #334155 !important;
  font-size: .86rem;
  font-weight: 800 !important;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: .65rem .75rem !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: #fff !important;
  color: var(--text) !important;
  font-family: var(--font-ui) !important;
  font-size: .92rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: var(--focus-ring) !important;
}

.grid-form,
.form-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem !important;
}

.input-group,
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.message,
.success,
.alert-success {
  border: 1px solid rgba(20, 138, 91, .25);
  border-radius: var(--radius);
  background: #eafaf3 !important;
  color: #0f6846 !important;
  padding: .85rem 1rem;
  font-weight: 800;
}

.error,
.alert-danger,
.danger {
  border: 1px solid rgba(200, 62, 62, .25);
  border-radius: var(--radius);
  background: #fff0f0 !important;
  color: #9f2f2f !important;
  padding: .85rem 1rem;
  font-weight: 800;
}

.pill,
.badge,
.payment-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 28px;
  padding: .3rem .65rem !important;
  border-radius: 999px !important;
  font-size: .78rem;
  font-weight: 800;
}

.paid {
  background: #eafaf3 !important;
  color: var(--success) !important;
}

.unpaid {
  background: #fff0f0 !important;
  color: var(--danger) !important;
}

.student-photo,
.avatar,
.photo {
  width: 42px !important;
  height: 42px !important;
  border: 1px solid var(--border);
  border-radius: 50% !important;
  object-fit: cover;
  background: var(--surface-muted);
}

.avatar-placeholder {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

.full-span {
  grid-column: 1 / -1;
}

.tranche-row,
.inline-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .65rem;
}

.student-id-chip,
.soft-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .35rem .75rem;
  border-radius: 999px;
  background: var(--accent);
  color: #082338;
  font-weight: 900;
}

.card-meta {
  margin-top: 2.5rem;
}

.card-field-row {
  display: flex;
  gap: 3rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.card-label {
  color: var(--accent) !important;
  font-size: .72rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.card-value {
  margin: 0;
  font-weight: 700;
}

.barcode-text {
  position: absolute;
  right: 40px;
  bottom: 30px;
  font-family: "Libre Barcode 39", var(--font-ui);
  font-size: 50px;
}

.payment-note {
  margin-top: 25px;
  padding: .35rem 1.1rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .75);
  color: var(--primary-700);
  font-weight: 800;
}

.toolbar,
.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  body {
    padding: .75rem !important;
  }

  .main-content,
  .container {
    width: 100%;
    margin: .75rem 0 !important;
    padding: 1rem !important;
  }

  table th,
  table td {
    padding: .7rem !important;
    font-size: .82rem !important;
  }

  .btn,
  button,
  input[type="submit"],
  input[type="button"] {
    min-height: 36px;
    padding: .5rem .7rem !important;
  }
}

body.app-shell {
  height: 100vh;
  padding: 0 !important;
  overflow: hidden;
}

body.app-shell .main-content {
  width: auto !important;
  min-height: 100vh;
  margin: 0 0 0 320px !important;
  padding: 1.25rem !important;
  display: flex;
  align-items: stretch;
  justify-content: center;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background:
    linear-gradient(180deg, rgba(15, 111, 178, 0.08), rgba(255, 255, 255, 0) 240px),
    var(--bg) !important;
}

body.app-shell[dir="rtl"] .main-content {
  margin: 0 320px 0 0 !important;
}

body.app-shell iframe {
  width: 100% !important;
  height: calc(100vh - 2.5rem) !important;
  max-width: none !important;
  margin: 0 !important;
  border: 0;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}

body.app-shell .sidebar {
  width: 320px;
  flex-shrink: 0;
}

body.app-shell .sidebar input[type="search"] {
  min-height: 42px;
  border-radius: 999px !important;
}

@media (max-width: 1200px) {
  body.app-shell .main-content {
    margin-left: 250px !important;
  }

  body.app-shell[dir="rtl"] .main-content {
    margin-left: 0 !important;
    margin-right: 250px !important;
  }

  body.app-shell .sidebar {
    width: 250px;
  }
}

@media (max-width: 992px) {
  body.app-shell {
    height: auto;
    overflow: auto;
  }

  body.app-shell .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-radius: 0 !important;
  }

  body.app-shell .main-content,
  body.app-shell[dir="rtl"] .main-content {
    margin: 0 !important;
    min-height: auto;
    padding: 1rem !important;
  }

  body.app-shell iframe {
    height: 75vh !important;
  }
}
