/* ============================================================
   GIADEC RefGen – App Stylesheet v2
   Professional corporate theme · Ghana colour palette
   ============================================================ */

:root {
  --green-900: #003d1f;
  --green-800: #005229;
  --green-700: #006633;
  --green-600: #00803f;
  --green-100: #e6f4ec;
  --green-50:  #f0faf4;
  --gold-500:  #FCD116;
  --gold-600:  #e0ba00;
  --gold-100:  #fefce8;
  --red-600:   #CE1126;
  --red-100:   #fef2f2;
  --blue-500:  #3b82f6;
  --blue-100:  #eff6ff;
  --purple-500:#8b5cf6;
  --purple-100:#f5f3ff;
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --border-md: #cbd5e1;
  --text-900:  #0f172a;
  --text-700:  #334155;
  --text-500:  #64748b;
  --text-300:  #94a3b8;
  --sidebar-w: 230px;
  --navbar-h:  64px;
  --footer-h:  52px;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 4px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.18);
  --ease:      .18s ease;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text-700); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(135deg, #0a2e1a 0%, #0d3d22 60%, #1a4d2e 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.login-wrapper {
  display: flex; width: 100%; max-width: 920px; min-height: 580px;
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.login-brand {
  flex: 1.1;
  background: linear-gradient(160deg, var(--green-900) 0%, var(--green-800) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 2.5rem; position: relative; overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(252,209,22,.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(206,17,38,.06) 0%, transparent 50%);
}
.login-brand-bg {
  position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,.025); bottom: -100px; right: -80px;
}
.brand-inner {
  position: relative; z-index: 1; text-align: center; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.login-logo {
  width: 200px; max-width: 100%;
  filter: brightness(0) invert(1); opacity: .92; margin-bottom: 1.5rem;
}
.brand-divider { width: 48px; height: 3px; background: var(--gold-500); border-radius: 2px; margin: 0 auto 1.25rem; }
.brand-tagline { color: rgba(255,255,255,.7); font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 2rem; }
.brand-features { display: flex; flex-direction: column; gap: .55rem; align-self: flex-start; }
.brand-feature { display: flex; align-items: center; gap: .6rem; color: rgba(255,255,255,.6); font-size: .78rem; }
.feature-dot { width: 6px; height: 6px; background: var(--gold-500); border-radius: 50%; flex-shrink: 0; }
.login-brand-footer { position: relative; z-index: 1; color: rgba(255,255,255,.35); font-size: .7rem; text-align: center; padding-top: 1.5rem; }
.login-brand-footer strong { color: rgba(255,255,255,.55); }

.login-form-panel { flex: 1; background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 3rem 2.5rem; }
.login-form-inner { width: 100%; max-width: 340px; }
.login-form-header { margin-bottom: 2rem; }
.login-form-header h2 { font-size: 1.6rem; font-weight: 700; color: var(--text-900); line-height: 1.2; }
.login-form-header p  { color: var(--text-300); font-size: .875rem; margin-top: .35rem; }
.btn-login { margin-top: .5rem; font-size: .9rem; padding: .7rem 1rem; border-radius: 8px; }
.login-form-footer { margin-top: 2rem; text-align: center; font-size: .7rem; color: var(--text-300); line-height: 1.7; }
.login-form-footer strong { color: var(--text-500); }

/* ── NAVBAR ────────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--navbar-h);
  background: var(--green-900); display: flex; align-items: center;
  justify-content: space-between; padding: 0 1.25rem; z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.25); gap: 1rem;
}
.brand-logo-link { display: flex; align-items: center; }
.navbar-logo { height: 38px; width: auto; filter: brightness(0) invert(1); opacity: .88; }
.navbar-center { flex: 1; text-align: center; }
.navbar-title { color: rgba(255,255,255,.55); font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 500; }

.user-chip { display: flex; align-items: center; gap: .5rem; cursor: pointer; position: relative; padding: .3rem .6rem; border-radius: 8px; transition: background var(--ease); }
.user-chip:hover { background: rgba(255,255,255,.1); }
.user-avatar { width: 32px; height: 32px; background: var(--gold-500); color: var(--green-900); border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name  { color: white; font-size: .8rem; font-weight: 500; }
.user-role-badge { font-size: .6rem; text-transform: uppercase; letter-spacing: .07em; padding: .1rem .3rem; border-radius: 3px; font-weight: 600; width: fit-content; }
.role-admin { background: rgba(252,209,22,.2); color: var(--gold-500); }
.role-user  { background: rgba(255,255,255,.12); color: rgba(255,255,255,.65); }

.user-dropdown { display: none; position: absolute; top: calc(100% + 8px); right: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-md); min-width: 200px; overflow: hidden; z-index: 300; border: 1px solid var(--border); }
.user-chip:hover .user-dropdown { display: block; }
.dropdown-user-header { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; background: var(--bg); }
.dropdown-avatar { width: 34px; height: 34px; background: var(--green-700); color: white; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex-shrink: 0; }
.dropdown-name { font-size: .84rem; font-weight: 600; color: var(--text-900); }
.dropdown-role { font-size: .68rem; color: var(--text-300); text-transform: uppercase; }
.dropdown-divider { height: 1px; background: var(--border); }
.dropdown-item { display: flex; align-items: center; gap: .5rem; padding: .65rem 1rem; font-size: .82rem; color: var(--text-700); transition: background var(--ease); }
.dropdown-item:hover { background: var(--bg); text-decoration: none; }
.dropdown-item-danger { color: var(--red-600); }
.dropdown-item-danger:hover { background: var(--red-100); }

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: var(--navbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; z-index: 50;
}
.sidebar-nav { flex: 1; padding: 1rem .625rem; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label { font-size: .63rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-300); padding: .85rem .625rem .3rem; font-weight: 600; }

.nav-item { display: flex; align-items: center; gap: .65rem; padding: .5rem .7rem; border-radius: var(--radius-sm); color: var(--text-500); font-size: .83rem; font-weight: 500; transition: all var(--ease); text-decoration: none; }
.nav-item:hover { background: var(--green-50); color: var(--green-700); text-decoration: none; }
.nav-item.active { background: var(--green-100); color: var(--green-800); font-weight: 600; }

/* Small icon container */
.nav-icon { width: 26px; height: 26px; display: grid; place-items: center; flex-shrink: 0; border-radius: 5px; transition: background var(--ease); }
.nav-icon svg { width: 14px; height: 14px; stroke: currentColor; }
.nav-item:hover .nav-icon { background: rgba(0,102,51,.1); }
.nav-item.active .nav-icon { background: var(--green-700); }
.nav-item.active .nav-icon svg { stroke: white; }
.nav-label { line-height: 1; }

.sidebar-footer-brand { padding: .9rem 1rem 1.1rem; border-top: 1px solid var(--border); display: flex; justify-content: center; }
.sidebar-logo { width: 100px; opacity: .3; filter: grayscale(1); }

/* ── LAYOUT ────────────────────────────────────────────────── */
.layout { display: flex; padding-top: var(--navbar-h); min-height: 100vh; }
.content-wrap { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: calc(100vh - var(--navbar-h)); }
.main-content { flex: 1; padding: 1.75rem 2rem; min-width: 0; }

/* ── FOOTER ────────────────────────────────────────────────── */
.app-footer { background: var(--surface); border-top: 1px solid var(--border); height: var(--footer-h); display: flex; align-items: center; justify-content: center; padding: 0 2rem; }
.footer-inner { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: center; }
.footer-logo  { height: 20px; width: auto; opacity: .3; filter: grayscale(1); }
.footer-text  { font-size: .72rem; color: var(--text-300); }
.footer-text strong { color: var(--text-500); }

/* ── PAGE HEADER ───────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.page-title  { font-size: 1.4rem; font-weight: 700; color: var(--text-900); line-height: 1.2; }
.page-sub    { color: var(--text-300); font-size: .8rem; margin-top: .2rem; }
.page-sub strong { color: var(--text-500); }
.header-actions { display: flex; gap: .5rem; align-items: center; }
.back-link { color: var(--text-300); font-size: .78rem; display: block; margin-bottom: .35rem; }
.back-link:hover { color: var(--green-700); }

/* ── DASHBOARD SEARCH ──────────────────────────────────────── */
.dash-search-wrap { margin-bottom: 1.5rem; }
.dash-search-form { display: flex; gap: .6rem; align-items: stretch; }
.dash-search-box { flex: 1; position: relative; display: flex; align-items: center; }
.dash-search-box .search-icon { position: absolute; left: .85rem; color: var(--text-300); pointer-events: none; flex-shrink: 0; }
.dash-search-box input { width: 100%; padding: .65rem .9rem .65rem 2.5rem; border: 1.5px solid var(--border-md); border-radius: var(--radius-sm); font-size: .875rem; font-family: var(--font); color: var(--text-900); background: var(--surface); transition: border-color var(--ease), box-shadow var(--ease); }
.dash-search-box input:focus { outline: none; border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(0,102,51,.1); }
.search-clear { position: absolute; right: .75rem; color: var(--text-300); display: grid; place-items: center; padding: .2rem; border-radius: 4px; transition: all var(--ease); }
.search-clear:hover { color: var(--red-600); background: var(--red-100); text-decoration: none; }
.search-result-meta { display: flex; align-items: center; justify-content: space-between; margin-top: .55rem; font-size: .78rem; color: var(--text-500); padding: 0 .2rem; }
.link-view-all { color: var(--green-700); font-size: .78rem; font-weight: 500; }
.link-view-all:hover { text-decoration: underline; }

/* ── STATS ─────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.2rem; display: flex; align-items: center; gap: .85rem; box-shadow: var(--shadow); border-left: 3px solid transparent; transition: transform var(--ease), box-shadow var(--ease); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.accent-green  { border-color: var(--green-700); }
.stat-card.accent-gold   { border-color: var(--gold-600); }
.stat-card.accent-blue   { border-color: var(--blue-500); }
.stat-card.accent-purple { border-color: var(--purple-500); }
.stat-icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon svg { width: 17px; height: 17px; }
.accent-green  .stat-icon { background: var(--green-50);  color: var(--green-700); }
.accent-gold   .stat-icon { background: var(--gold-100);  color: var(--gold-600); }
.accent-blue   .stat-icon { background: var(--blue-100);  color: var(--blue-500); }
.accent-purple .stat-icon { background: var(--purple-100);color: var(--purple-500); }
.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-900); line-height: 1; }
.stat-label { font-size: .73rem; color: var(--text-300); margin-top: .22rem; }
.stat-arrow { color: var(--text-300); font-size: .8rem; }

/* ── CARD ───────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: .85rem 1.2rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: .88rem; font-weight: 600; color: var(--text-900); }
.link-muted { font-size: .76rem; color: var(--text-300); }
.link-muted:hover { color: var(--green-700); }
.dash-cols { display: flex; gap: 1rem; flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 200px; }
.flex-2 { flex: 2; min-width: 280px; }

/* ── DEPT BARS ──────────────────────────────────────────────── */
.dept-bars   { padding: .85rem 1.2rem; display: flex; flex-direction: column; gap: .6rem; }
.dept-bar-row{ display: flex; align-items: center; gap: .6rem; }
.dept-name   { font-size: .73rem; width: 120px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-500); }
.dept-bar-track { flex: 1; background: var(--bg); border-radius: 4px; height: 7px; overflow: hidden; }
.dept-bar-fill  { height: 100%; background: linear-gradient(90deg, var(--green-700), var(--green-600)); border-radius: 4px; transition: width .7s ease; }
.dept-count  { font-size: .73rem; font-weight: 600; width: 24px; text-align: right; color: var(--text-500); }

/* ── TABLE ──────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.table th { padding: .6rem 1rem; text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-300); background: var(--bg); border-bottom: 1px solid var(--border); font-weight: 600; white-space: nowrap; }
.table td { padding: .68rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--ease); }
.table tbody tr:hover { background: #fafcfe; }
.text-truncate { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-300); }
.nowrap      { white-space: nowrap; }
.py-4        { padding-top: 2rem; padding-bottom: 2rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-300); }
.empty-state svg { display: block; margin: 0 auto .7rem; opacity: .35; }
.empty-state p { font-size: .875rem; }
.empty-state a { color: var(--green-700); font-weight: 500; }

/* ── BADGES ─────────────────────────────────────────────────── */
.ref-badge { display: inline-block; background: var(--green-50); color: var(--green-800); border: 1px solid #b2dfca; border-radius: 5px; padding: .2rem .5rem; font-size: .74rem; font-family: 'Courier New', monospace; font-weight: 700; white-space: nowrap; letter-spacing: .02em; }
.dept-chip { display: inline-block; background: var(--bg); color: var(--text-500); border: 1px solid var(--border); border-radius: 4px; padding: .13rem .42rem; font-size: .71rem; font-weight: 500; white-space: nowrap; }

/* ── ACTION BUTTONS ─────────────────────────────────────────── */
.action-btns { display: flex; gap: .3rem; align-items: center; }
.btn-icon { width: 26px; height: 26px; border-radius: 5px; border: 1px solid var(--border); background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-500); transition: all var(--ease); }
.btn-icon:hover { background: var(--bg); color: var(--green-700); border-color: var(--green-700); }
.btn-icon-danger:hover { background: var(--red-100); color: var(--red-600); border-color: #fca5a5; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .48rem .95rem; border-radius: var(--radius-sm); font-size: .83rem; font-weight: 500; cursor: pointer; border: none; transition: all var(--ease); font-family: var(--font); white-space: nowrap; text-decoration: none; line-height: 1.2; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green-700); color: white; }
.btn-primary:hover { background: var(--green-800); }
.btn-outline { background: transparent; color: var(--text-700); border: 1px solid var(--border-md); }
.btn-outline:hover { background: var(--bg); border-color: var(--text-300); }
.btn-danger  { background: var(--red-600); color: white; }
.btn-danger:hover { background: #a5091e; }
.btn-block   { width: 100%; justify-content: center; }
.btn-sm      { padding: .33rem .7rem; font-size: .76rem; }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem; }
.form-group { display: flex; flex-direction: column; gap: .32rem; }
.form-row   { display: flex; gap: .9rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 170px; }
label { font-size: .78rem; font-weight: 600; color: var(--text-700); }
.req  { color: var(--red-600); }
.badge-auto { display: inline-block; background: var(--blue-100); color: #1d4ed8; font-size: .58rem; font-weight: 700; padding: .1rem .35rem; border-radius: 3px; text-transform: uppercase; letter-spacing: .07em; vertical-align: middle; margin-left: .3rem; }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], select, textarea {
  padding: .52rem .78rem; border: 1.5px solid var(--border-md); border-radius: var(--radius-sm);
  font-size: .83rem; font-family: var(--font); color: var(--text-900); background: var(--surface);
  transition: border-color var(--ease), box-shadow var(--ease); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(0,102,51,.1); }
input[readonly] { background: var(--bg); color: var(--text-300); cursor: default; }
.form-hint { font-size: .72rem; color: var(--text-300); }

.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: .72rem; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-300); pointer-events: none; }
.input-icon-wrap input { padding-left: 2.25rem; }
.toggle-pwd { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: .2rem; color: var(--text-300); display: grid; place-items: center; }
.toggle-pwd:hover { color: var(--text-700); }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; }

/* ── REF PREVIEW ────────────────────────────────────────────── */
.ref-live-preview { background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 100%); color: white; border-radius: var(--radius-sm); padding: .85rem 1.1rem; display: flex; align-items: center; gap: .7rem; margin: .45rem 0 .9rem; font-family: monospace; flex-wrap: wrap; }
.preview-label { font-size: .68rem; opacity: .7; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; font-family: var(--font); }
.preview-value { font-size: 1.1rem; font-weight: 700; flex: 1; letter-spacing: .02em; }
.preview-badge { font-size: .7rem; }
.preview-badge.updating { opacity: .5; }
.preview-badge.ok   { color: var(--gold-500); }
.preview-badge.err  { color: #fca5a5; }
.ref-input { font-family: 'Courier New', monospace; font-weight: 600; font-size: .88rem; background: var(--bg); color: var(--green-800); }

/* ── GENERATED REF CARD ─────────────────────────────────────── */
.ref-preview-card { background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 100%); color: white; border-radius: var(--radius); padding: 1.6rem; text-align: center; margin-bottom: 1.4rem; box-shadow: var(--shadow-md); position: relative; overflow: hidden; }
.ref-preview-card::before { content: ''; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.05); bottom: -60px; right: -40px; }
.ref-preview-label   { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; opacity: .7; margin-bottom: .45rem; font-family: var(--font); }
.ref-preview-number  { font-size: 1.65rem; font-weight: 800; font-family: monospace; letter-spacing: .03em; margin-bottom: .45rem; }
.ref-preview-meta    { font-size: .76rem; opacity: .7; margin-bottom: 1.1rem; }
.ref-preview-actions { display: flex; gap: .55rem; justify-content: center; flex-wrap: wrap; position: relative; z-index: 1; }
.ref-preview-actions .btn-outline { border-color: rgba(255,255,255,.35); color: white; }
.ref-preview-actions .btn-outline:hover { background: rgba(255,255,255,.1); }

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert { padding: .7rem .95rem; border-radius: var(--radius-sm); margin-bottom: .9rem; font-size: .83rem; border-left: 3px solid transparent; }
.alert-success { background: var(--green-50); color: #166534; border-color: #22c55e; }
.alert-danger  { background: var(--red-100);  color: #991b1b; border-color: var(--red-600); }
.alert-info    { background: var(--blue-100); color: #1e40af; border-color: var(--blue-500); }

/* ── PAGINATION ─────────────────────────────────────────────── */
.pagination { display: flex; gap: .3rem; padding: .85rem 1.2rem; flex-wrap: wrap; }
.page-btn { width: 30px; height: 30px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: .76rem; background: var(--surface); border: 1px solid var(--border); color: var(--text-500); transition: all var(--ease); }
.page-btn:hover { background: var(--green-50); color: var(--green-700); border-color: var(--green-700); text-decoration: none; }
.page-btn.active { background: var(--green-700); color: white; border-color: var(--green-700); }

/* ── FILTER BAR ─────────────────────────────────────────────── */
.filter-bar { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; background: var(--surface); padding: .85rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .9rem; }
.filter-search { flex: 2; min-width: 175px; }
.filter-bar select { width: auto; min-width: 145px; }

/* ── ROLE / STATUS ──────────────────────────────────────────── */
.role-badge { display: inline-block; font-size: .64rem; font-weight: 700; padding: .13rem .42rem; border-radius: 4px; text-transform: uppercase; letter-spacing: .05em; }
.role-admin { background: #fef3c7; color: #92400e; }
.role-user  { background: var(--green-50); color: var(--green-800); }
.status-badge { display: inline-block; font-size: .68rem; font-weight: 600; padding: .18rem .48rem; border-radius: 20px; }
.status-active   { background: #dcfce7; color: #166534; }
.status-inactive { background: var(--bg); color: var(--text-300); }

/* ── AUDIT BADGES ───────────────────────────────────────────── */
.action-badge { display: inline-block; font-size: .64rem; font-weight: 700; padding: .13rem .42rem; border-radius: 4px; text-transform: uppercase; }
.action-login  { background: #dcfce7; color: #15803d; }
.action-logout { background: var(--bg); color: var(--text-300); }
.action-create { background: var(--blue-100); color: #1d4ed8; }
.action-update { background: var(--gold-100); color: #a16207; }
.action-delete { background: var(--red-100); color: #b91c1c; }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(3px); animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.6rem; max-width: 440px; width: 100%; animation: slideUp .2s ease; max-height: 90vh; overflow-y: auto; }
.modal-lg { max-width: 510px; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.modal-header h3 { font-size: .95rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; font-size: .95rem; color: var(--text-300); padding: .2rem; line-height: 1; border-radius: 4px; }
.modal-close:hover { background: var(--bg); color: var(--text-700); }
.modal-icon { font-size: 1.8rem; text-align: center; margin-bottom: .65rem; }
.modal h3  { text-align: center; margin-bottom: .4rem; }
.modal p   { text-align: center; color: var(--text-500); font-size: .875rem; margin-bottom: 1.1rem; }
.modal-actions { display: flex; gap: .6rem; justify-content: center; margin-top: 1.25rem; }
.modal-actions .btn { min-width: 88px; }

/* ── RECORD VIEW ────────────────────────────────────────────── */
.record-header { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.4rem; flex-wrap: wrap; gap: 1rem; }
.record-logo   { display: flex; align-items: center; gap: .7rem; }
.logo-mark     { width: 38px; height: 38px; background: var(--green-700); color: white; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: .82rem; }
.record-ref-display { text-align: right; }
.ref-label         { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-300); }
.ref-number-large  { font-family: 'Courier New', monospace; font-size: 1.3rem; font-weight: 800; color: var(--green-800); }
.record-divider { border: none; border-top: 1px solid var(--border); margin: 0; }
.record-grid   { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 1.05rem; padding: 1.2rem 1.4rem; }
.record-field  { display: flex; flex-direction: column; gap: .18rem; }
.field-label   { font-size: .67rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-300); font-weight: 600; }
.field-value   { font-size: .875rem; color: var(--text-900); }
.span-2        { grid-column: span 2; }
.record-meta   { padding: .85rem 1.4rem; font-size: .76rem; color: var(--text-300); }

/* ── TOAST ──────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 1.4rem; right: 1.4rem; z-index: 400; display: flex; flex-direction: column; gap: .45rem; }
.toast { background: var(--surface); border-radius: var(--radius-sm); padding: .75rem .95rem; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: .5rem; font-size: .82rem; min-width: 230px; animation: slideInRight .22s ease; border-left: 3px solid var(--green-700); }
.toast.success { border-color: #22c55e; }
.toast.error   { border-color: var(--red-600); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0 } to { transform: translateX(0); opacity: 1 } }

/* ── PRINT ──────────────────────────────────────────────────── */
@media print {
  .navbar, .sidebar, .header-actions, .btn, .back-link, .app-footer { display: none !important; }
  .layout { padding-top: 0; }
  .content-wrap { margin-left: 0; }
  .main-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .content-wrap { margin-left: 0; }
  .main-content { padding: 1rem; }
  .login-wrapper { flex-direction: column; border-radius: 0; min-height: 100vh; }
  .login-brand   { padding: 2rem; }
  .login-logo    { width: 150px; }
  .stats-grid    { grid-template-columns: repeat(2, 1fr); }
  .dash-cols     { flex-direction: column; }
  .span-2        { grid-column: span 1; }
  .filter-bar    { flex-direction: column; }
  .filter-bar select, .filter-search { width: 100%; }
  .navbar-title  { display: none; }
  .dash-search-form { flex-direction: column; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .ref-preview-number { font-size: 1.1rem; }
}
