/* =========================================================================
   PEBARA Information Management - application styles
   Mobile-first, no framework dependency. Themes via [data-theme].
   ========================================================================= */

:root {
  --accent: #b7791f;          /* Yellow (default) */
  --accent-strong: #975a16;
  --accent-soft: #fdf6e3;
  --accent-ink: #ffffff;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --text: #1f2933;
  --text-muted: #616e7c;
  --danger: #c53030;
  --danger-soft: #fdecec;
  --success: #2f855a;
  --success-soft: #e8f6ee;
  --warning: #b7791f;
  --warning-soft: #fdf6e3;
  --info: #2b6cb0;
  --info-soft: #ebf4ff;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .16);
  --topbar-h: 60px;
  --sidebar-w: 260px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

[data-theme="green"]  { --accent: #0f8a7a; --accent-strong: #0b6b5f; --accent-soft: #e6f6f3; }
[data-theme="red"]    { --accent: #d14b1f; --accent-strong: #a8391a; --accent-soft: #fdeee8; }
[data-theme="blue"]   { --accent: #1f5fc4; --accent-strong: #184b9b; --accent-soft: #e9f0fc; }
[data-theme="yellow"] { --accent: #b7791f; --accent-strong: #975a16; --accent-soft: #fdf6e3; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-strong); }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.icon { flex: none; vertical-align: middle; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 3px solid var(--accent);
  box-shadow: var(--shadow);
}
.topbar-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); cursor: pointer;
}
.topbar-toggle:hover { background: var(--surface-2); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-logo { height: 40px; width: auto; }
.brand-text { display: none; flex-direction: column; line-height: 1.15; }
.brand-text strong { display: none; }
.brand-sub { font-size: .8rem; color: var(--text-muted); border-left: 1px solid var(--border); padding-left: 12px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-date { display: none; align-items: center; gap: 6px; color: var(--text-muted); font-size: .85rem; }

.usermenu { position: relative; }
.usermenu summary {
  list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 8px 4px 4px; border-radius: 999px;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--surface-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.usermenu-name { display: none; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
}
.usermenu-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; font-size: .85rem; color: var(--text-muted); }
.usermenu-head strong { color: var(--text); font-size: .95rem; }
.usermenu-panel a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .9rem; }
.usermenu-panel a:hover { background: var(--surface-2); }

/* ---------- Shell / sidebar ---------- */
.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  position: fixed; z-index: 60; top: 0; bottom: 0; left: 0;
  width: min(86vw, var(--sidebar-w));
  background: #1f2933; color: #cbd2d9;
  overflow-y: auto; padding: 8px 10px 24px;
  transform: translateX(-100%); transition: transform .22s ease;
}
.sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 12px; color: #fff; font-weight: 600; }
.sidebar-close { border: 0; background: transparent; color: #cbd2d9; width: 36px; height: 36px; border-radius: var(--radius-sm); cursor: pointer; }
.sidebar-close:hover { background: rgba(255,255,255,.08); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .45); }
body.nav-open { overflow: hidden; }

.nav-group { margin: 2px 0; }
.nav-group summary {
  list-style: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px; border-radius: var(--radius-sm); cursor: pointer;
  color: #e4e7eb; font-weight: 600; font-size: .92rem; user-select: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary span { flex: 1; }
.nav-group summary:hover { background: rgba(255,255,255,.06); }
.nav-group summary .icon:last-child { transition: transform .2s; opacity: .7; }
.nav-group[open] summary .icon:last-child { transform: rotate(180deg); }
.nav-group ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 18px; }
.nav-group li a {
  display: block; padding: 7px 12px; margin: 1px 0; border-radius: var(--radius-sm);
  color: #cbd2d9; text-decoration: none; font-size: .88rem; border-left: 2px solid rgba(255,255,255,.08);
}
.nav-group li a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-group li a.is-active { background: var(--accent); color: #fff; border-left-color: transparent; font-weight: 600; }
.nav-signout {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px; border-top: 1px solid rgba(255,255,255,.1);
  color: #f8b4b4; text-decoration: none; font-size: .92rem; font-weight: 600;
}
.nav-signout:hover { color: #fff; }

.content { flex: 1; min-width: 0; padding: 16px; outline: none; }
.footer { margin-top: 32px; padding: 16px 0 8px; text-align: center; font-size: .8rem; color: var(--text-muted); }

@media (min-width: 600px) {
  .brand-text { display: flex; }
  .usermenu-name { display: inline; }
}
@media (min-width: 768px) {
  .content { padding: 24px; }
  .topbar-date { display: inline-flex; }
}
@media (min-width: 992px) {
  .topbar-toggle, .sidebar-head, .sidebar-backdrop { display: none !important; }
  .sidebar {
    position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
    transform: none; flex: none; width: var(--sidebar-w); padding-top: 14px;
  }
  body.nav-open { overflow: auto; }
}

/* ---------- Menu layout toggle (side accordion <-> top bar) ---------- */
.menu-style-toggle {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
}
.menu-style-toggle:hover { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
.ms-icon { display: inline-flex; }
.menu-side .ms-icon-side, .menu-top .ms-icon-top { display: none; } /* icon shows the layout you'll switch to */

@media (min-width: 992px) {
  .menu-style-toggle { display: inline-flex; }

  /* Top menu: the nav becomes a horizontal bar under the top bar */
  .menu-top .shell { display: block; }
  .menu-top .sidebar {
    position: sticky; top: var(--topbar-h); z-index: 35;
    width: auto; height: auto; overflow: visible;
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
    padding: 6px 16px; transform: none;
    box-shadow: var(--shadow);
  }
  .menu-top .nav-group { position: relative; margin: 0; }
  .menu-top .nav-group summary { padding: 8px 12px; gap: 8px; border-bottom: 2px solid transparent; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
  .menu-top .nav-group.has-active > summary { color: #fff; border-bottom-color: var(--accent); }
  .menu-top .nav-group[open] > summary { background: rgba(255,255,255,.08); }
  .menu-top .nav-group ul {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
    min-width: 250px; max-height: 70vh; overflow-y: auto;
    margin: 0; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
  }
  .menu-top .nav-group li a { color: var(--text); border-left: 0; white-space: nowrap; }
  .menu-top .nav-group li a:hover { background: var(--surface-2); color: var(--text); }
  .menu-top .nav-group li a.is-active { background: var(--accent); color: #fff; }
  .menu-top .nav-signout { margin: 0 0 0 auto; padding: 8px 12px; border-top: 0; }
  .menu-top .content { max-width: 1400px; margin: 0 auto; }
}

/* ---------- Page heading ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-sub { margin: 4px 0 0; color: var(--text-muted); font-size: .9rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb { font-size: .85rem; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-body { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 1rem; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
@media (min-width: 768px) { .card-body { padding: 20px 24px; } .card-head, .card-foot { padding-left: 24px; padding-right: 24px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #9b2c2c; border-color: #9b2c2c; color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #276749; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-light { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  color: var(--text-muted); border: 1px solid var(--border); background: var(--surface); text-decoration: none;
}
.btn-icon:hover { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
.btn-icon-danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.row-actions { display: inline-flex; gap: 6px; }

/* ---------- Forms ---------- */
.input, .form input[type=text], .form input[type=email], .form input[type=tel], .form input[type=number],
.form input[type=password], .form input[type=date], .form input[type=datetime-local], .form input[type=month],
.form input[type=search], .form input[type=file], .form select, .form textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  font: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.form input[type=file] { padding: 6px 8px; }
.form textarea { min-height: 110px; resize: vertical; }
.input:focus, .form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.form input[readonly], .form textarea[readonly], .form select[disabled], .input[readonly] { background: var(--surface-2); color: var(--text-muted); }
.uppercase { text-transform: uppercase; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px 20px; }
@media (min-width: 720px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span-2, .form-grid .field-full { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
  .form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .field-label { font-size: .85rem; font-weight: 600; color: var(--text); }
.field > label.check { font-weight: 400; font-size: .92rem; }
.field .req::after, .field label.req::after { content: " *"; color: var(--danger); }
.hint { color: var(--text-muted); font-size: .8rem; }
.form-section { margin: 8px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); grid-column: 1 / -1; font-size: .95rem; color: var(--accent-strong); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.form-actions .btn { min-width: 110px; }
@media (max-width: 479px) { .form-actions .btn { flex: 1 1 auto; } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* select2 polish */
.select2-container { width: 100% !important; }
.select2-container .select2-selection--single { height: 40px; border-color: var(--border-strong); border-radius: var(--radius-sm); }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 38px; padding-left: 12px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }

/* ---------- Toolbar (search) ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .input { min-height: 40px; }
.toolbar-by { width: auto; min-width: 140px; flex: 0 0 auto; }
.toolbar-search { position: relative; flex: 1 1 220px; min-width: 0; }
.toolbar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.toolbar-search .input { padding-left: 34px; width: 100%; }
@media (max-width: 479px) {
  .toolbar-by { flex: 1 1 100%; }
  .toolbar .btn { flex: 1 1 auto; }
}

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table thead th {
  position: sticky; top: 0; background: var(--surface-2); color: var(--text-muted);
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.table tbody tr:hover { background: var(--accent-soft); }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; width: 1%; }
.table .num { text-align: right; }
.table tfoot td, .table tfoot th { font-weight: 700; background: var(--surface-2); }
.table tbody tr.is-selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.img-preview { display: block; max-width: 100%; max-height: 360px; width: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.pdf-frame { display: block; width: 100%; height: 70vh; min-height: 360px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.table tr.empty td { text-align: center; color: var(--text-muted); padding: 32px 12px; }
.table-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-muted); }

/* Stacked "card" rows on phones. Add class .table-stack and data-label on each <td>. */
@media (max-width: 719px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tbody tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:hover { background: transparent; }
  .table-stack td { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-weight: 600; color: var(--text-muted); font-size: .8rem; }
  .table-stack td:not([data-label])::before, .table-stack td[data-label=""]::before { content: none; }
  .table-stack td.actions { justify-content: flex-end; width: 100%; padding-top: 8px; }
  .table-stack td.num { text-align: right; }
  .table-stack tr.empty td { display: block; text-align: center; }
  .table-stack tfoot { display: block; }
  .table-stack tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 10px 14px; }
  .table-stack tfoot td, .table-stack tfoot th { display: block; width: auto; border: 0; padding: 2px 0; }
  .table-stack tfoot td::before { margin-right: 6px; }
}

/* ---------- Pager ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: .85rem;
}
a.pager-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.pager-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pager-btn.is-disabled { opacity: .45; }
.pager-info { margin-left: 8px; color: var(--text-muted); font-size: .85rem; }

/* ---------- Alerts / badges ---------- */
.alert {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: .92rem;
}
.alert-success { background: var(--success-soft); border-color: #b7e2c7; color: #22543d; }
.alert-danger  { background: var(--danger-soft);  border-color: #f5c2c2; color: #742a2a; }
.alert-warning { background: var(--warning-soft); border-color: #f1d9a6; color: #744210; }
.alert-info    { background: var(--info-soft);    border-color: #bcd6f5; color: #2a4365; }
.alert-close { border: 0; background: transparent; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.alert-close:hover { opacity: 1; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: #b7e2c7; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: #f5c2c2; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: #f1d9a6; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: #bcd6f5; }

.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mb-4 { margin-bottom: 16px; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 16px; margin: 0; font-size: .92rem; }
.dl dt { color: var(--text-muted); font-weight: 600; }
.dl dd { margin: 0; word-break: break-word; }

.confirm-box { border-left: 4px solid var(--danger); background: var(--danger-soft); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; color: #742a2a; }

/* ---------- Dashboard ---------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; text-decoration: none; color: var(--text); border-top: 3px solid var(--accent); }
.tile:hover { color: var(--text); box-shadow: var(--shadow-lg); }
.tile-label { color: var(--text-muted); font-size: .85rem; font-weight: 600; }
.tile-value { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.section-label { color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; margin: 4px 0 8px; }

/* ---------- News feed ---------- */
.feed { display: grid; gap: 20px; max-width: 980px; margin: 0 auto; }
.feed-item { overflow: hidden; }
.feed-item img { display: block; width: 100%; height: auto; }
.feed-item .pdf-frame { display: block; width: 100%; height: 75vh; min-height: 420px; border: 0; background: var(--surface-2); }
/* Fit-to-width PDF (assets/pdfview.js) */
.pdf-view { background: #e9ecef; padding: 8px; }
.pdf-status { padding: 4px 4px 8px; font-size: .8rem; color: var(--text-muted); }
.pdf-pages { width: 100%; }
.pdf-page { display: block; width: 100%; height: auto; margin: 0 auto 8px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.pdf-page:last-child { margin-bottom: 0; }
.pdf-view.is-fallback { padding: 0; background: transparent; }
@media (min-width: 768px) {
  /* Desktop: keep long documents in a scroll box so the feed stays readable */
  .pdf-view:not(.is-fallback) .pdf-pages { max-height: 80vh; overflow-y: auto; }
}
.feed-meta {display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.feed-meta h2 { margin: 0; font-size: 1rem; }

/* ---------- Login ---------- */
.is-bare { background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg) 55%); min-height: 100vh; }
.bare-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.bare-main > .alert { width: 100%; max-width: 420px; }
.auth-card { width: 100%; max-width: 420px; }
/* News & Events banner above the sign-in card */
.auth-news {
  display: flex; align-items: center; gap: 14px;
  width: 100%; max-width: 420px; margin-bottom: 16px; padding: 14px 16px;
  text-decoration: none; color: var(--text);
  border: 1px solid var(--accent); border-left: 5px solid var(--accent);
  background: var(--accent-soft);
  transition: box-shadow .15s, transform .15s;
}
.auth-news:hover, .auth-news:focus-visible { color: var(--text); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.auth-news-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
}
.auth-news-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.auth-news-title { font-size: 1.05rem; font-weight: 800; color: var(--accent-strong); }
.auth-news-latest { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.auth-news-go { flex: none; font-size: 1.8rem; line-height: 1; color: var(--accent-strong); }
.auth-card .card-body { padding: 28px 24px; }
.auth-logo { display: block; margin: 0 auto 14px; max-height: 70px; width: auto; }
.auth-title { text-align: center; font-size: 1.15rem; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: .9rem; margin: 0 0 22px; }
.auth-foot { margin-top: 18px; font-size: .8rem; color: var(--text-muted); text-align: center; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent-strong); font-weight: 600; font-size: .8rem; cursor: pointer; padding: 6px 8px; }

/* ---------- Theme picker ---------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.swatch { position: relative; display: block; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 2px solid var(--border); border-radius: var(--radius); font-weight: 600; }
.swatch span::before { content: ""; height: 44px; border-radius: var(--radius-sm); background: var(--sw); }
.swatch input:checked + span { border-color: var(--sw); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw) 25%, transparent); }
.swatch input:focus-visible + span { outline: 3px solid var(--sw); outline-offset: 2px; }
.layout-swatch span::before { content: none; }
.layout-swatch .icon { color: var(--accent); }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* ---------- Print ---------- */
@media print {
  .topbar, .sidebar, .sidebar-backdrop, .toolbar, .page-actions, .pager, .footer, .actions, .no-print, .alert { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
}
