@font-face {
  font-family: "Noto Sans Thai Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/noto-sans-thai-thai-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}

@font-face {
  font-family: "Noto Sans Thai Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/noto-sans-thai-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --p4-navy-950: #07182e;
  --p4-navy-900: #0b1f3a;
  --p4-navy-800: #102b4f;
  --p4-blue-700: #1556b0;
  --p4-blue-600: #1e6bd6;
  --p4-blue-500: #3685ee;
  --p4-cyan-400: #55c7e8;
  --p4-gold-400: #f1c56f;
  --p4-bg: #f3f6fb;
  --p4-surface: #ffffff;
  --p4-border: #e2e8f2;
  --p4-text: #17243a;
  --p4-muted: #6d7b91;
  --p4-success: #15815a;
  --p4-danger: #c83845;
  --p4-radius: 18px;
  --p4-shadow: 0 16px 42px rgba(24, 46, 82, .08);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--p4-text);
  background:
    radial-gradient(circle at 8% 0%, rgba(54, 133, 238, .08), transparent 28rem),
    var(--p4-bg);
  font-family: "Sarabun", "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

a { color: var(--p4-blue-700); text-decoration: none; }
a:hover { color: var(--p4-blue-600); }

h1, h2, h3 { color: #13223a; font-weight: 800; letter-spacing: -.015em; }
h1 { font-size: clamp(30px, 4vw, 48px); }
h2 { font-size: clamp(23px, 2.4vw, 31px); }
h3 { font-size: 18px; }

/* Bootstrap navbar shell */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 74px;
  padding: 10px 0;
  background: linear-gradient(108deg, var(--p4-navy-950), var(--p4-navy-800) 62%, #113864);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 10px 35px rgba(7, 24, 46, .16);
}

.app-nav-container { max-width: 1480px; padding-inline: 24px; }
.app-brand { display: flex; align-items: center; gap: 11px; margin-right: 28px; color: #fff !important; }
.app-brand-badge {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, rgba(54, 133, 238, .92), rgba(85, 199, 232, .7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 8px 22px rgba(0, 0, 0, .18);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .04em;
}
.app-brand strong, .app-brand small { display: block; line-height: 1.15; }
.app-brand strong { font-size: 16px; }
.app-brand small { margin-top: 4px; color: #9db5d4; font-size: 11px; font-weight: 600; letter-spacing: .03em; }

.app-nav-links { gap: 4px; }
.app-nav-links .nav-link {
  position: relative;
  padding: 9px 11px !important;
  border-radius: 10px;
  color: #c7d5e8;
  font-weight: 650;
  white-space: nowrap;
}
.app-nav-links .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.app-nav-links .nav-link.active { color: #fff; background: rgba(80, 151, 241, .18); }
.app-nav-links .nav-link.active::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 3px;
  left: 12px;
  height: 2px;
  border-radius: 4px;
  background: var(--p4-cyan-400);
}

.app-user-menu { margin-left: 14px; }
.user-menu-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 6px 6px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 13px;
  color: #fff !important;
  background: rgba(255, 255, 255, .07);
}
.user-menu-button:hover, .user-menu-button.show { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); }
.user-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--p4-navy-950);
  background: linear-gradient(145deg, #fff, #d9e9ff);
  font-weight: 900;
}
.user-copy { text-align: left; }
.user-copy strong, .user-copy small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; white-space: nowrap; }
.user-copy strong { font-size: 12px; }
.user-copy small { margin-top: 3px; color: #9db5d4; font-size: 9px; letter-spacing: .08em; }
.app-dropdown { padding: 8px; border: 1px solid var(--p4-border); border-radius: 13px; box-shadow: var(--p4-shadow); }
.app-dropdown .dropdown-item { padding: 8px 10px; border-radius: 8px; font-size: 14px; }

/* Main layouts */
.container { width: min(100% - 32px, 1380px); max-width: 1380px; margin: 30px auto; padding: 0; }
.narrow { width: min(100% - 32px, 520px); margin: 72px auto 48px; }

.hero, .panel, .card {
  border: 1px solid var(--p4-border);
  border-radius: var(--p4-radius);
  background: var(--p4-surface);
  box-shadow: var(--p4-shadow);
}
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(28px, 5vw, 54px);
  margin-bottom: 20px;
  color: #d9e7f8;
  border: 0;
  background: linear-gradient(122deg, var(--p4-navy-950), #123c6a 72%, #1769b9);
}
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 360px;
  height: 360px;
  right: -80px;
  top: -170px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255, 255, 255, .035), 0 0 0 92px rgba(255, 255, 255, .025);
}
.hero h1 { margin: 7px 0 9px; color: #fff; }
.hero p { max-width: 680px; margin: 0; color: #c8d8ec; font-size: 16px; }
.hero .eyebrow { color: #78d5ee; }

.panel { padding: clamp(20px, 3vw, 28px); }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 17px; }
.card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 22px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--p4-blue-600), var(--p4-cyan-400));
}
.card:hover { transform: translateY(-2px); border-color: #d3deed; box-shadow: 0 20px 44px rgba(24, 46, 82, .11); }
.card h3 { margin: 1px 0 8px; }
.card p:last-child { margin-bottom: 0; }

.stat {
  margin-top: 7px;
  color: var(--p4-navy-800);
  font-size: clamp(36px, 5vw, 50px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.04em;
}
.grid > .card:nth-child(2) .stat { color: #1769b9; }
.grid > .card:nth-child(3) .stat { color: #b36d08; }
.grid > .card:nth-child(4) .stat { color: var(--p4-success); }

.eyebrow { display: inline-block; margin-bottom: 6px; color: var(--p4-blue-600); font-size: 11px; font-weight: 900; letter-spacing: .13em; }
.muted { color: var(--p4-muted); font-size: 13px; }
.right { text-align: right; }

/* Forms */
label, .form-label { display: block; margin: 13px 0 6px; color: #334157; font-weight: 750; font-size: 13px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea, .form-control, .form-select {
  width: 100%;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid #ccd6e4;
  border-radius: 10px;
  color: var(--p4-text);
  background-color: #fff;
  font: inherit;
  font-size: 14px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, .form-control:focus, .form-select:focus {
  border-color: #6ca4ee;
  outline: 0;
  box-shadow: 0 0 0 4px rgba(30, 107, 214, .11);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--p4-blue-600); }
.form-grid, .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 17px; }
.filters { grid-template-columns: repeat(4, minmax(145px, 1fr)); align-items: end; }
.filters .actions { align-self: end; }

/* Buttons */
.btn {
  min-height: 39px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  font-size: 13px;
  line-height: 1.45;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #fff; border-color: #1b61bd; background: linear-gradient(135deg, var(--p4-blue-700), var(--p4-blue-500)); box-shadow: 0 7px 17px rgba(30, 107, 214, .2); }
.btn.primary:hover { color: #fff; background: linear-gradient(135deg, #104b9a, #2878df); box-shadow: 0 9px 21px rgba(30, 107, 214, .26); }
.btn.secondary { color: #31435d; border-color: #d9e1ec; background: #f3f6fa; }
.btn.secondary:hover { color: #18304f; background: #e9eef5; }
.btn.danger { color: #a62633; border-color: #f3ccd0; background: #fff0f1; }
.btn.danger:hover { color: #8f1f2a; background: #ffe3e6; }
.btn.tiny { min-height: 30px; padding: 5px 9px; border-radius: 8px; font-size: 11px; }
.btn.full { width: 100%; margin-top: 12px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0; }

/* Tables */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--p4-border);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(24, 46, 82, .055);
}
table { width: 100%; min-width: 860px; margin: 0; border-collapse: separate; border-spacing: 0; }
th, td { padding: 13px 12px; border-bottom: 1px solid #edf1f6; text-align: left; vertical-align: middle; }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #596980;
  background: #f7f9fc;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .02em;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover { background: #f9fbfe; }
td strong { color: #1c2d47; }
td .btn { white-space: nowrap; }

/* Responsible people CRUD */
.people-editor { margin-bottom: 18px; }
.people-table-wrap { margin-top: 16px; }
.people-table { min-width: 820px; }
.people-table th:first-child, .people-table td:first-child { width: 56px; text-align: center; }
.people-table th:last-child, .people-table td:last-child { width: 170px; }
.people-row-actions { display: flex; align-items: center; gap: 8px; }
.people-row-actions form { margin: 0; }
.people-active-check { display: flex; flex-direction: column; gap: 10px; }
.people-active-check > span:last-child { display: flex; align-items: center; gap: 9px; min-height: 48px; }
.people-form-actions { margin-bottom: 0; }
.people-safety-note { margin: 12px 2px 0; }

/* States and notices */
.alert {
  padding: 13px 16px;
  margin: 12px 0;
  border: 1px solid #ccebdc;
  border-radius: 11px;
  color: #146444;
  background: #ecf9f3;
  box-shadow: none;
}
.alert.error { color: #a02633; border-color: #f1cfd2; background: #fff1f2; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 5px 10px;
  border: 1px solid #cfe0fb;
  border-radius: 999px;
  color: #1a559f;
  background: #edf5ff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}
.badge.done, .done { color: #146a4a; border-color: #c9eadb; background: #eaf8f2; }
.ocr { margin: 14px 0; padding: 13px 15px; border: 1px dashed #9ab7dc; border-radius: 11px; color: #4e6581; background: #f5f9ff; }

/* Login, first setup and connection error */
.auth-page {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 15%, rgba(70, 147, 242, .18), transparent 29rem),
    radial-gradient(circle at 88% 80%, rgba(85, 199, 232, .12), transparent 26rem),
    linear-gradient(145deg, #edf3fa, #f8fafc 60%, #eaf0f7);
}
.auth-page .narrow { flex: 1; display: flex; align-items: center; }
.auth-page .panel { width: 100%; position: relative; overflow: hidden; padding: 34px; border-radius: 22px; }
.auth-page .panel::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 4px; background: linear-gradient(90deg, var(--p4-blue-700), var(--p4-cyan-400)); }
.login { text-align: center; }
.login form { margin-top: 22px; text-align: left; }
.login h2 { margin: 14px 0 4px; font-size: 22px; }
.brandmark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(145deg, var(--p4-navy-900), var(--p4-blue-600));
  box-shadow: 0 13px 28px rgba(19, 67, 123, .22);
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .05em;
}

.setup-page { padding: 48px 20px; background: linear-gradient(145deg, #edf3fa, #f8fafc); }
.setup-box { max-width: 820px; margin: 5vh auto; padding: 34px; border: 1px solid var(--p4-border); border-radius: 22px; background: #fff; box-shadow: var(--p4-shadow); }
.setup-box .brandmark { margin-left: 0; }
.setup-box code { padding: 3px 7px; border-radius: 6px; color: #31527d; background: #eef4ff; }

.app-footer {
  width: min(100% - 32px, 1380px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 46px auto 20px;
  padding-top: 16px;
  border-top: 1px solid #dfe6ef;
  color: #8794a6;
  font-size: 10px;
  letter-spacing: .08em;
}
.app-footer strong { color: #6f7e92; }

@keyframes p4-rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.js-ready main { animation: p4-rise .22s ease-out both; }

@media (max-width: 1199.98px) {
  .app-navbar { padding: 9px 0; }
  .app-navbar .navbar-collapse { padding: 12px 0 4px; }
  .app-nav-links { padding: 8px 0; }
  .app-user-menu { margin: 4px 0 0; }
  .user-menu-button { width: 100%; }
  .user-copy { margin-right: auto; }
  .app-nav-links .nav-link.active::after { display: none; }
}

@media (max-width: 900px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  body { font-size: 14px; }
  .app-nav-container { padding-inline: 14px; }
  .container { width: min(100% - 22px, 1380px); margin-top: 20px; }
  .narrow { width: min(100% - 22px, 520px); margin-top: 34px; }
  .hero { padding: 28px 23px; border-radius: 16px; }
  .panel, .card { border-radius: 15px; }
  .panel { padding: 19px; }
  .form-grid, .filters { grid-template-columns: 1fr; gap: 0; }
  .actions { align-items: stretch; }
  .actions > .btn { text-align: center; }
  .app-footer { width: min(100% - 22px, 1380px); flex-direction: column; }
  .auth-page .panel { padding: 27px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .app-navbar, .app-footer, .actions .btn { display: none !important; }
  body { background: #fff; }
  .container { width: 100%; max-width: none; margin: 0; }
  .panel, .card, .table-wrap { box-shadow: none; }
}

/* =========================================================
   V13 · Workflow, Notification, Backup and Safe LED
   ========================================================= */
.heading-grow { margin-right: auto; }
.sidebar-count,
.topbar-notification b {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.sidebar-count { margin-left: auto; }
.topbar-notification {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #0f2747;
  background: #fff;
}
.topbar-notification .ui-icon { width: 22px; height: 22px; }
.topbar-notification b { position: absolute; top: -8px; right: -8px; }
.badge.pending { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.badge.assigned { background: #dbeafe; color: #1e40af; border-color: #60a5fa; }
.badge.progress { background: #ffedd5; color: #9a3412; border-color: #fb923c; }
.badge.review { background: #ede9fe; color: #5b21b6; border-color: #a78bfa; }
.badge.done { background: #dcfce7; color: #166534; border-color: #4ade80; }
.badge.cancelled { background: #e2e8f0; color: #475569; border-color: #94a3b8; }
.notification-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}
.notification-strip a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 14px 18px;
  border: 1px solid #cbd5e1;
  border-left: 5px solid #2563eb;
  border-radius: 12px;
  background: #fff;
  color: #1e293b;
  text-decoration: none;
}
.notification-strip a:hover { border-color: #2563eb; transform: translateY(-1px); }
.notification-strip a.danger { border-left-color: #dc2626; }
.notification-strip span { font-weight: 700; }
.notification-strip strong { font-size: 27px; color: #0f2747; }
.led-button { color: #fff !important; background: #111827 !important; border-color: #111827 !important; }
.registry-count { color: #475569; margin: 14px 0; }
.auto-number-option,
.restore-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 12px 0 18px;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 700;
}
.auto-number-option input,
.restore-check input { width: 20px; height: 20px; margin: 0; }
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
  color: #475569;
}
.pagination-bar > div { display: flex; align-items: center; gap: 7px; }
.page-number {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1e293b;
  text-decoration: none;
  font-weight: 700;
}
.page-number.active { color: #fff; background: #173b67; border-color: #173b67; }
.detail-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.detail-summary-grid article {
  min-height: 150px;
  padding: 20px;
  border: 1px solid #cbd5e1;
  border-top: 4px solid #1e4f82;
  border-radius: 12px;
  background: #fff;
}
.detail-summary-grid article > span { display: block; margin-bottom: 10px; color: #64748b; font-size: 14px; font-weight: 700; }
.detail-summary-grid article > strong { display: block; color: #102a43; font-size: 18px; }
.detail-summary-grid article p { margin: 10px 0 0; color: #334155; }
.completion-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0;
  padding: 20px 22px;
  border: 1px solid #86efac;
  border-left: 7px solid #16a34a;
  border-radius: 12px;
  background: #f0fdf4;
}
.completion-card.warning { border-color: #fbbf24; border-left-color: #d97706; background: #fffbeb; }
.completion-card h3 { margin: 3px 0 6px; color: #14532d; }
.workflow-panel { margin: 18px 0; border-left: 6px solid #2563eb; }
.detail-two-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: 18px; align-items: start; }
.timeline-list { display: grid; gap: 0; }
.timeline-event { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding-bottom: 22px; }
.timeline-event::before { content: ""; position: absolute; left: 7px; top: 15px; bottom: 0; width: 2px; background: #cbd5e1; }
.timeline-event:last-child::before { display: none; }
.timeline-dot { position: relative; z-index: 1; width: 16px; height: 16px; margin-top: 4px; border: 4px solid #bfdbfe; border-radius: 50%; background: #2563eb; }
.timeline-event strong { color: #102a43; }
.timeline-event small { display: block; color: #64748b; margin: 2px 0 7px; }
.timeline-event p { margin: 5px 0; color: #475569; }
.notification-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.notification-tabs a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 54px;
  padding: 11px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  text-decoration: none;
  font-weight: 700;
}
.notification-tabs a.active { border-color: #173b67; background: #173b67; color: #fff; }
.notification-tabs strong { font-size: 20px; }
.backup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.backup-grid .panel { padding: 24px; }
.backup-stat { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid #e2e8f0; }
.backup-stat strong { color: #0f2747; }
.backup-grid .full { display: flex; justify-content: center; width: 100%; margin: 18px 0 10px; }
.restore-card form { display: grid; gap: 14px; }
.upgrade-required ol { text-align: left; line-height: 1.9; }

body.led-page { margin: 0; min-height: 100vh; overflow: auto; background: #071426; color: #fff; }
.led-screen { min-height: 100vh; padding: clamp(24px, 2.5vw, 48px); background: radial-gradient(circle at 85% 0%, #163d69 0, #071426 42%, #040a13 100%); }
.led-screen header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 2px solid rgba(255,255,255,.18); }
.led-screen header > div:first-child { display: flex; align-items: center; gap: 18px; }
.led-logo { width: 78px; height: 78px; object-fit: contain; }
.led-screen header span { color: #93c5fd; font-size: clamp(14px, 1.2vw, 20px); font-weight: 700; letter-spacing: .08em; }
.led-screen h1 { margin: 4px 0 0; color: #fff; font-size: clamp(28px, 3vw, 52px); }
.led-clock { text-align: right; }
.led-clock strong { display: block; color: #fff; font-size: clamp(32px, 3.2vw, 56px); font-variant-numeric: tabular-nums; }
.led-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(12px, 1.3vw, 24px); margin: clamp(22px, 2.5vw, 42px) 0; }
.led-kpis article { padding: clamp(18px, 1.8vw, 32px); border: 1px solid rgba(147,197,253,.3); border-top: 6px solid #3b82f6; border-radius: 16px; background: rgba(15,39,71,.88); }
.led-kpis article.amber { border-top-color: #f59e0b; }.led-kpis article.green { border-top-color: #22c55e; }.led-kpis article.red { border-top-color: #ef4444; }
.led-kpis span { display: block; color: #bfdbfe; font-size: clamp(16px, 1.3vw, 24px); font-weight: 700; }
.led-kpis strong { display: block; margin-top: 8px; color: #fff; font-size: clamp(46px, 5vw, 88px); line-height: 1; }
.led-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2vw, 34px); }
.led-panel { padding: clamp(20px, 2vw, 34px); border: 1px solid rgba(255,255,255,.16); border-radius: 16px; background: rgba(10,27,49,.92); }
.led-panel h2 { margin: 0 0 16px; color: #fff; font-size: clamp(24px, 2vw, 36px); }
.led-status-list,
.led-followup { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.led-status-list div,
.led-followup div { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 13px 16px; border-left: 5px solid #60a5fa; background: #102a43; }
.led-followup div.red { border-left-color: #ef4444; }
.led-status-list span,
.led-followup span { font-size: clamp(16px, 1.25vw, 23px); font-weight: 700; }
.led-status-list strong,
.led-followup strong { color: #fff; font-size: clamp(27px, 2.3vw, 42px); }
.led-screen footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 24px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.16); color: #93c5fd; }
.led-screen footer a { color: #fff; }

@media (max-width: 1199px) {
  .detail-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-two-columns { grid-template-columns: 1fr; }
  .notification-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .notification-strip,
  .backup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .led-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .led-body { grid-template-columns: 1fr; }
  .led-clock { display: none; }
}
@media (max-width: 640px) {
  .notification-strip,
  .notification-tabs,
  .backup-grid,
  .detail-summary-grid { grid-template-columns: 1fr; }
  .pagination-bar { align-items: flex-start; flex-direction: column; }
  .completion-card { align-items: flex-start; flex-direction: column; }
  .led-kpis,
  .led-status-list,
  .led-followup { grid-template-columns: 1fr; }
}

/* ================================================================
   POLICE COMMAND DASHBOARD v2
   Sidebar + command topbar + KPI + charts
   ================================================================ */
:root {
  --sidebar-width: 278px;
  --sidebar-mini: 86px;
  --command-bg: #eef3f8;
  --command-line: #dfe7f0;
  --command-ink: #142238;
  --command-muted: #708098;
}

.app-page { background: var(--command-bg); }
.app-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left .22s ease;
}
.app-content { min-height: calc(100vh - 132px); }

.ui-icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
  vertical-align: middle;
}
.ui-icon svg { width: 100%; height: 100%; display: block; }

/* Sidebar */
.app-sidebar {
  position: fixed;
  z-index: 1050;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  overflow: hidden auto;
  color: #dce9f8;
  background:
    radial-gradient(circle at 10% 0%, rgba(63, 145, 232, .18), transparent 22rem),
    linear-gradient(180deg, #07172c 0%, #0a213d 58%, #081a31 100%);
  border-right: 1px solid rgba(255,255,255,.07);
  box-shadow: 12px 0 34px rgba(8, 24, 46, .1);
  transition: width .22s ease, transform .22s ease;
}
.sidebar-brand {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 7px 18px;
  margin-bottom: 8px;
  color: #fff !important;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
}
.sidebar-brand-badge {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 14px;
  background: linear-gradient(145deg, #236cc6, #35a5dc);
  box-shadow: inset 0 1px rgba(255,255,255,.28), 0 10px 24px rgba(0,0,0,.2);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .06em;
}
.sidebar-brand-copy { min-width: 0; }
.sidebar-brand-copy strong, .sidebar-brand-copy small { display: block; }
.sidebar-brand-copy strong { font-size: 13px; letter-spacing: .06em; }
.sidebar-brand-copy small { margin-top: 4px; color: #8fa8c7; font-size: 9px; font-weight: 700; letter-spacing: .04em; }
.sidebar-nav { display: flex; flex: 1; flex-direction: column; gap: 4px; }
.sidebar-section-label {
  margin: 20px 10px 7px;
  color: #6481a5;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #aebfd3;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.06); transform: translateX(2px); }
.sidebar-link.active {
  color: #fff;
  border-color: rgba(79, 158, 239, .16);
  background: linear-gradient(90deg, rgba(38,113,202,.32), rgba(51,155,222,.1));
  box-shadow: inset 3px 0 #4cc2e7;
}
.sidebar-link.active .ui-icon { color: #66d1ef; }
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 9px 5px;
  margin-top: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
}
.sidebar-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border-radius: 11px;
  color: #09213d;
  background: linear-gradient(145deg, #e9f4ff, #9fdcf0);
  font-size: 11px;
  font-weight: 900;
}
.sidebar-profile-copy { min-width: 0; }
.sidebar-profile-copy strong, .sidebar-profile-copy small { display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile-copy strong { max-width: 185px; color: #eef6ff; font-size: 11px; }
.sidebar-profile-copy small { margin-top: 3px; color: #7190b4; font-size: 9px; letter-spacing: .08em; }
.sidebar-backdrop { display: none; }

/* Topbar */
.app-topbar {
  position: sticky;
  z-index: 1035;
  top: 0;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(205, 217, 231, .88);
  background: rgba(249, 251, 253, .91);
  box-shadow: 0 5px 18px rgba(31, 53, 83, .035);
  backdrop-filter: blur(16px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 13px; }
.topbar-icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #dce5ef;
  border-radius: 12px;
  color: #36506f;
  background: #fff;
  box-shadow: 0 5px 14px rgba(26, 48, 78, .05);
}
.topbar-icon-button:hover { color: #1769b9; border-color: #cbdcec; background: #f8fbff; }
.topbar-title small, .topbar-title strong { display: block; line-height: 1.18; }
.topbar-title small { margin-bottom: 4px; color: #8796a9; font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.topbar-title strong { color: #1b2d45; font-size: 15px; font-weight: 850; }
.topbar-date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  color: #6f8095;
  border: 1px solid #e0e7ef;
  border-radius: 10px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
}
.topbar-date .ui-icon { width: 16px; height: 16px; color: #337cc8; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 5px 10px 5px 6px;
  border: 1px solid #dfe6ef;
  border-radius: 13px;
  color: #233851;
  background: #fff;
  box-shadow: 0 5px 15px rgba(26,48,78,.04);
}
.topbar-user .user-avatar { color: #fff; background: linear-gradient(145deg, #173f70, #277ccb); }
.topbar-user .user-copy strong { color: #233851; }
.topbar-user .user-copy small { color: #8a98a9; }
.app-dropdown .ui-icon { width: 16px; height: 16px; }

/* Command workspace */
.app-page .container { width: min(100% - 48px, 1560px); max-width: 1560px; margin: 26px auto; }
.dashboard-container { padding-bottom: 8px; }
.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.dashboard-heading h2 { margin: 2px 0 3px; font-size: 27px; }
.dashboard-heading p { margin: 0; color: var(--command-muted); font-size: 12px; }
.dashboard-heading .actions { margin: 0; }
.dashboard-heading .btn, .command-btn { display: inline-flex; align-items: center; gap: 7px; }
.dashboard-heading .ui-icon, .command-btn .ui-icon { width: 17px; height: 17px; }

.command-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 218px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 36px 40px;
  border-radius: 22px;
  color: #dbe9f8;
  background: linear-gradient(120deg, #07182e 0%, #0d3158 55%, #14558e 100%);
  box-shadow: 0 18px 48px rgba(13, 46, 83, .15);
}
.command-hero::after {
  content: "P4";
  position: absolute;
  z-index: -1;
  right: 30px;
  top: 50%;
  transform: translateY(-52%);
  color: rgba(255,255,255,.035);
  font-size: 190px;
  font-weight: 950;
  letter-spacing: -.08em;
}
.command-hero h1 { margin: 5px 0 8px; color: #fff; font-size: clamp(29px, 3vw, 43px); }
.command-hero p { margin: 0; color: #b7cade; }
.command-hero .eyebrow { color: #5ad1ee; }
.command-hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.command-btn { color: #0d2b4d; border-color: #fff; background: #fff; }
.command-btn:hover { color: #0d2b4d; background: #edf7ff; }
.command-btn.ghost { color: #e8f4ff; border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.08); }
.command-btn.ghost:hover { color: #fff; background: rgba(255,255,255,.14); }

.home-status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid var(--command-line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(31, 53, 83, .045);
}
.home-status-strip > div { padding: 18px 22px; border-right: 1px solid #edf1f5; }
.home-status-strip > div:last-child { border-right: 0; }
.home-status-strip span, .home-status-strip strong { display: block; }
.home-status-strip span { color: var(--command-muted); font-size: 11px; font-weight: 700; }
.home-status-strip strong { margin-top: 2px; color: #142d4b; font-size: 27px; line-height: 1.15; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.quick-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 18px;
  color: #253950;
  border: 1px solid var(--command-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(31,53,83,.04);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.quick-card:hover { color: #173b64; transform: translateY(-2px); border-color: #cadbed; box-shadow: 0 15px 32px rgba(31,53,83,.08); }
.quick-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 13px; }
.quick-icon.blue { color: #2169ba; background: #edf5ff; }
.quick-icon.cyan { color: #147f9d; background: #e9f9fc; }
.quick-icon.gold { color: #a6690a; background: #fff6e6; }
.quick-card strong, .quick-card small { display: block; }
.quick-card strong { font-size: 13px; }
.quick-card small { margin-top: 3px; color: #8390a2; font-size: 10px; }
.quick-arrow { color: #9bacbf; font-size: 20px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 12px; }
.kpi-card {
  --kpi-bg-start: #f3f7fb;
  --kpi-bg-end: #e9f1f8;
  --kpi-border: #c9d8e6;
  --kpi-accent: #234d78;
  --kpi-shadow: rgba(35,77,120,.13);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--kpi-border);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--kpi-bg-start) 0%, var(--kpi-bg-end) 100%);
  box-shadow: 0 10px 28px var(--kpi-shadow);
}
.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--kpi-accent);
}
.kpi-card.navy { --kpi-bg-start: #d6e4f2; --kpi-bg-end: #edf4fa; --kpi-border: #91abc5; --kpi-accent: #183f68; --kpi-shadow: rgba(24,63,104,.18); }
.kpi-card.blue { --kpi-bg-start: #cce9ff; --kpi-bg-end: #eaf7ff; --kpi-border: #7bbbe8; --kpi-accent: #075b9d; --kpi-shadow: rgba(7,91,157,.18); }
.kpi-card.amber { --kpi-bg-start: #ffe3aa; --kpi-bg-end: #fff4d9; --kpi-border: #dfa947; --kpi-accent: #815000; --kpi-shadow: rgba(129,80,0,.18); }
.kpi-card.green { --kpi-bg-start: #c9ecd9; --kpi-bg-end: #e9f8f0; --kpi-border: #75bd99; --kpi-accent: #0b6a49; --kpi-shadow: rgba(11,106,73,.18); }
.kpi-card.red { --kpi-bg-start: #ffd3d8; --kpi-bg-end: #fff0f2; --kpi-border: #df8993; --kpi-accent: #9b2430; --kpi-shadow: rgba(155,36,48,.18); }
.kpi-card .kpi-icon { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 40px; border-radius: 12px; }
.kpi-card .kpi-icon .ui-icon { width: 20px; height: 20px; }
.kpi-card.navy .kpi-icon { color: #fff; background: #234d78; }
.kpi-card.blue .kpi-icon { color: #fff; background: #1677bd; }
.kpi-card.amber .kpi-icon { color: #fff; background: #b8780b; }
.kpi-card.green .kpi-icon { color: #fff; background: #16815c; }
.kpi-card.red .kpi-icon { color: #fff; background: #b83b47; }
.kpi-card > div { min-width: 0; }
.kpi-card .kpi-label, .kpi-card strong, .kpi-card small { display: block; }
.kpi-card .kpi-label { color: var(--kpi-accent); font-size: 10px; font-weight: 850; white-space: nowrap; }
.kpi-card strong { margin: 2px 0 1px; color: #152941; font-size: 29px; font-weight: 900; line-height: 1.1; letter-spacing: -.035em; }
.kpi-card small { color: #526477; font-size: 9px; }
.kpi-card-link {
  color: inherit;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.kpi-card-link:hover {
  color: inherit;
  transform: translateY(-3px);
  border-color: var(--kpi-accent);
  box-shadow: 0 16px 34px var(--kpi-shadow);
}
.kpi-card-link:focus-visible { outline: 3px solid rgba(42,118,197,.25); outline-offset: 3px; }
.kpi-card .kpi-open { display: block; margin-top: 7px; color: var(--kpi-accent); font-size: 9px; font-weight: 850; }

/* Dashboard drill-down and follow-up list */
.dashboard-list-page { padding-bottom: 12px; }
.dashboard-view-tabs { display: grid; grid-template-columns: repeat(5, minmax(150px,1fr)); gap: 11px; margin-bottom: 14px; }
.dashboard-view-tab {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 14px 16px;
  color: #52667e;
  border: 1px solid var(--command-line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(31,53,83,.035);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.dashboard-view-tab:hover { color: #213c59; transform: translateY(-2px); border-color: #c8d9ea; box-shadow: 0 13px 28px rgba(31,53,83,.08); }
.dashboard-view-tab.active { border-color: #9dc0e5; background: #f5faff; box-shadow: inset 0 0 0 2px rgba(45,116,190,.08), 0 12px 28px rgba(31,53,83,.08); }
.dashboard-view-tab.red.active { border-color: #edb7bd; background: #fff7f7; }
.dashboard-view-tab.green.active { border-color: #a9d9c8; background: #f5fcf8; }
.dashboard-view-tab.amber.active { border-color: #ebcd96; background: #fffaf1; }
.dashboard-view-tab > span:last-child { min-width: 0; }
.dashboard-view-tab small,.dashboard-view-tab strong { display: block; line-height: 1.18; }
.dashboard-view-tab small { overflow: hidden; color: #738399; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-view-tab strong { margin-top: 4px; color: #18314e; font-size: 22px; font-weight: 900; }
.dashboard-tab-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; border-radius: 11px; color: #275d91; background: #edf4fb; }
.dashboard-tab-icon .ui-icon { width: 19px; height: 19px; }
.dashboard-view-tab.blue .dashboard-tab-icon { color: #1d6fc4; background: #edf6ff; }
.dashboard-view-tab.amber .dashboard-tab-icon { color: #ae6b08; background: #fff5e3; }
.dashboard-view-tab.green .dashboard-tab-icon { color: #137252; background: #e9f8f1; }
.dashboard-view-tab.red .dashboard-tab-icon { color: #bb3e49; background: #fff0f1; }
.dashboard-list-filters { display: grid; grid-template-columns: minmax(300px,1.35fr) minmax(230px,.65fr) auto; align-items: end; gap: 13px; padding: 17px 19px; }
.dashboard-list-filters label { margin: 0; }
.dashboard-list-filters .actions { margin: 0; flex-wrap: nowrap; }
.dashboard-list-summary { display: flex; align-items: center; gap: 12px; margin: 15px 1px 10px; }
.dashboard-list-summary p { margin: 0; color: #687a90; }
.dashboard-list-summary p strong { color: #1c3552; }
.dashboard-list-badge,.follow-up-hint { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-size: 11px; font-weight: 850; }
.dashboard-list-badge { color: #225b94; background: #eaf3fc; }
.dashboard-list-badge.amber { color: #965d06; background: #fff3dd; }
.dashboard-list-badge.green { color: #116d4e; background: #e6f7ef; }
.dashboard-list-badge.red { color: #ad3440; background: #ffedef; }
.dashboard-list-badge .ui-icon,.follow-up-hint .ui-icon { width: 16px; height: 16px; }
.follow-up-hint { margin-left: auto; color: #a23540; background: #fff0f1; }
.dashboard-tracking-table { border: 1px solid var(--command-line); border-radius: 16px; background: #fff; box-shadow: 0 10px 28px rgba(31,53,83,.04); }
.dashboard-tracking-table th { white-space: nowrap; }
.dashboard-tracking-table td { vertical-align: middle; }
.dashboard-tracking-table td > strong,.dashboard-tracking-table td > small { display: block; }
.dashboard-tracking-table td > small { margin-top: 3px; color: #8492a4; line-height: 1.35; }
.dashboard-tracking-table .tracking-subject { min-width: 260px; max-width: 430px; }
.tracking-subject strong { color: #243a53; }
.responsible-name { display: block; min-width: 145px; color: #223b58; font-weight: 800; }
.responsible-name.unassigned { color: #b0444e; }
.deadline-date { display: block; color: #425972; font-size: 12px; font-weight: 750; white-space: nowrap; }
.deadline-state { display: inline-flex; margin-top: 4px; padding: 3px 7px; border-radius: 999px; color: #718297; background: #edf1f5; font-size: 10px; font-weight: 800; white-space: nowrap; }
.deadline-state.overdue { color: #ad3540; background: #ffedef; }
.deadline-state.today { color: #9a5b00; background: #fff2d8; }
.deadline-state.upcoming { color: #25609b; background: #eaf3fc; }
.deadline-state.done { color: #147051; background: #e7f7f0; }
.tracking-row-overdue > td { background: #fffafb; }
.tracking-row-overdue > td:first-child { box-shadow: inset 4px 0 #df6670; }
.tracking-actions { min-width: 112px; }
.tracking-actions .btn { width: 100%; justify-content: center; margin: 2px 0; white-space: nowrap; }

/* Dashboard charts */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .75fr); gap: 14px; margin-top: 14px; }
.dashboard-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--command-line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(31,53,83,.04);
}
.dashboard-panel.status-panel { grid-column: 1 / -1; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-heading h3 { margin: 1px 0 0; font-size: 15px; }
.panel-kicker { display: block; color: #8c9aae; font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.panel-heading > a { color: #3674b7; font-size: 10px; font-weight: 800; }
.live-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; color: #247252; background: #eaf8f2; font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.live-chip i { width: 6px; height: 6px; border-radius: 50%; background: #22a16f; box-shadow: 0 0 0 3px rgba(34,161,111,.12); }
.bar-chart { height: 230px; display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: clamp(8px, 2.5vw, 22px); padding: 14px 8px 0; border-bottom: 1px solid #e9eef4; background: repeating-linear-gradient(to top, transparent 0 54px, #f0f3f7 55px 56px); }
.bar-item { height: 100%; display: grid; grid-template-rows: 20px 1fr 25px; align-items: end; justify-items: center; }
.bar-value { color: #68798e; font-size: 9px; font-weight: 800; }
.bar-track { width: min(38px, 72%); height: 100%; display: flex; align-items: flex-end; border-radius: 8px 8px 0 0; background: rgba(42, 118, 197, .045); }
.bar-fill { width: 100%; height: max(4px, var(--bar)); display: block; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #49b9e1, #2268ba); box-shadow: 0 8px 15px rgba(35,109,188,.15); }
.bar-label { color: #8b98a8; font-size: 9px; }
.donut-layout { min-height: 228px; display: flex; align-items: center; justify-content: center; gap: 28px; }
.status-donut {
  position: relative;
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  flex: 0 0 150px;
  border-radius: 50%;
  background: conic-gradient(#2f9f78 0 var(--done), #2d73be var(--done) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3), 0 11px 28px rgba(23,63,102,.1);
}
.status-donut::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px #edf1f5; }
.status-donut > div { position: relative; z-index: 1; text-align: center; }
.status-donut strong, .status-donut span { display: block; }
.status-donut strong { color: #17324f; font-size: 28px; line-height: 1; }
.status-donut span { margin-top: 5px; color: #8290a2; font-size: 9px; font-weight: 700; }
.donut-legend { min-width: 0; display: grid; gap: 12px; }
.donut-legend > span { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; color: #718095; font-size: 10px; }
.donut-legend strong { color: #263a53; font-size: 11px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.done-dot { background: #2f9f78; }.progress-dot { background: #2d73be; }.overdue-dot { background: #d65a65; }
.status-bars { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 28px; }
.status-row > div:first-child { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: #607188; font-size: 10px; }
.status-row strong { color: #233851; }
.status-track { height: 7px; overflow: hidden; border-radius: 99px; background: #edf2f7; }
.status-track span { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #2c6db7, #48badc); }

/* Recent rows */
.recent-panel { margin-top: 14px; padding-bottom: 8px; }
.recent-list { margin: 0 -8px; }
.recent-row { display: grid; grid-template-columns: 94px minmax(180px,1fr) 92px auto; align-items: center; gap: 13px; padding: 11px 9px; border-top: 1px solid #edf1f5; color: #354b64; }
.recent-row:hover { color: #1d4e81; background: #f8fbfe; }
.recent-no { color: #286bb4; font-size: 10px; font-weight: 850; }
.recent-subject { min-width: 0; }
.recent-subject strong, .recent-subject small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-subject strong { color: #263950; font-size: 11px; }
.recent-subject small { margin-top: 3px; color: #8c99a9; font-size: 9px; }
.recent-date { color: #8492a4; font-size: 9px; }
.empty-state { padding: 30px; color: #8a98aa; text-align: center; }

/* Footer within application shell */
.app-page .app-footer { width: auto; margin: 34px 28px 18px; }

/* Desktop collapsed sidebar */
@media (min-width: 1200px) {
  body.sidebar-collapsed .app-sidebar { width: var(--sidebar-mini); }
  body.sidebar-collapsed .app-shell { margin-left: var(--sidebar-mini); }
  body.sidebar-collapsed .sidebar-brand-copy,
  body.sidebar-collapsed .sidebar-section-label,
  body.sidebar-collapsed .sidebar-link > span:not(.ui-icon),
  body.sidebar-collapsed .sidebar-profile-copy { display: none; }
  body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 0; }
  body.sidebar-collapsed .sidebar-link { justify-content: center; padding-inline: 8px; }
  body.sidebar-collapsed .sidebar-profile { justify-content: center; padding-inline: 0; }
}

@media (max-width: 1199.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: 18px 0 42px rgba(5,20,38,.22); }
  .app-shell { margin-left: 0; }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { position: fixed; z-index: 1045; inset: 0; display: block; background: rgba(5,18,34,.52); backdrop-filter: blur(2px); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-view-tabs { grid-template-columns: repeat(3,1fr); }
  .dashboard-list-filters { grid-template-columns: 1fr 1fr; }
  .dashboard-list-filters .actions { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .app-topbar { padding-inline: 18px; }
  .topbar-date { display: none; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-panel.status-panel { grid-column: auto; }
  .status-bars { grid-template-columns: 1fr; }
  .command-hero { align-items: flex-start; flex-direction: column; padding: 30px; }
  .command-hero-actions { justify-content: flex-start; }
  .home-status-strip { grid-template-columns: repeat(2, 1fr); }
  .home-status-strip > div:nth-child(2) { border-right: 0; }
  .home-status-strip > div:nth-child(-n+2) { border-bottom: 1px solid #edf1f5; }
  .quick-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app-page .container { width: min(100% - 22px, 1560px); margin-top: 18px; }
  .app-topbar { min-height: 68px; padding: 10px 11px; }
  .topbar-title small { display: none; }
  .topbar-user .user-copy { display: none; }
  .topbar-user { min-width: 45px; padding-right: 6px; }
  .command-hero { min-height: 0; padding: 25px 21px; border-radius: 17px; }
  .command-hero::after { font-size: 120px; right: 15px; }
  .command-hero h1 { font-size: 27px; }
  .home-status-strip > div { padding: 15px; }
  .home-status-strip strong { font-size: 23px; }
  .kpi-grid { grid-template-columns: 1fr; gap: 9px; }
  .kpi-card { align-items: center; padding: 14px 16px; }
  .kpi-card strong { font-size: 25px; }
  .dashboard-panel { padding: 16px; border-radius: 15px; }
  .bar-chart { height: 205px; gap: 7px; padding-inline: 1px; }
  .bar-track { width: min(27px, 78%); }
  .donut-layout { flex-direction: column; gap: 20px; }
  .donut-legend { width: 100%; }
  .recent-row { grid-template-columns: 74px minmax(0,1fr) auto; gap: 8px; }
  .recent-date { display: none; }
  .recent-row .badge { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-page .app-footer { margin-inline: 12px; }
}

/* ================================================================
   POLICE COMMAND DASHBOARD v3 — LARGE READABILITY + FILE STATUS
   ================================================================ */
:root {
  --sidebar-width: 300px;
  --sidebar-mini: 96px;
}

body { font-size: 17px; }
h3 { font-size: 20px; }
.eyebrow { font-size: 12px; }
.muted { font-size: 14.5px; }
label, .form-label { font-size: 15.5px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea, .form-control, .form-select {
  min-height: 48px;
  padding: 10px 13px;
  font-size: 16px;
}
.btn { min-height: 42px; padding: 9px 15px; font-size: 15px; }
.btn.tiny { min-height: 35px; padding: 6px 11px; font-size: 13px; }
th { padding: 14px 13px; font-size: 13px; }
td { padding: 14px 13px; font-size: 15px; }
.badge { padding: 7px 11px; font-size: 13px; }

/* Official logo */
.auth-logo {
  width: 92px;
  height: 92px;
  display: block;
  object-fit: contain;
  margin: 0 auto 18px;
  filter: drop-shadow(0 10px 18px rgba(17, 55, 95, .16));
}
.sidebar-brand-badge {
  padding: 4px;
  overflow: hidden;
  background: #fff;
}
.sidebar-logo { width: 100%; height: 100%; display: block; object-fit: contain; }

/* Larger navigation and topbar */
.sidebar-brand-copy strong { font-size: 15px; }
.sidebar-brand-copy small { font-size: 10.5px; }
.sidebar-section-label { font-size: 10.5px; }
.sidebar-link { min-height: 50px; font-size: 15.5px; }
.sidebar-profile-copy strong { font-size: 13.5px; }
.sidebar-profile-copy small { font-size: 10.5px; }
.topbar-title small { font-size: 9.5px; }
.topbar-title strong { font-size: 18px; }
.topbar-date { font-size: 13px; }
.topbar-user .user-copy strong { font-size: 13px; }
.topbar-user .user-copy small { font-size: 10px; }

/* Larger dashboard typography */
.dashboard-heading h2 { font-size: 33px; }
.dashboard-heading p { font-size: 14.5px; }
.kpi-card { gap: 15px; padding: 20px; }
.kpi-card .kpi-icon { width: 45px; height: 45px; flex-basis: 45px; }
.kpi-card .kpi-icon .ui-icon { width: 23px; height: 23px; }
.kpi-card .kpi-label { font-size: 12.5px; }
.kpi-card strong { font-size: 35px; }
.kpi-card small { font-size: 11.5px; }
.panel-heading h3 { font-size: 18.5px; }
.panel-kicker { font-size: 10px; }
.panel-heading > a { font-size: 12.5px; }
.live-chip { font-size: 10px; }
.bar-value, .bar-label { font-size: 11px; }
.status-donut strong { font-size: 32px; }
.status-donut span { font-size: 11px; }
.donut-legend > span { font-size: 12.5px; }
.donut-legend strong { font-size: 13.5px; }
.status-row > div:first-child { font-size: 13px; }
.home-status-strip span { font-size: 13px; }
.home-status-strip strong { font-size: 31px; }
.quick-card strong { font-size: 15px; }
.quick-card small { font-size: 12.5px; }

/* Attachment visibility in dashboard and register */
.recent-row { grid-template-columns: 94px minmax(180px,1fr) 92px 92px auto; padding-block: 14px; }
.recent-no { font-size: 12.5px; }
.recent-subject strong { font-size: 14px; }
.recent-subject small { font-size: 11.5px; }
.recent-date { font-size: 11.5px; }
.recent-files, .attachment-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #8a98aa;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
}
.recent-files .ui-icon, .attachment-count .ui-icon { width: 16px; height: 16px; }
.recent-files.has-files, .attachment-count.has-files { color: #176db9; }

/* Attachment detail panel */
.attachment-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.attachment-heading h3 { margin: 0; }
.attachment-total { color: #6f8095; font-size: 14px; font-weight: 700; }
.attachment-list { display: grid; gap: 9px; }
.attachment-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 1px solid #e3eaf2;
  border-radius: 12px;
  background: #fbfdff;
}
.attachment-file-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #216ebc;
  border-radius: 11px;
  background: #edf6ff;
}
.attachment-copy { min-width: 0; }
.attachment-copy a, .attachment-copy strong { display: block; overflow: hidden; color: #1f4f81; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-copy small { display: block; margin-top: 3px; color: #7f8da0; font-size: 12px; }
.file-state {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.file-state.available { color: #176b4c; border-color: #c7ead9; background: #eaf8f2; }
.file-state.missing { color: #b33f49; border-color: #f0cbd0; background: #fff0f1; }
.attachment-upload-form { padding-top: 15px; margin-top: 17px; border-top: 1px solid #e7edf4; }
.alert.warning { color: #76500a; border-color: #f0d59b; background: #fff8e8; }
.missing-file-panel { max-width: 760px; margin: 70px auto; text-align: center; }
.missing-file-panel .file-state { margin-bottom: 12px; }
.missing-file-panel p { color: #68798e; }

/* Outgoing registry + printable document */
.registry-heading { margin-bottom: 16px; }
.registry-heading h2 { margin: 2px 0 0; }
.document-form-panel { max-width: 1180px; margin-inline: auto; }
.print-document {
  max-width: 980px;
  margin: 28px auto;
  padding: 34px 38px;
  color: #15293f;
  border: 1px solid #dce4ed;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(24, 49, 78, .12);
}
.print-toolbar { display: flex; justify-content: flex-end; gap: 9px; margin-bottom: 22px; }
.print-header { display: flex; align-items: center; justify-content: center; gap: 20px; padding-bottom: 20px; margin-bottom: 24px; text-align: center; border-bottom: 2px solid #173b63; }
.print-header h1 { margin: 0; font-size: 25px; }
.print-header h2 { margin: 5px 0 0; color: #315879; font-size: 20px; }
.print-logo { width: 82px; height: 82px; object-fit: contain; }
.print-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.print-table th, .print-table td { padding: 12px 14px; vertical-align: top; border: 1px solid #bcc9d7; }
.print-table th { width: 18%; color: #173b63; background: #eef4fa; white-space: nowrap; }
.print-files { padding-top: 18px; }
.print-files h3 { font-size: 18px; }
.print-files li { margin-bottom: 6px; }
.print-meta { padding-top: 18px; margin-top: 24px; color: #6d7c8e; font-size: 13px; text-align: right; border-top: 1px solid #dce4ed; }

/* Multi-select status update for incoming/outgoing registers */
.bulk-status-form { margin: 0; }
.bulk-status-toolbar {
  display: grid;
  grid-template-columns: auto minmax(270px, 420px) auto auto minmax(180px, 1fr);
  align-items: end;
  gap: 12px;
  padding: 14px 16px;
  margin: 0 0 12px;
  border: 1px solid #cfe0f4;
  border-radius: 14px;
  background: linear-gradient(135deg, #f2f8ff 0%, #f8fbff 64%, #eef6ff 100%);
  box-shadow: 0 8px 22px rgba(29, 91, 155, .08);
}
.bulk-selection-summary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 98px;
  min-height: 48px;
  padding: 5px 13px;
  color: #31526f;
  border: 1px solid #c8ddf5;
  border-radius: 11px;
  background: #fff;
}
.bulk-selection-summary strong { color: #176bc1; font-size: 16px; line-height: 1.15; }
.bulk-selection-summary > span { margin-top: 2px; font-size: 12px; font-weight: 700; }
.bulk-status-field { margin: 0; }
.bulk-status-field > span { display: block; margin-bottom: 5px; color: #263d56; font-size: 13px; font-weight: 800; }
.bulk-status-field select { width: 100%; min-height: 48px; background-color: #fff; }
.bulk-status-toolbar > small { align-self: center; color: #6f8298; font-size: 12.5px; line-height: 1.45; }
.registry-table-wrap .select-column { width: 54px; min-width: 54px; padding-inline: 15px; text-align: center; }
.registry-checkbox {
  width: 20px;
  height: 20px;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
  accent-color: #2877d4;
}
.registry-table-wrap tbody tr.bulk-row-selected > td { background: #eef6ff; }
.registry-table-wrap tbody tr.bulk-row-selected > td:first-child { box-shadow: inset 4px 0 #2877d4; }
.bulk-status-toolbar .btn:disabled { cursor: not-allowed; opacity: .52; box-shadow: none; }

@media (max-width: 900px) {
  body { font-size: 16px; }
  .recent-row { grid-template-columns: 78px minmax(0,1fr) auto; }
  .recent-files, .recent-date { display: none; }
  .attachment-row { grid-template-columns: auto minmax(0,1fr) auto; }
  .attachment-row form { grid-column: 3; }
  .file-state { grid-column: 2 / -1; justify-self: start; }
  .bulk-status-toolbar { grid-template-columns: auto minmax(230px, 1fr) auto; align-items: end; }
  .bulk-status-toolbar > small { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .dashboard-heading h2 { font-size: 29px; }
  .kpi-card .kpi-label { font-size: 13px; }
  .kpi-card strong { font-size: 32px; }
  .panel-heading h3 { font-size: 17px; }
  .attachment-row { grid-template-columns: auto minmax(0,1fr); }
  .attachment-row form { grid-column: 2; }
  .file-state { grid-column: 2; }
  .bulk-status-toolbar { grid-template-columns: 1fr 1fr; }
  .bulk-selection-summary, .bulk-status-field, .bulk-status-toolbar > small { grid-column: 1 / -1; }
  .bulk-status-toolbar .btn { width: 100%; }
  .dashboard-view-tabs { grid-template-columns: repeat(2,1fr); }
  .dashboard-list-filters { grid-template-columns: 1fr; }
  .dashboard-list-filters .actions { grid-column: auto; flex-wrap: wrap; }
  .dashboard-list-summary { align-items: flex-start; flex-wrap: wrap; }
  .follow-up-hint { width: 100%; margin-left: 0; }
}

@media print {
  .app-sidebar, .app-topbar, .sidebar-backdrop { display: none !important; }
  .app-shell { margin-left: 0 !important; }
  .app-page .container { width: 100%; max-width: none; }
  .auth-page { background: #fff !important; }
  .print-toolbar { display: none !important; }
  .print-document { width: 100%; max-width: none; padding: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .print-table { font-size: 14px; }
  @page { size: A4 portrait; margin: 15mm; }
}

/* ================================================================
   DOCUMENT SYSTEM v12 — MINIMAL LED THEME
   Flat surfaces, strong contrast and large Thai typography
   ================================================================ */
:root {
  --p4-navy-950: #102a43;
  --p4-navy-900: #173f63;
  --p4-navy-800: #1f4e79;
  --p4-blue-700: #145da8;
  --p4-blue-600: #1769c2;
  --p4-blue-500: #2c7bd0;
  --p4-cyan-400: #4aa9d8;
  --p4-bg: #f4f6f8;
  --p4-surface: #ffffff;
  --p4-border: #d7dee7;
  --p4-text: #182536;
  --p4-muted: #5f6f82;
  --p4-success: #137a52;
  --p4-danger: #b8323e;
  --p4-radius: 12px;
  --p4-shadow: 0 4px 14px rgba(16, 42, 67, .06);
  --sidebar-width: 288px;
  --sidebar-mini: 88px;
  --command-bg: #f4f6f8;
  --command-line: #d7dee7;
  --command-ink: #182536;
  --command-muted: #5f6f82;
}

html { font-size: 18px; }
body {
  color: var(--p4-text);
  background: var(--p4-bg);
  font-family: "Noto Sans Thai Variable", "Noto Sans Thai", "Sarabun", "Leelawadee UI", Tahoma, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--p4-blue-700); }
a:hover { color: #0d4d8d; }
h1, h2, h3 { color: #122033; letter-spacing: 0; }
h1 { font-size: clamp(2rem, 3.2vw, 2.65rem); }
h2 { font-size: clamp(1.72rem, 2.3vw, 2.05rem); }
h3 { font-size: 1.15rem; }
.eyebrow { color: #1769c2; font-size: .75rem; letter-spacing: .12em; }
.muted { color: var(--p4-muted); font-size: .9rem; }

/* Minimal application shell */
.app-page { background: var(--command-bg); }
.app-sidebar {
  padding: 18px 13px 16px;
  color: #eaf1f8;
  border-right: 0;
  background: #102a43;
  box-shadow: none;
}
.sidebar-brand {
  min-height: 68px;
  gap: 13px;
  padding: 4px 7px 17px;
  margin-bottom: 7px;
  border-bottom-color: rgba(255, 255, 255, .14);
}
.sidebar-brand-badge {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}
.sidebar-brand-copy strong { color: #fff; font-size: .91rem; letter-spacing: .045em; }
.sidebar-brand-copy small { margin-top: 2px; color: #b8c9d9; font-size: .64rem; letter-spacing: .025em; }
.sidebar-section-label {
  margin: 18px 11px 7px;
  color: #91a7bb;
  font-size: .67rem;
  letter-spacing: .1em;
}
.sidebar-nav { gap: 5px; }
.sidebar-link {
  min-height: 51px;
  gap: 13px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #c8d5e1;
  font-size: .94rem;
  font-weight: 700;
  transition: color .14s ease, background-color .14s ease;
}
.sidebar-link .ui-icon { width: 21px; height: 21px; }
.sidebar-link:hover {
  color: #fff;
  background: #173f63;
  transform: none;
}
.sidebar-link.active {
  color: #102a43;
  border-color: #fff;
  background: #fff;
  box-shadow: inset 4px 0 #2c7bd0;
}
.sidebar-link.active .ui-icon { color: #1769c2; }
.sidebar-profile {
  padding: 14px 8px 4px;
  border-top-color: rgba(255, 255, 255, .14);
}
.sidebar-avatar {
  border-radius: 9px;
  color: #102a43;
  background: #fff;
  font-size: .72rem;
}
.sidebar-profile-copy strong { color: #fff; font-size: .82rem; }
.sidebar-profile-copy small { color: #9fb2c5; font-size: .65rem; }

.app-topbar {
  min-height: 82px;
  padding: 12px 28px;
  border-bottom: 1px solid #d7dee7;
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
}
.topbar-icon-button {
  width: 44px;
  height: 44px;
  border-color: #cbd4df;
  border-radius: 10px;
  color: #29435f;
  background: #fff;
  box-shadow: none;
}
.topbar-icon-button:hover { color: #145da8; border-color: #8fb5da; background: #f2f7fc; }
.topbar-title small { margin-bottom: 3px; color: #6c7e91; font-size: .65rem; letter-spacing: .1em; }
.topbar-title strong { color: #17283d; font-size: 1.05rem; font-weight: 800; }
.topbar-date, .topbar-user {
  border-color: #cfd8e3;
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}
.topbar-date { padding: 9px 12px; color: #53677d; font-size: .82rem; }
.topbar-user { min-height: 47px; }
.topbar-user .user-avatar { color: #fff; background: #145da8; }
.topbar-user .user-copy strong { color: #20364f; font-size: .82rem; }
.topbar-user .user-copy small { color: #6f8092; font-size: .65rem; }

/* Content and flat surfaces */
.app-page .container {
  width: min(100% - 44px, 1640px);
  max-width: 1640px;
  margin: 28px auto;
}
.hero, .panel, .card, .dashboard-panel, .table-wrap, .quick-card,
.home-status-strip, .dashboard-tracking-table, .dashboard-view-tab {
  border-color: var(--p4-border);
  border-radius: var(--p4-radius);
  background: #fff;
  box-shadow: var(--p4-shadow);
}
.panel { padding: 24px; }
.card { padding: 22px; }
.card::before { height: 3px; background: #1769c2; }
.card:hover, .quick-card:hover, .dashboard-view-tab:hover {
  transform: none;
  border-color: #9db9d5;
  box-shadow: 0 5px 16px rgba(16, 42, 67, .08);
}
.dashboard-heading { margin-bottom: 19px; }
.dashboard-heading h2 { margin: 3px 0; font-size: 2rem; }
.dashboard-heading p { color: #53677d; font-size: .9rem; }

.command-hero {
  min-height: 210px;
  padding: 36px 40px;
  border: 0;
  border-radius: 14px;
  color: #e8f0f8;
  background: #173f63;
  box-shadow: none;
}
.command-hero::after { color: rgba(255, 255, 255, .045); }
.command-hero h1 { color: #fff; }
.command-hero p { color: #d1dce7; font-size: 1rem; }
.command-hero .eyebrow { color: #8ed2f1; }
.command-btn { color: #173f63; border-color: #fff; background: #fff; }
.command-btn.ghost { color: #fff; border-color: rgba(255,255,255,.5); background: transparent; }
.home-status-strip { border-radius: 12px; box-shadow: none; }
.home-status-strip > div { padding: 20px 22px; }
.home-status-strip span { color: #5c6e81; font-size: .82rem; }
.home-status-strip strong { color: #162a41; font-size: 1.8rem; }
.quick-card { padding: 19px; border-radius: 12px; box-shadow: none; }
.quick-card strong { color: #1b3049; font-size: .98rem; }
.quick-card small { color: #64768a; font-size: .8rem; }
.quick-icon { border-radius: 10px; }

/* Clear form controls for projector and LED display */
label, .form-label {
  margin: 13px 0 7px;
  color: #223248;
  font-size: .93rem;
  font-weight: 750;
}
input:not([type="checkbox"]):not([type="radio"]), select, textarea,
.form-control, .form-select {
  min-height: 51px;
  padding: 10px 14px;
  border: 1px solid #b9c5d2;
  border-radius: 9px;
  color: #172536;
  background-color: #fff;
  font-size: .97rem;
  font-weight: 550;
  box-shadow: none;
}
input::placeholder, textarea::placeholder { color: #7a8796; opacity: 1; }
input:focus, select:focus, textarea:focus, .form-control:focus, .form-select:focus {
  border-color: #1769c2;
  box-shadow: 0 0 0 3px rgba(23, 105, 194, .15);
}

.btn {
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 800;
  box-shadow: none;
}
.btn:hover { transform: none; }
.btn.primary, .btn.primary:hover {
  color: #fff;
  border-color: #145da8;
  background: #1769c2;
  box-shadow: none;
}
.btn.primary:hover { background: #145da8; }
.btn.secondary { color: #29435f; border-color: #cbd5df; background: #f4f6f8; }
.btn.secondary:hover { color: #17324f; background: #e8edf2; }
.btn.danger { color: #a02733; border-color: #e6b9be; background: #fff; }
.btn.danger:hover { color: #fff; background: #b8323e; }
.btn.tiny { min-height: 37px; padding: 6px 11px; border-radius: 8px; font-size: .78rem; }

/* High-legibility data tables */
.table-wrap {
  border-radius: 11px;
  box-shadow: none;
  scrollbar-color: #9fb0c1 #eef1f4;
}
table { min-width: 920px; }
th, td {
  padding: 15px 14px;
  border-bottom-color: #dce3ea;
  font-size: .9rem;
  line-height: 1.55;
}
th {
  color: #25374c;
  background: #e9eef4;
  font-size: .8rem;
  font-weight: 850;
  letter-spacing: 0;
}
tbody tr:nth-child(even) { background: #fbfcfd; }
tbody tr:hover { background: #eef5fc; }
td, td strong { color: #1b2b3e; }
.registry-table-wrap tbody tr.bulk-row-selected > td { background: #e5f1fd; }
.registry-table-wrap tbody tr.bulk-row-selected > td:first-child { box-shadow: inset 5px 0 #1769c2; }
.registry-checkbox { width: 22px; height: 22px; accent-color: #1769c2; }

.badge {
  min-height: 30px;
  padding: 6px 11px;
  border-color: #aac8e8;
  border-radius: 999px;
  color: #14599d;
  background: #eaf3fc;
  font-size: .78rem;
  font-weight: 850;
}
.badge.done, .done { color: #0f6846; border-color: #9fd2bc; background: #e2f4eb; }
.alert { border-radius: 9px; box-shadow: none; }

/* Bulk status bar */
.bulk-status-toolbar {
  padding: 16px;
  border-color: #b9cde2;
  border-radius: 11px;
  background: #edf5fc;
  box-shadow: none;
}
.bulk-selection-summary {
  min-height: 51px;
  border-color: #aac4de;
  border-radius: 9px;
}
.bulk-selection-summary strong { color: #145da8; font-size: .98rem; }
.bulk-selection-summary > span, .bulk-status-toolbar > small { color: #52677d; font-size: .78rem; }
.bulk-status-field > span { color: #22364d; font-size: .82rem; }

/* Minimal KPI cards with status color retained */
.kpi-grid { gap: 14px; }
.kpi-card {
  --kpi-bg-start: #f7f9fb;
  --kpi-bg-end: #f7f9fb;
  --kpi-border: #c7d1dc;
  --kpi-accent: #294e73;
  --kpi-shadow: transparent;
  min-height: 154px;
  align-items: center;
  gap: 15px;
  padding: 21px 19px;
  border: 1px solid var(--kpi-border);
  border-left: 6px solid var(--kpi-accent);
  border-radius: 11px;
  background: var(--kpi-bg-start);
  box-shadow: none;
}
.kpi-card::before { display: none; }
.kpi-card.navy { --kpi-bg-start: #f1f5f8; --kpi-border: #b7c5d2; --kpi-accent: #294e73; }
.kpi-card.blue { --kpi-bg-start: #eef6fd; --kpi-border: #a7c9e8; --kpi-accent: #1769c2; }
.kpi-card.amber { --kpi-bg-start: #fff8e9; --kpi-border: #dfc98e; --kpi-accent: #a86500; }
.kpi-card.green { --kpi-bg-start: #edf8f3; --kpi-border: #abd4c2; --kpi-accent: #137a52; }
.kpi-card.red { --kpi-bg-start: #fff1f2; --kpi-border: #e1b2b7; --kpi-accent: #b8323e; }
.kpi-card .kpi-icon {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border-radius: 10px;
  color: #fff;
  background: var(--kpi-accent) !important;
}
.kpi-card .kpi-icon .ui-icon { width: 24px; height: 24px; }
.kpi-card .kpi-label { color: var(--kpi-accent); font-size: .84rem; }
.kpi-card strong { margin: 3px 0; color: #14263a; font-size: 2.25rem; }
.kpi-card small { color: #53677b; font-size: .75rem; }
.kpi-card .kpi-open { margin-top: 7px; color: var(--kpi-accent); font-size: .72rem; }
.kpi-card-link:hover {
  transform: translateY(-2px);
  border-color: var(--kpi-accent);
  box-shadow: 0 5px 15px rgba(16, 42, 67, .08);
}

.dashboard-panel { padding: 22px; border-radius: 11px; box-shadow: none; }
.panel-heading h3 { color: #182b42; font-size: 1.08rem; }
.panel-kicker { color: #68798c; font-size: .68rem; }
.panel-heading > a { font-size: .78rem; }
.live-chip { color: #0f6846; background: #e2f4eb; font-size: .68rem; }
.bar-value, .bar-label { color: #55687d; font-size: .72rem; }
.bar-fill { background: #1769c2; box-shadow: none; }
.status-donut { box-shadow: none; }
.status-donut strong { font-size: 2rem; }
.status-donut span, .donut-legend > span { color: #5f7185; font-size: .76rem; }
.donut-legend strong { color: #1e3249; font-size: .82rem; }
.status-row > div:first-child { color: #53667b; font-size: .8rem; }
.status-track span { background: #1769c2; }

.dashboard-view-tab { border-radius: 10px; box-shadow: none; }
.dashboard-view-tab.active { border-color: #6fa3d2; background: #eef6fd; box-shadow: inset 0 -3px #1769c2; }
.dashboard-view-tab small { color: #586b80; font-size: .75rem; }
.dashboard-view-tab strong { color: #182e47; font-size: 1.38rem; }
.dashboard-tab-icon { border-radius: 9px; }
.dashboard-list-badge, .follow-up-hint { font-size: .75rem; }
.dashboard-tracking-table td > small { color: #65778a; }
.tracking-subject strong, .responsible-name { color: #1b334d; }
.responsible-name { font-size: .9rem; }
.deadline-date { color: #334e68; font-size: .78rem; }
.deadline-state { font-size: .7rem; }
.recent-row { padding-block: 15px; }
.recent-no { font-size: .78rem; }
.recent-subject strong { color: #1d3047; font-size: .9rem; }
.recent-subject small, .recent-date { color: #647589; font-size: .74rem; }

.attachment-row { border-radius: 9px; background: #fff; }
.attachment-file-icon { border-radius: 9px; }
.attachment-copy a, .attachment-copy strong { font-size: .92rem; }
.attachment-copy small, .file-state { font-size: .75rem; }
.print-document { border-radius: 11px; box-shadow: none; }
.auth-page, .setup-page { background: #eef2f6; }
.auth-page .panel, .setup-box { border-radius: 14px; box-shadow: 0 7px 24px rgba(16, 42, 67, .1); }
.auth-page .panel::before { background: #1769c2; }

/* Visible keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(23, 105, 194, .32);
  outline-offset: 2px;
}

/* LED / Full HD tuning */
@media (min-width: 1600px) {
  body { font-size: 18px; }
  .app-topbar { min-height: 84px; }
  .topbar-title strong { font-size: 1.08rem; }
  .sidebar-link { font-size: .96rem; }
  .dashboard-heading h2 { font-size: 2.08rem; }
  th { font-size: .82rem; }
  td { font-size: .92rem; }
  .registry-table-wrap td { padding-block: 17px; }
}

@media (max-width: 900px) {
  html { font-size: 16px; }
  body { font-size: 1rem; }
  .app-topbar { min-height: 72px; }
}

@media (max-width: 680px) {
  .app-page .container { width: min(100% - 22px, 1640px); }
  .panel { padding: 18px; }
  .command-hero { padding: 26px 22px; }
  .kpi-card { min-height: 0; padding: 16px; }
  .kpi-card strong { font-size: 2rem; }
  th, td { padding: 13px 12px; }
}

@media print {
  html, body { font-size: 14px; }
  .panel, .card, .table-wrap, .dashboard-panel { box-shadow: none !important; }
}

/* ================================================================
   V13.1 · CLICKABLE LED DETAIL VIEW
   ================================================================ */
body.led-modal-open { overflow: hidden; }
.led-drilldown {
  margin: 0;
  appearance: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.led-kpis > .led-drilldown {
  min-width: 0;
  padding: clamp(18px, 1.8vw, 32px);
  border: 1px solid rgba(147, 197, 253, .3);
  border-top: 6px solid #3b82f6;
  border-radius: 16px;
  background: rgba(15, 39, 71, .88);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.led-kpis > .led-drilldown.amber { border-top-color: #f59e0b; }
.led-kpis > .led-drilldown.green { border-top-color: #22c55e; }
.led-kpis > .led-drilldown.red { border-top-color: #ef4444; }
.led-kpis > .led-drilldown small {
  display: block;
  margin-top: 15px;
  color: #93c5fd;
  font-size: clamp(13px, .9vw, 17px);
  font-weight: 700;
  letter-spacing: 0;
}
.led-kpis > .led-drilldown:hover,
.led-kpis > .led-drilldown:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, .72);
  background: #16365c;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .28);
}
.led-status-list > .led-drilldown,
.led-followup > .led-drilldown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  min-height: 72px;
  padding: 13px 16px;
  border-left: 5px solid #60a5fa;
  background: #102a43;
  transition: background .16s ease, transform .16s ease;
}
.led-followup > .led-drilldown.red { border-left-color: #ef4444; }
.led-status-list > .led-drilldown:hover,
.led-status-list > .led-drilldown:focus-visible,
.led-followup > .led-drilldown:hover,
.led-followup > .led-drilldown:focus-visible {
  transform: translateX(4px);
  background: #19446d;
}
.led-drilldown:focus-visible {
  outline: 4px solid #facc15;
  outline-offset: 3px;
}

.led-detail-overlay[hidden] { display: none; }
.led-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: clamp(14px, 1.7vw, 32px);
  background: rgba(1, 8, 18, .93);
  backdrop-filter: blur(8px);
}
.led-detail-dialog {
  display: flex;
  flex-direction: column;
  width: min(1820px, 100%);
  height: min(970px, calc(100vh - clamp(28px, 3.4vw, 64px)));
  overflow: hidden;
  border: 2px solid rgba(147, 197, 253, .38);
  border-radius: 20px;
  background: #071a2e;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .52);
}
.led-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 1.8vw, 32px);
  border-bottom: 1px solid rgba(147, 197, 253, .24);
  background: #0b2745;
}
.led-detail-header > div > span {
  color: #60a5fa;
  font-size: clamp(14px, 1vw, 18px);
  font-weight: 800;
  letter-spacing: .12em;
}
.led-detail-header h2 {
  margin: 3px 0 0;
  color: #fff;
  font-size: clamp(30px, 2.5vw, 48px);
}
.led-detail-header p {
  margin: 4px 0 0;
  color: #bfdbfe;
  font-size: clamp(17px, 1.2vw, 23px);
  font-weight: 700;
}
.led-detail-close {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 62px;
  padding: 10px 22px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-radius: 12px;
  background: #fff;
  color: #0b2745;
  font: inherit;
  font-size: clamp(24px, 1.7vw, 32px);
  font-weight: 900;
  cursor: pointer;
}
.led-detail-close span { font-size: clamp(18px, 1.15vw, 22px); letter-spacing: 0; }
.led-detail-close:hover,
.led-detail-close:focus-visible { background: #facc15; border-color: #facc15; outline: 4px solid rgba(250, 204, 21, .34); outline-offset: 3px; }
.led-detail-columns,
.led-detail-row {
  display: grid;
  grid-template-columns: 90px minmax(360px, 1fr) minmax(250px, 330px) minmax(230px, 300px);
  align-items: center;
  gap: clamp(14px, 1.4vw, 26px);
}
.led-detail-columns.has-edit,
.led-detail-row.has-edit {
  grid-template-columns: 80px minmax(320px, 1fr) minmax(220px, 300px) minmax(210px, 275px) minmax(120px, 150px);
}
.led-detail-columns {
  padding: 14px clamp(20px, 1.7vw, 30px);
  border-bottom: 1px solid rgba(147, 197, 253, .18);
  background: #0e2138;
  color: #93c5fd;
  font-size: clamp(14px, 1vw, 19px);
  font-weight: 800;
}
.led-detail-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #3b82f6 #0b1d32;
}
.led-detail-row {
  min-height: 114px;
  padding: 17px clamp(20px, 1.7vw, 30px);
  border-bottom: 1px solid rgba(147, 197, 253, .14);
  background: #071a2e;
}
.led-detail-row:nth-child(even) { background: #0a2038; }
.led-detail-number {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: #174a7e;
  color: #fff;
  font-size: clamp(20px, 1.4vw, 27px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.led-detail-subject,
.led-detail-owner,
.led-detail-state { min-width: 0; }
.led-detail-manage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.led-detail-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 52px;
  padding: 10px 18px;
  border: 2px solid #60a5fa;
  border-radius: 12px;
  background: #1769c2;
  color: #fff;
  font-size: clamp(17px, 1.05vw, 21px);
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.led-detail-edit:hover,
.led-detail-edit:focus-visible {
  transform: translateY(-2px);
  border-color: #facc15;
  background: #2581dd;
  color: #fff;
  outline: 4px solid rgba(250, 204, 21, .3);
  outline-offset: 2px;
}
.led-detail-subject strong,
.led-detail-owner strong {
  display: block;
  color: #fff;
  font-size: clamp(20px, 1.45vw, 28px);
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.led-detail-subject small,
.led-detail-owner small,
.led-detail-state small {
  display: block;
  margin-top: 5px;
  color: #93c5fd;
  font-size: clamp(14px, .95vw, 18px);
  font-weight: 700;
  letter-spacing: 0;
}
.led-detail-owner strong { color: #dbeafe; }
.led-detail-state > span {
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid rgba(96, 165, 250, .55);
  border-radius: 999px;
  background: #10385f;
  color: #fff;
  font-size: clamp(14px, .95vw, 18px);
  font-weight: 800;
  letter-spacing: 0;
}
.led-detail-message {
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 40px;
  color: #dbeafe;
  font-size: clamp(24px, 2vw, 38px);
  font-weight: 800;
  text-align: center;
}
.led-detail-message.error { color: #fecaca; }
.led-detail-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: 82px;
  padding: 12px 24px;
  border-top: 1px solid rgba(147, 197, 253, .24);
  background: #0b2745;
  color: #bfdbfe;
  font-size: clamp(15px, 1vw, 19px);
  font-weight: 700;
}
.led-load-more {
  min-height: 52px;
  padding: 10px 24px;
  border: 2px solid #60a5fa;
  border-radius: 10px;
  background: #1769c2;
  color: #fff;
  font: inherit;
  font-size: clamp(16px, 1.05vw, 20px);
  font-weight: 800;
  cursor: pointer;
}
.led-load-more:hover,
.led-load-more:focus-visible { background: #2581dd; outline: 4px solid rgba(96, 165, 250, .32); outline-offset: 2px; }

@media (max-width: 1100px) {
  .led-detail-columns { display: none; }
  .led-detail-row,
  .led-detail-row.has-edit { grid-template-columns: 64px minmax(0, 1fr); }
  .led-detail-owner,
  .led-detail-state,
  .led-detail-manage { grid-column: 2; }
  .led-detail-manage { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .led-detail-overlay { padding: 0; }
  .led-detail-dialog { width: 100%; height: 100vh; border: 0; border-radius: 0; }
  .led-detail-header { align-items: flex-start; }
  .led-detail-close { min-height: 52px; padding: 7px 13px; }
  .led-detail-close span { display: none; }
  .led-detail-row,
  .led-detail-row.has-edit { grid-template-columns: 48px minmax(0, 1fr); min-height: 0; padding: 16px; }
  .led-detail-number { width: 42px; height: 42px; font-size: 17px; }
  .led-detail-edit { min-width: 100px; min-height: 46px; font-size: 17px; }
  .led-detail-actions { flex-direction: column; gap: 8px; min-height: 96px; }
}
