html { font-size: 14px; position: relative; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 15px; } }
body { margin-bottom: 60px; background: #f5f6f8; }
.footer { position: absolute; bottom: 0; width: 100%; white-space: nowrap; line-height: 50px; }

.card { border: 1px solid #e3e6ea; }
.card-header { background: #fff; font-weight: 600; }
.stat { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.table > :not(caption) > * > * { vertical-align: middle; }
.table-hover tbody tr:hover { background: #eef4ff; }
.sticky-side { position: sticky; top: 12px; }

/* Rendered rich text (tickets, logs, articles) */
.rich { line-height: 1.55; overflow-wrap: anywhere; }
.rich img { max-width: 100%; height: auto; }
.rich table { border-collapse: collapse; margin: .5rem 0; max-width: 100%; }
.rich td, .rich th { border: 1px solid #ccc; padding: 4px 8px; }
.rich th { background: #f0f2f5; }
.rich pre { background: #f5f5f5; border: 1px solid #e1e4e8; padding: 10px; border-radius: 4px; overflow: auto; }
.rich blockquote { border-left: 4px solid #cfd6df; margin-left: 0; padding-left: 12px; color: #555; }

/* Ticket log timeline */
.timeline { border-left: 3px solid #d5dbe3; margin-left: 8px; padding-left: 18px; }
.log-entry { position: relative; margin-bottom: 1rem; }
.log-entry::before { content: ""; position: absolute; left: -26px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: #0d6efd; border: 2px solid #fff; }
.log-entry.internal::before { background: #f0ad00; }
.log-entry.resolution::before { background: #198754; }
.log-entry.status::before { background: #8a94a3; }

.priority-Urgent { color: #dc3545; font-weight: 600; }
.priority-High { color: #fd7e14; font-weight: 600; }
.mono { font-family: Consolas, "Courier New", monospace; }
.pw-box { font-family: Consolas, monospace; background: #fff8e1; border: 1px dashed #d4a800; padding: 2px 8px; border-radius: 4px; }

@media print {
  .navbar, footer, .btn, form[method="get"], .alert { display: none !important; }
  body { background: #fff; margin: 0; }
  .card { border: 0; box-shadow: none; }
  .container-fluid { padding: 0 !important; }
}


/* ---- Page title icons: the first heading of each page gets a small icon chosen by section (see body[data-icon] in _Layout and site.js) ---- */
.page-title::before {
  content: ""; display: inline-block; width: 1.1em; height: 1.1em; margin-right: .45em; vertical-align: -.14em;
  background-color: var(--page-icon-color, #b58a3c);
  -webkit-mask: var(--page-icon) center / contain no-repeat; mask: var(--page-icon) center / contain no-repeat;
}
body[data-icon="home"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-8 9 8'/%3E%3Cpath d='M5 10v10h5v-6h4v6h5V10'/%3E%3C/svg%3E"); }
body[data-icon="tickets"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9V6a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v3a3 3 0 0 0 0 6v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-3a3 3 0 0 0 0-6z'/%3E%3Cpath d='M14 6v2M14 11v2M14 16v2'/%3E%3C/svg%3E"); }
body[data-icon="recurring"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 2l4 4-4 4'/%3E%3Cpath d='M3 11V9a3 3 0 0 1 3-3h15'/%3E%3Cpath d='M7 22l-4-4 4-4'/%3E%3Cpath d='M21 13v2a3 3 0 0 1-3 3H3'/%3E%3C/svg%3E"); }
body[data-icon="templates"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/%3E%3Cpath d='M14 3v6h6'/%3E%3Cpath d='M8 13h8M8 17h6'/%3E%3C/svg%3E"); }
body[data-icon="knowledge"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5a2 2 0 0 1 2-2h14v15H6a2 2 0 0 0-2 2z'/%3E%3Cpath d='M4 20a2 2 0 0 0 2 2h14v-4'/%3E%3Cpath d='M9 8h7'/%3E%3C/svg%3E"); }
body[data-icon="private"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3Cpath d='M12 15v2'/%3E%3C/svg%3E"); }
body[data-icon="licenses"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M11 12l9-9'/%3E%3Cpath d='M16 7l3 3'/%3E%3Cpath d='M14 9l2 2'/%3E%3C/svg%3E"); }
body[data-icon="clients"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2 21v-1a6 6 0 0 1 6-6h2a6 6 0 0 1 6 6v1'/%3E%3Cpath d='M16 4.6a3.5 3.5 0 0 1 0 6.8'/%3E%3Cpath d='M19 14.6a6 6 0 0 1 3 5.4v1'/%3E%3C/svg%3E"); }
body[data-icon="credentials"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E"); }
body[data-icon="products"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8l-9-5-9 5v8l9 5 9-5z'/%3E%3Cpath d='M3 8l9 5 9-5'/%3E%3Cpath d='M12 13v8'/%3E%3C/svg%3E"); }
body[data-icon="orders"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7h14l-1 13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1z'/%3E%3Cpath d='M9 7V6a3 3 0 0 1 6 0v1'/%3E%3C/svg%3E"); }
body[data-icon="categories"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12V4h8l10 10-8 8z'/%3E%3Ccircle cx='7.5' cy='8.5' r='1.2'/%3E%3C/svg%3E"); }
body[data-icon="sla"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
body[data-icon="reports"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20V4'/%3E%3Cpath d='M4 20h17'/%3E%3Crect x='8' y='11' width='3' height='6'/%3E%3Crect x='13' y='7' width='3' height='10'/%3E%3Crect x='18' y='13' width='2' height='4'/%3E%3C/svg%3E"); }
body[data-icon="users"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1'/%3E%3C/svg%3E"); }
body[data-icon="roles"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h8M18 6h2M4 12h2M12 12h8M4 18h10M20 18h0'/%3E%3Ccircle cx='15' cy='6' r='2'/%3E%3Ccircle cx='9' cy='12' r='2'/%3E%3Ccircle cx='17' cy='18' r='2'/%3E%3C/svg%3E"); }
body[data-icon="audit"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2'/%3E%3Cpath d='M9 4V3h6v1'/%3E%3Cpath d='M9 10h6M9 14h6M9 18h3'/%3E%3C/svg%3E"); }
body[data-icon="notifications"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 16v-5a6 6 0 0 1 12 0v5l2 2H4z'/%3E%3Cpath d='M10 21a2 2 0 0 0 4 0'/%3E%3C/svg%3E"); }
body[data-icon="search"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-5-5'/%3E%3C/svg%3E"); }
body[data-icon="settings"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9L7 7M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1'/%3E%3C/svg%3E"); }
body[data-icon="shop"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9l1.5-5h13L20 9'/%3E%3Cpath d='M4 9a2.5 2.5 0 0 0 5 0 2.5 2.5 0 0 0 6 0 2.5 2.5 0 0 0 5 0'/%3E%3Cpath d='M5 12v8h14v-8'/%3E%3C/svg%3E"); }
body[data-icon="cart"] { --page-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1.5'/%3E%3Ccircle cx='18' cy='20' r='1.5'/%3E%3Cpath d='M2 3h3l2.5 12h11l2-8H6'/%3E%3C/svg%3E"); }

/* Roles & Access matrix */
.access-matrix select { min-width: 8.5rem; }
.access-matrix select.level-none { background-color: #f1f3f5; color: #6c757d; }
.access-matrix select.level-view { background-color: #e8f1ff; }
.access-matrix select.level-contribute { background-color: #e6f6ec; }
.access-matrix select.level-edit { background-color: #fff4d6; }
.access-matrix select.level-manage { background-color: #fde8e8; }
.navbar-brand img { border-radius: 7px; }
.navbar-dark .navbar-nav .nav-link.active { color: #fff; font-weight: 600; }
