/* ============================================================
   BASE.CSS — CSS variables, reset, typography, shell layout
   ============================================================ */

/* ---- Font ------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  src: url('../assets/vendor/inter/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/vendor/inter/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/vendor/inter/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/vendor/inter/Inter-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- Design tokens --------------------------------------- */
:root {
  --primary:       #114486;
  --primary-dark:  #0d3366;
  --primary-light: #1a5ba8;
  --accent:        #FACA24;
  --accent-dark:   #e0b311;

  --bg:            #F5F6FA;
  --card:          #FFFFFF;
  --border:        #E5E7EB;
  --border-focus:  #114486;

  --text-1:        #1A1A2E;
  --text-2:        #6B7280;
  --text-3:        #9CA3AF;
  --text-inv:      #FFFFFF;

  --success:       #10B981;
  --success-bg:    #D1FAE5;
  --warning:       #F59E0B;
  --warning-bg:    #FEF3C7;
  --danger:        #EF4444;
  --danger-bg:     #FEE2E2;
  --info:          #3B82F6;
  --info-bg:       #DBEAFE;
  --neutral:       #6B7280;
  --neutral-bg:    #F3F4F6;

  --sidebar-w:     240px;
  --header-h:      60px;

  --radius-sm:     4px;
  --radius:        8px;
  --radius-lg:     12px;

  --shadow-sm:     0 1px 2px rgba(0,0,0,.06);
  --shadow:        0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);

  --transition:    150ms ease;
}

/* ---- Reset ----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  min-height: 100vh;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea { font: inherit; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; }

/* ---- App shell ------------------------------------------- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
#login-screen.hidden { display: none; }

#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
#app-shell.hidden { display: none; }

/* ---- Sidebar --------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.sidebar-logo img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}
.sidebar-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-inv);
  letter-spacing: .3px;
}
.sidebar-logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,.55);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
}
.nav-section { margin-bottom: 4px; }
.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 18px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--text-inv);
}
.nav-item.active {
  background: rgba(250,202,36,.15);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-user {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.10);
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-inv);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  margin-top: 2px;
}
.sidebar-user-logout {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  cursor: pointer;
  transition: color var(--transition);
}
.sidebar-user-logout:hover { color: var(--danger); }

/* ---- Main wrapper --------------------------------------- */
.main-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* Covers the content area while a route loads. Opaque, because a skeleton
   showing through the previous page's table reads as a rendering fault. */
.route-loading {
  position: absolute;
  top: var(--header-h);   /* box-sizing: border-box - the border is inside the height */
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: 24px;
  background: var(--bg);
  overflow: hidden;
}
/* THE hidden PROPERTY HAS TO WIN, GLOBALLY.
   The UA stylesheet says [hidden] { display: none }, and ANY author rule that
   sets display beats it — so an element the JavaScript hid stays on screen and
   nothing anywhere reports a problem.
   Found by clicking, 10 Sep 2026 (finding N6): .login-forgot sets
   display:inline-block, so audit E7 hiding the password-reset link behind
   PASSWORD_RESET_ENABLED did nothing. The link was offered, on the login
   screen, to somebody already locked out — which is exactly what E7 was about.
   This rule used to read .route-loading[hidden], because somebody hit the same
   thing once and fixed the one class in front of them. */
[hidden] { display: none !important; }

/* ---- Header -------------------------------------------- */
.header {
  height: var(--header-h);
  min-height: var(--header-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
/* Hidden by default and revealed by css/responsive.css below 640px, where the
   sidebar is off-canvas. Declared here so the default is stated in the same
   file as the header it sits in, rather than only as an override. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
}
.nav-toggle:hover { background: var(--bg); }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--text-1);
  content: '';
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before { position: absolute; top: -5px; }
.nav-toggle-bars::after  { position: absolute; top: 5px; }

.header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  flex: 1;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Attention feed ------------------------------------ */
.header-attention {
  position: relative;
  display: flex;
  align-items: center;
}
.attention-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
}
.attention-bell:hover { background: var(--bg); }
.attention-bell-icon {
  width: 18px;
  height: 18px;
  color: var(--text-2);
}
.attention-bell:hover .attention-bell-icon { color: var(--text-1); }
.attention-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  padding: 0 5px;
  height: 18px;
  border-radius: 9px;
  background: var(--warning);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.attention-badge-danger { background: var(--danger); }
.attention-panel {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 40;
  width: 320px;
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.attention-panel-title {
  padding: 6px 8px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.attention-empty {
  padding: 4px 8px 10px;
  font-size: 13px;
  color: var(--text-2);
}
.attention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--text-1);
  cursor: pointer;
}
.attention-item:hover { background: var(--bg); }
.attention-item-danger  { border-left-color: var(--danger); }
.attention-item-warning { border-left-color: var(--warning); }
.attention-item-info    { border-left-color: var(--primary); }
.attention-item-count {
  flex: 0 0 auto;
  min-width: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.attention-item-label { flex: 1; }

/* ---- Main content -------------------------------------- */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ---- Login screen -------------------------------------- */
.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img {
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
}
.login-logo-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .3px;
}
.login-logo-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.login-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 20px;
  text-align: center;
}
.login-forgot {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  margin-top: 6px;
  display: inline-block;
}
.login-forgot:hover { text-decoration: underline; }

/* ---- Page placeholder (for stub modules) -------------- */
.page-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-2);
  text-align: center;
  gap: 8px;
}
.page-placeholder h2 { font-size: 18px; color: var(--text-1); }
.page-placeholder p  { font-size: 13px; }
