/* Qalqon Tools admin — cool limestone + forest accent */
:root {
  --bg: #dfe6ea;
  --bg-deep: #cfd8de;
  --surface: #f7f9fa;
  --surface-2: #eef3f5;
  --ink: #14202b;
  --muted: #5a6b78;
  --faint: #8a9aa6;
  --line: #c5d0d8;
  --line-strong: #9aadb8;
  --accent: #1a5f4a;
  --accent-hover: #144a3a;
  --accent-soft: rgba(26, 95, 74, 0.12);
  --accent-glow: rgba(26, 95, 74, 0.22);
  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.1);
  --ok: #1a5f4a;
  --shadow: 0 1px 0 rgba(20, 32, 43, 0.04), 0 12px 40px rgba(20, 32, 43, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --display: "Libre Baskerville", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 248px;
  --topbar-h: 64px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  position: relative;
}

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(26, 95, 74, 0.14), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(30, 80, 110, 0.1), transparent 50%),
    linear-gradient(165deg, var(--bg) 0%, var(--bg-deep) 100%);
}
.bg-mesh::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(20, 32, 43, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 43, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 88%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* —— App shell + sidebar —— */
.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.sidebar-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.header-clock {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
  max-width: 9.5rem;
}
body.is-app .header-clock {
  color: var(--ink);
}
body.is-auth .header-clock {
  font-size: 0.78rem;
  max-width: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background:
    linear-gradient(145deg, var(--accent) 0%, #2a7a62 45%, #0e3d32 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 10px 8px 10px 8px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  border-top-width: 5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sidebar-toggle-bars,
.sidebar-toggle-bars::before,
.sidebar-toggle-bars::after {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  position: relative;
}
.sidebar-toggle-bars::before,
.sidebar-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.sidebar-toggle-bars::before { top: -5px; }
.sidebar-toggle-bars::after { top: 5px; }

.sidebar-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 12px 10px 14px;
  overflow-y: auto;
}

.sidebar-nav,
.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-label {
  margin: 12px 8px 4px;
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.sidebar-subnav {
  margin-top: 10px;
  padding: 8px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.sidebar-subnav .nav-link {
  padding-left: 12px;
  font-size: 0.84rem;
}

.sidebar-spacer {
  flex: 1;
  min-height: 16px;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.nav-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
  text-align: left;
  width: 100%;
}
a.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.nav-link:hover { color: var(--ink); background: rgba(255, 255, 255, 0.7); }
.nav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.hidden,
.main-nav .nav-link.hidden {
  display: none !important;
}
.nav-link--profile {
  font-weight: 600;
}

.nav-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
.nav-ico--home {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 10.5 12 4l8 6.5V20a1 1 0 0 1-1 1h-5v-6H10v6H5a1 1 0 0 1-1-1v-9.5z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 10.5 12 4l8 6.5V20a1 1 0 0 1-1 1h-5v-6H10v6H5a1 1 0 0 1-1-1v-9.5z'/%3E%3C/svg%3E");
}
.nav-ico--video {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='6' width='13' height='12' rx='2'/%3E%3Cpath d='M16 10l5-3v10l-5-3v-4z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='6' width='13' height='12' rx='2'/%3E%3Cpath d='M16 10l5-3v10l-5-3v-4z'/%3E%3C/svg%3E");
}
.nav-ico--pdf {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E");
}
.nav-ico--users {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3 19c0-3 2.5-5 6-5s6 2 6 5'/%3E%3Ccircle cx='17' cy='9' r='2.5'/%3E%3Cpath d='M21 19c0-2.2-1.5-3.8-3.8-4.5'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3 19c0-3 2.5-5 6-5s6 2 6 5'/%3E%3Ccircle cx='17' cy='9' r='2.5'/%3E%3Cpath d='M21 19c0-2.2-1.5-3.8-3.8-4.5'/%3E%3C/svg%3E");
}
.nav-ico--profile {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='3.5'/%3E%3Cpath d='M5 20c0-3.5 3-6 7-6s7 2.5 7 6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='3.5'/%3E%3Cpath d='M5 20c0-3.5 3-6 7-6s7 2.5 7 6'/%3E%3C/svg%3E");
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 4px;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), var(--line));
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.user-name {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-backdrop {
  display: none;
}

/* —— Layout content —— */
.container {
  flex: 1;
  min-width: 0;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 28px 32px 64px;
}
body.is-app .container > .page {
  max-width: 1040px;
}

body.is-auth .app-shell {
  display: block;
}
body.is-auth .sidebar {
  position: relative;
  width: 100%;
  height: auto;
  border-right: none;
  border-bottom: 1px solid var(--line);
}
body.is-auth .sidebar-body { display: none !important; }
body.is-auth .sidebar-toggle { display: none !important; }
body.is-auth .container {
  width: min(980px, 100% - 32px);
  margin: 0 auto;
  padding: 48px 0 64px;
}
body.is-auth .sidebar-top {
  justify-content: center;
  border-bottom: none;
  padding: 18px 16px 8px;
}

body.is-app .app-shell {
  display: flex;
}

.page {
  animation: rise 0.38s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-actions,
.upload-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

/* —— Auth —— */
.auth-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: stretch;
  max-width: 860px;
  margin: 0 auto;
  animation: rise 0.45s var(--ease) both;
}
@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; gap: 20px; }
}

.auth-intro {
  padding: 12px 8px 12px 4px;
}
.eyebrow {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.auth-intro h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.lede {
  margin: 14px 0 0;
  color: var(--muted);
  max-width: 34ch;
  font-size: 0.98rem;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 26px;
  box-shadow: var(--shadow);
}
.auth-panel-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* —— Tools hub —— */
.hub-head { margin-bottom: 8px; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.tool-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  text-decoration: none;
  color: inherit;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  box-shadow: var(--shadow);
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s;
  animation: rise 0.4s var(--ease) both;
}
.tool-card:nth-child(1) { animation-delay: 0.02s; }
.tool-card:nth-child(2) { animation-delay: 0.06s; }
.tool-card:nth-child(3) { animation-delay: 0.1s; }
.tool-card:nth-child(4) { animation-delay: 0.14s; }
.tool-card:nth-child(5) { animation-delay: 0.18s; }

.tool-card--ready:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(20, 32, 43, 0.08);
}
.tool-card--ready:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tool-card--soon {
  cursor: not-allowed;
  opacity: 0.72;
  background: color-mix(in srgb, var(--surface) 80%, var(--surface-2));
}
.tool-card--soon:hover { transform: none; box-shadow: var(--shadow); }

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
}
.tool-icon--video {
  background: linear-gradient(145deg, #1a5f4a, #0e3d32);
}
.tool-icon--video::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent #fff;
  transform: translateX(2px);
}
.tool-icon--pdf {
  background: linear-gradient(145deg, #8b2942, #5c1a2a);
}
.tool-icon--pdf::after {
  content: "P";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}
.tool-icon--image {
  background: linear-gradient(145deg, #2a5f8a, #1a3d5c);
}
.tool-icon--image::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 11px; height: 12px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 2px;
  border-top: none;
  box-shadow: 6px -6px 0 -1px rgba(255,255,255,.75);
}
.tool-icon--word {
  background: linear-gradient(145deg, #2b579a, #1a3a6b);
}
.tool-icon--word::after {
  content: "W";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}
.tool-icon--excel {
  background: linear-gradient(145deg, #217346, #14522f);
}
.tool-icon--excel::after {
  content: "X";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}
.tool-icon--profile {
  background: linear-gradient(145deg, #3d5a6c, #1e3340);
}
.tool-icon--profile::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  box-shadow: 0 14px 0 -2px rgba(255,255,255,.85), 0 14px 0 4px transparent;
}
.tool-icon--profile::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 22px;
  height: 10px;
  margin-left: -11px;
  border-radius: 11px 11px 4px 4px;
  background: rgba(255,255,255,.85);
}
.tool-icon--users {
  background: linear-gradient(145deg, #5c4a1e, #3a2e12);
}
.tool-icon--users::after {
  content: "U";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.profile-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 760px) {
  .profile-layout { grid-template-columns: 1fr; }
}

.section-title {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.input-readonly {
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  cursor: default;
}

.select-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.role-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.role-pill--super_admin { background: rgba(92, 74, 30, 0.15); color: #5c4a1e; }
.role-pill--admin { background: var(--accent-soft); color: var(--accent); }
.role-pill--officer { background: var(--surface-2); color: var(--muted); }

.tools-fieldset {
  border: 1px solid var(--line, #d0d7de);
  border-radius: 8px;
  padding: 12px 14px 14px;
  margin: 0;
}
.tools-fieldset legend {
  padding: 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.tools-hint { margin: 0 0 10px; font-size: 0.82rem; }
.tool-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 0.92rem;
  cursor: pointer;
}
.tool-check--blocked {
  opacity: 0.55;
  cursor: not-allowed;
}
.tool-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent-soft, rgba(26, 95, 74, 0.12));
  color: var(--accent, #1a5f4a);
  margin: 0 3px 3px 0;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
}
.status-pill--ok { color: var(--ok); }
.status-pill--locked { color: var(--danger); }

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.link-row input {
  min-width: 200px;
}

.tool-body { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.tool-name {
  font-weight: 650;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.tool-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}
.tool-status {
  margin-top: auto;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
}
.status-live {
  color: var(--accent);
  background: var(--accent-soft);
}
.status-soon {
  color: var(--faint);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.tool-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.crumb-link {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.crumb-link:hover { text-decoration: underline; }
.crumb-sep { color: var(--faint); }

@media (max-width: 640px) {
  .tools-grid { grid-template-columns: 1fr; }
}

/* —— Forms —— */
.form { display: flex; flex-direction: column; gap: 16px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--muted);
}
.field input,
input.search-input,
.form input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder { color: var(--faint); }
.field input:hover,
input.search-input:hover { border-color: var(--line-strong); }
.field input:focus,
input.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: min(260px, 100%);
}
.search-icon {
  position: absolute;
  left: 11px;
  color: var(--faint);
  pointer-events: none;
}
.search-input {
  padding-left: 36px !important;
  background: var(--surface) !important;
}

/* —— Buttons —— */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s, opacity 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-sm { padding: 7px 12px; font-size: 0.8125rem; }
.btn-block { width: 100%; padding: 12px 16px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.msg {
  margin: 14px 0 0;
  min-height: 1.25em;
  font-size: 0.875rem;
}
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

.meta { color: var(--muted); font-size: 0.875rem; }
.ip-addr {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8em;
  color: var(--accent);
}

/* —— Empty / loading —— */
.empty-state,
.loading-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  margin-bottom: 6px;
}
.loading-state {
  border-style: solid;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* —— Reports list —— */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
}
.report-item:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.report-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.report-item .title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.report-item .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
.report-item .meta a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.report-item .meta a:hover { text-decoration: underline; }
.officer-tag { font-weight: 600; color: var(--ink); }

.badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

/* —— Detail —— */
.back-btn { margin-bottom: 12px; }

.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 22px 24px;
  box-shadow: var(--shadow);
  animation: rise 0.35s var(--ease) both;
}
.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.detail-head h2 {
  margin: 0;
  flex: 1 1 200px;
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.detail-badge {
  background: var(--accent);
  color: #fff;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 16px;
  font-size: 0.9rem;
  margin: 0 0 20px;
}
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; }
.kv a { color: var(--accent); font-weight: 500; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.media-grid > img,
.media-grid > video {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #0f1418;
  transition: transform 0.2s var(--ease);
}
.media-grid > img:hover { transform: scale(1.02); }

/* Media library cards */
.media-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s var(--ease);
}
.media-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.media-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.media-preview {
  position: relative;
  aspect-ratio: 16/10;
  background: #12181d;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.media-preview img,
.media-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
}
.media-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: flex;
  background: rgba(15, 20, 24, 0.55);
  border-radius: 4px;
  padding: 5px;
  backdrop-filter: blur(4px);
}
.media-select-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
}
.media-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  line-height: 1;
  border: none;
  border-radius: 6px;
  background: rgba(15, 20, 24, 0.55);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.15s;
}
.media-delete-btn:hover { background: var(--danger); }
.media-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--line);
}
.media-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-date {
  font-size: 0.72rem;
  color: var(--muted);
}

/* —— Audit table —— */
.table-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.audit-table th,
.audit-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.audit-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
}
.audit-table tbody tr {
  transition: background 0.12s;
}
.audit-table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.audit-table tr:last-child td { border-bottom: none; }
.audit-table .badge {
  display: inline-block;
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.hidden { display: none !important; }

/* —— Mobile —— */
@media (max-width: 900px) {
  body.is-app .app-shell {
    flex-direction: column;
  }
  body.is-app .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    max-height: 100vh;
    border-right: none;
    border-bottom: 1px solid var(--line);
    z-index: 50;
  }
  body.is-app .sidebar-toggle {
    display: inline-flex;
  }
  body.is-app .sidebar-body {
    display: none;
    padding-bottom: 18px;
    overflow-y: auto;
    max-height: calc(100vh - 64px);
  }
  body.is-app.sidebar-open .sidebar-body {
    display: flex;
  }
  body.is-app .sidebar-backdrop {
    display: none !important;
  }
  body.is-app .container {
    padding: 20px 16px 48px;
  }
  body.is-app .sidebar-foot {
    margin-top: 4px;
  }
}

@media (max-width: 640px) {
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .auth-panel { padding: 22px 18px; }
  .page-head { align-items: stretch; }
  .header-actions, .upload-container { width: 100%; }
  .search-wrap { min-width: 100%; flex: 1; }
  body.is-auth .container { width: min(100% - 24px, 980px); padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
