/* =====================================================================
   ComDoc – visual system
   Navy ink + marigold brand, teal = active, slate = closed, brick = urgent.
   One family (Public Sans) with tabular numerals for ticket numbers.
   The ticket timeline is the signature element; everything else stays quiet.
   ===================================================================== */

:root,
[data-bs-theme="light"] {
  --cd-ink: #16233a;
  --cd-ink-2: #22334f;
  --cd-primary: #1e4e8c;
  --cd-primary-hover: #173f73;
  --cd-marigold: #e3a21a;
  --cd-active: #0e7c6b;
  --cd-active-bg: #e3f4f0;
  --cd-closed: #5f6b7d;
  --cd-closed-bg: #eceff3;
  --cd-urgent: #b8321f;
  --cd-urgent-bg: #fbe9e6;
  --cd-followup: #7a4fb5;
  --cd-bg: #f2f4f7;
  --cd-surface: #ffffff;
  --cd-surface-2: #f7f8fa;
  --cd-border: #e1e5eb;
  --cd-text: #1b2230;
  --cd-muted: #5d6778;
  --cd-shadow: 0 1px 2px rgba(22, 35, 58, .06), 0 4px 14px rgba(22, 35, 58, .05);

  --bs-body-font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-bg: var(--cd-bg);
  --bs-body-color: var(--cd-text);
  --bs-primary: var(--cd-primary);
  --bs-primary-rgb: 30, 78, 140;
  --bs-link-color: var(--cd-primary);
  --bs-link-color-rgb: 30, 78, 140;
  --bs-link-hover-color: var(--cd-primary-hover);
  --bs-border-color: var(--cd-border);
  --bs-secondary-color: var(--cd-muted);
  --bs-border-radius: .5rem;
  --bs-border-radius-lg: .75rem;
}

[data-bs-theme="dark"] {
  --cd-ink: #0a111c;
  --cd-ink-2: #15213a;
  --cd-primary: #6ea3e6;
  --cd-primary-hover: #8db8ee;
  --cd-active: #3cc4a8;
  --cd-active-bg: rgba(60, 196, 168, .14);
  --cd-closed: #a3adbd;
  --cd-closed-bg: rgba(163, 173, 189, .14);
  --cd-urgent: #f07a66;
  --cd-urgent-bg: rgba(240, 122, 102, .15);
  --cd-followup: #b597e3;
  --cd-bg: #0e1522;
  --cd-surface: #152031;
  --cd-surface-2: #1a2639;
  --cd-border: #273550;
  --cd-text: #e4e9f1;
  --cd-muted: #98a3b6;
  --cd-shadow: 0 1px 2px rgba(0, 0, 0, .3);

  --bs-body-bg: var(--cd-bg);
  --bs-body-color: var(--cd-text);
  --bs-primary-rgb: 110, 163, 230;
  --bs-link-color: var(--cd-primary);
  --bs-link-color-rgb: 110, 163, 230;
  --bs-link-hover-color: var(--cd-primary-hover);
  --bs-border-color: var(--cd-border);
  --bs-secondary-color: var(--cd-muted);
  --bs-tertiary-bg: var(--cd-surface-2);
}

body { font-size: .9375rem; -webkit-font-smoothing: antialiased; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--cd-marigold); outline-offset: 2px; }
.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 2000; background: var(--cd-surface); padding: .5rem 1rem; border-radius: .5rem; }

/* ---------- Buttons ---------------------------------------------------- */
.btn { --bs-btn-font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-lg { --bs-btn-padding-y: .7rem; font-size: 1rem; }
.btn-primary {
  --bs-btn-bg: var(--cd-primary); --bs-btn-border-color: var(--cd-primary);
  --bs-btn-hover-bg: var(--cd-primary-hover); --bs-btn-hover-border-color: var(--cd-primary-hover);
  --bs-btn-active-bg: var(--cd-primary-hover); --bs-btn-disabled-bg: var(--cd-primary); --bs-btn-disabled-border-color: var(--cd-primary);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0b1320; --bs-btn-hover-color: #0b1320; --bs-btn-active-color: #0b1320; }
.btn-outline-primary {
  --bs-btn-color: var(--cd-primary); --bs-btn-border-color: var(--cd-primary);
  --bs-btn-hover-bg: var(--cd-primary); --bs-btn-hover-border-color: var(--cd-primary); --bs-btn-active-bg: var(--cd-primary);
}
.btn-whatsapp { --bs-btn-color: #fff; --bs-btn-bg: #1f9d55; --bs-btn-border-color: #1f9d55; --bs-btn-hover-bg: #178046; --bs-btn-hover-color: #fff; --bs-btn-padding-y: .2rem; --bs-btn-font-size: .8125rem; }
.btn-icon { width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 50%; color: inherit; font-size: 1.2rem; }
.btn-icon:hover { background: rgba(127, 140, 160, .15); }
.contact-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.contact-actions .btn { --bs-btn-padding-y: .2rem; --bs-btn-font-size: .8125rem; }

/* ---------- Shell ------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { flex: 1; width: 100%; max-width: 1320px; padding: 1.25rem 1rem 6rem; margin: 0 auto; }
.app-footer { font-size: .75rem; color: var(--cd-muted); text-align: center; padding: 1rem 1rem 1.5rem; }

.sidebar {
  --bs-offcanvas-width: 272px;
  --bs-offcanvas-bg: var(--cd-ink);
  --bs-offcanvas-color: #dbe3ef;
  background: var(--cd-ink); color: #dbe3ef;
  display: flex; flex-direction: column;
}
/* Bootstrap makes .offcanvas-lg transparent on large screens, which put the light
   sidebar text on the light page background in light mode. Keep it navy in both themes. */
.sidebar.offcanvas-lg { background-color: var(--cd-ink) !important; color: #dbe3ef; overflow: hidden; }
/* The brand (top) and the user block (bottom) stay put; the menu between them scrolls
   whenever it is taller than the screen – on desktop and in the mobile slide-out menu. */
.sidebar-head, .sidebar-foot { flex-shrink: 0; }
.sidebar .sidebar-nav {
  position: relative; flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .28) transparent;
}
.sidebar .sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .28); border-radius: 3px; }
.sidebar .sidebar-nav::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { height: 100vh; height: 100dvh; }
}
@media (min-width: 992px) {
  .sidebar { width: 264px; flex: 0 0 264px; position: sticky; top: 0; align-self: flex-start; height: 100vh; height: 100dvh; }
  .page { padding: 1.5rem 2rem 3rem; }
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.25rem 1rem; }
.sidebar .brand { color: #fff; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; text-decoration: none; color: inherit; letter-spacing: -.01em; }
.brand small { display: block; font-size: .72rem; font-weight: 400; color: #8f9cb3; letter-spacing: 0; }
.brand-mark {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: .55rem;
  background: var(--cd-marigold); color: var(--cd-ink); font-weight: 700; font-size: 1.05rem; flex: none;
}
.brand-mark-lg { width: 3.25rem; height: 3.25rem; font-size: 1.7rem; border-radius: .8rem; }

.sidebar-nav { padding: 0 .75rem 1rem; flex: 1; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: .5rem;
  color: #dbe3ef; text-decoration: none; font-weight: 500; background: none; border: 0; min-height: 44px;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: .85; }
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link:focus-visible { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--cd-ink-2); color: #fff; box-shadow: inset 3px 0 0 var(--cd-marigold); }
.nav-group { margin: 1.1rem .75rem .35rem; font-size: .75rem; color: #a3b0c6; font-weight: 600; }
.nav-count { margin-left: auto; background: var(--cd-marigold); color: var(--cd-ink); border-radius: 1rem; font-size: .72rem; font-weight: 700; padding: 0 .5rem; }
.nav-cta {
  display: flex; align-items: center; justify-content: center; gap: .5rem; margin: .75rem 0 .25rem;
  padding: .7rem; border-radius: .6rem; background: var(--cd-marigold); color: var(--cd-ink); font-weight: 700; text-decoration: none;
}
.nav-cta:hover { background: #f0b53a; color: var(--cd-ink); }
.sidebar-foot { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; color: #fff; min-width: 0; }
.sidebar-foot small { color: #a3b0c6; }
.sidebar .brand small { color: #a3b0c6; }

.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .25rem;
  padding: .4rem .5rem; padding-top: max(.4rem, env(safe-area-inset-top));
  background: var(--cd-ink); color: #fff;
}
.topbar .brand { color: #fff; font-size: 1.05rem; }
.topbar .brand-mark { width: 1.75rem; height: 1.75rem; font-size: .95rem; }
.topbar-actions { margin-left: auto; display: flex; }
.topbar .btn-icon, .topbar .btn-icon:hover, .topbar .btn-icon:focus, .topbar .btn-icon:active { color: #fff; }
.desktop-bar { position: sticky; top: 0; z-index: 1010; align-items: center; justify-content: space-between; padding: .75rem 2rem; background: color-mix(in srgb, var(--cd-bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--cd-border); }
.desktop-bar-title { font-weight: 600; color: var(--cd-muted); }
.user-chip { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; padding: .25rem .6rem .25rem .25rem; border-radius: 2rem; font-size: .85rem; }
.user-chip:hover { background: rgba(127, 140, 160, .12); }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 1.1rem; height: 1.1rem; padding: 0 .25rem; border-radius: 1rem; background: var(--cd-urgent); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; }

.avatar { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--cd-ink-2); color: #fff; font-weight: 600; font-size: .85rem; flex: none; }
.avatar-sm { width: 2rem; height: 2rem; font-size: .72rem; }
[data-bs-theme="light"] .app-main .avatar { background: #dfe6f1; color: var(--cd-ink); }

.fab {
  position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 1030;
  width: 3.5rem; height: 3.5rem; border-radius: 1rem; display: grid; place-items: center;
  background: var(--cd-marigold); color: var(--cd-ink); font-size: 1.6rem; box-shadow: 0 6px 18px rgba(22, 35, 58, .3);
}

/* ---------- Page scaffolding ------------------------------------------ */
.page-head, .greeting { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-title { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); font-weight: 700; letter-spacing: -.02em; margin: 0 0 .15rem; }
.panel { background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: .75rem; padding: 1.1rem; margin-bottom: 1.25rem; box-shadow: var(--cd-shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; }
.panel-head h2, .panel-title { font-size: 1rem; font-weight: 700; margin: 0 0 .85rem; }
.panel-head h2 { margin: 0; }
.panel-head a { font-size: .85rem; font-weight: 600; text-decoration: none; }
.form-panel { padding: 1.25rem; }
@media (min-width: 768px) { .form-panel { padding: 1.75rem; } }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--cd-border); }
.form-label { font-weight: 600; font-size: .875rem; }
.form-control, .form-select { background-color: var(--cd-surface); }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 1rem; }
.crumbs { margin-bottom: .75rem; font-size: .875rem; }
.crumbs a { text-decoration: none; font-weight: 600; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--cd-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .6; }

/* ---------- Stats ------------------------------------------------------ */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } .stat-grid-5 { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1200px) { .stat-grid-6 { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 768px) and (max-width: 1199.98px) { .stat-grid-6 { grid-template-columns: repeat(3, 1fr); } }
.stat-tile {
  position: relative; display: flex; flex-direction: column; gap: .1rem; padding: 1rem 1.1rem;
  background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: .75rem; text-decoration: none; color: inherit;
  border-top: 3px solid var(--cd-border);
}
a.stat-tile:hover { border-color: var(--cd-primary); }
.stat-icon { position: absolute; right: .9rem; top: .85rem; color: var(--cd-muted); font-size: 1.1rem; }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-value-sm { font-size: 1.35rem; padding: .3rem 0; }
.stat-label { font-size: .8125rem; color: var(--cd-muted); font-weight: 500; }
.tone-active { border-top-color: var(--cd-active); } .tone-active .stat-value { color: var(--cd-active); }
.tone-closed { border-top-color: var(--cd-closed); }
.tone-urgent { border-top-color: var(--cd-urgent); } .tone-urgent .stat-value { color: var(--cd-urgent); }
.tone-pending { border-top-color: var(--cd-marigold); }

.chart-grid { display: grid; gap: 0 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .chart-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1200px) { .chart-grid { grid-template-columns: 1fr 1fr 2fr; } .chart-grid .chart-wide:last-child { grid-column: 1 / -1; } }
.chart-box { position: relative; height: 260px; }
.chart-box-sm { height: 220px; }

.dept-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.dept-chip { padding: .45rem .8rem; border: 1px solid var(--cd-border); border-radius: 2rem; text-decoration: none; color: inherit; font-size: .875rem; background: var(--cd-surface-2); }
.dept-chip:hover { border-color: var(--cd-primary); }
.dept-chip strong { color: var(--cd-primary); margin-right: .2rem; }

/* ---------- Badges ------------------------------------------------------- */
.badge { font-weight: 600; letter-spacing: .01em; }
.badge-status, .badge-urgent, .badge-cat { display: inline-flex; align-items: center; gap: .3rem; padding: .35em .6em; border-radius: 2rem; font-size: .75rem; }
.badge-status i { font-size: .55rem; }
.badge-active { background: var(--cd-active-bg); color: var(--cd-active); }
.badge-active i.bi-circle-fill { animation: none; }
.badge-closed { background: var(--cd-closed-bg); color: var(--cd-closed); }
.badge-closed i { font-size: .8rem; }
.badge-urgent { background: var(--cd-urgent); color: #fff; }
.badge-cat { background: transparent; color: var(--cd-muted); border: 1px solid var(--cd-border); }
.text-urgent { color: var(--cd-urgent); }
.new-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--cd-marigold); vertical-align: middle; flex: none; }

/* ---------- Ticket list ---------------------------------------------- */
.ticket-no { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--cd-primary); text-decoration: none; letter-spacing: .01em; }
.ticket-table { --bs-table-bg: transparent; font-size: .875rem; }
.ticket-table thead th { font-size: .75rem; font-weight: 600; color: var(--cd-muted); background: var(--cd-surface-2); border-bottom-width: 1px; white-space: nowrap; padding: .7rem .75rem; }
.ticket-table td { padding: .7rem .75rem; border-color: var(--cd-border); }
.ticket-table tbody tr:hover { background: var(--cd-surface-2); }
.ticket-table .row-urgent td:first-child { box-shadow: inset 3px 0 0 var(--cd-urgent); }
.cell-heading { max-width: 280px; }
.cell-heading a { color: inherit; text-decoration: none; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cell-heading a:hover { color: var(--cd-primary); }

.ticket-cards { display: flex; flex-direction: column; gap: .6rem; padding: .75rem; }
.panel:not(.p-0) .ticket-cards { padding: 0; }
.ticket-card { display: block; padding: .9rem 1rem; border: 1px solid var(--cd-border); border-radius: .7rem; background: var(--cd-surface); color: inherit; text-decoration: none; }
.ticket-card:active { background: var(--cd-surface-2); }
.ticket-card.is-urgent { border-left: 4px solid var(--cd-urgent); }
.ticket-card-title { font-size: 1rem; font-weight: 600; margin: .4rem 0 .5rem; line-height: 1.35; }
.ticket-card-meta { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: center; font-size: .8125rem; color: var(--cd-muted); }
.ticket-card-foot { display: flex; justify-content: space-between; gap: .5rem; margin-top: .6rem; padding-top: .55rem; border-top: 1px dashed var(--cd-border); font-size: .78rem; color: var(--cd-muted); }

.filter-bar { background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: .75rem; padding: .75rem; margin-bottom: 1rem; }
.search-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.search-row .input-group { flex: 1 1 260px; }
.status-select { width: auto; flex: 0 0 auto; }
.range-pills { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---------- Generic list rows (users, departments, notifications) -------- */
.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; border-bottom: 1px solid var(--cd-border); color: inherit; text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
.list-row.is-muted { opacity: .6; }
.list-main { flex: 1; min-width: 0; }
.list-side { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
.dept-code { min-width: 3.5rem; padding: .35rem .5rem; border-radius: .45rem; background: var(--cd-surface-2); border: 1px solid var(--cd-border); font-weight: 700; font-size: .8rem; text-align: center; color: var(--cd-primary); }
.notif-row.is-unread { background: color-mix(in srgb, var(--cd-marigold) 8%, var(--cd-surface)); }
.notif-row:hover { background: var(--cd-surface-2); }
.notif-icon { width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; background: var(--cd-surface-2); color: var(--cd-primary); flex: none; }
.check-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.check-card { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem .8rem; border: 1px solid var(--cd-border); border-radius: .6rem; cursor: pointer; font-size: .875rem; }
.check-card:has(input:checked) { border-color: var(--cd-primary); background: color-mix(in srgb, var(--cd-primary) 6%, var(--cd-surface)); }

/* ---------- New complaint form ------------------------------------------- */
.choice-group { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.choice { display: flex; align-items: flex-start; gap: .6rem; text-align: left; padding: .75rem; border: 1px solid var(--cd-border); border-radius: .6rem; font-weight: 600; background: var(--cd-surface); height: 100%; justify-content: flex-start; }
.choice i { font-size: 1.3rem; color: var(--cd-muted); }
.choice small { display: block; font-weight: 400; font-size: .75rem; color: var(--cd-muted); margin-top: .15rem; }
.btn-check:checked + .choice { border-color: var(--cd-primary); background: color-mix(in srgb, var(--cd-primary) 8%, var(--cd-surface)); color: inherit; box-shadow: inset 0 0 0 1px var(--cd-primary); }
.btn-check:checked + .choice i { color: var(--cd-primary); }
.btn-check:focus-visible + .choice { outline: 3px solid var(--cd-marigold); }
@media (max-width: 575.98px) { .choice-group { grid-template-columns: 1fr; } }
.photo-preview { display: flex; align-items: center; gap: .75rem; margin-top: .6rem; }
.photo-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: .5rem; border: 1px solid var(--cd-border); }

/* ---------- Ticket detail ---------------------------------------------- */
.ticket-head { background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: .75rem; padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; border-left: 5px solid var(--cd-primary); box-shadow: var(--cd-shadow); }
.ticket-head.is-urgent { border-left-color: var(--cd-urgent); }
.ticket-head-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.ticket-no-lg { font-size: .95rem; }
.ticket-title { font-size: clamp(1.25rem, 1rem + 1.2vw, 1.7rem); font-weight: 700; letter-spacing: -.02em; margin: .5rem 0 .25rem; line-height: 1.25; }
.ticket-sub { color: var(--cd-muted); margin: 0; font-size: .875rem; }

.ticket-layout { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 992px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .ticket-side { order: 2; position: sticky; top: 4.5rem; align-self: start; max-height: calc(100vh - 5.5rem); overflow-y: auto; }
  .ticket-main { order: 1; }
}
.info-list { margin: 0; }
.info-list > div { display: grid; grid-template-columns: 7.5rem 1fr; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--cd-border); font-size: .875rem; }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt { font-weight: 500; color: var(--cd-muted); }
.info-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.photo-thumb { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: .6rem; overflow: hidden; cursor: zoom-in; }
.photo-thumb img { width: 100%; height: auto; max-height: 280px; object-fit: cover; display: block; }

/* ---------- Timeline (signature element) ------------------------------ */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; position: relative; }
.timeline::before { content: ""; position: absolute; left: 1.1rem; top: .5rem; bottom: .5rem; width: 2px; background: var(--cd-border); transform: translateX(-1px); }
.tl-day { position: relative; margin: 1.25rem 0 .9rem -1.1rem; display: flex; align-items: baseline; gap: .5rem; }
.tl-day:first-child { margin-top: 0; }
.tl-day span { position: relative; z-index: 1; background: var(--cd-ink); color: #fff; font-weight: 700; font-size: .8125rem; padding: .3rem .75rem; border-radius: 2rem; font-variant-numeric: tabular-nums; }
[data-bs-theme="dark"] .tl-day span { background: var(--cd-ink-2); }
.tl-day small { color: var(--cd-muted); font-size: .78rem; }
.tl-event { position: relative; padding-left: 1.6rem; margin-bottom: .85rem; }
.tl-node {
  position: absolute; left: -.95rem; top: .8rem; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; color: #fff; background: var(--cd-primary);
  box-shadow: 0 0 0 4px var(--cd-bg);
}
.ev-created .tl-node { background: var(--cd-ink); } [data-bs-theme="dark"] .ev-created .tl-node { background: var(--cd-marigold); color: var(--cd-ink); }
.ev-assigned .tl-node { background: var(--cd-marigold); color: var(--cd-ink); }
.ev-followup .tl-node { background: var(--cd-followup); }
.ev-closed .tl-node { background: var(--cd-active); }
.ev-reopened .tl-node { background: var(--cd-urgent); }
.tl-body { background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: .75rem; padding: .8rem 1rem; box-shadow: var(--cd-shadow); }
.ev-followup .tl-body { border-color: color-mix(in srgb, var(--cd-followup) 45%, var(--cd-border)); }
.ev-reopened .tl-body { border-color: color-mix(in srgb, var(--cd-urgent) 45%, var(--cd-border)); }
.tl-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tl-who { flex: 1; min-width: 0; line-height: 1.3; font-size: .9rem; }
.tl-role { display: inline-block; font-size: .72rem; font-weight: 600; color: var(--cd-muted); background: var(--cd-surface-2); border: 1px solid var(--cd-border); border-radius: 1rem; padding: 0 .45rem; margin-left: .15rem; }
.tl-verb { display: block; font-size: .8125rem; color: var(--cd-muted); }
.tl-time { font-size: .78rem; color: var(--cd-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-contact { display: flex; gap: .25rem; }
.tl-contact a { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--cd-border); text-decoration: none; color: var(--cd-primary); }
.tl-contact a.wa { color: #1f9d55; }
.tl-text { margin: .65rem 0 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.55; }
.tl-label { display: block; font-size: .75rem; font-weight: 700; color: var(--cd-muted); margin-bottom: .1rem; }
.tl-status { margin: .5rem 0 0; font-size: .8125rem; color: var(--cd-muted); }
.tl-complaint { margin-top: .75rem; }
.tl-complaint h3 { font-size: 1rem; font-weight: 700; margin: 0 0 .3rem; }
.tl-complaint p { margin: 0 0 .6rem; overflow-wrap: anywhere; line-height: 1.55; }
.tl-facts { list-style: none; padding: .6rem .75rem; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .35rem .9rem; background: var(--cd-surface-2); border-radius: .5rem; font-size: .8125rem; }
.tl-facts span { display: block; color: var(--cd-muted); font-size: .72rem; font-weight: 600; }
.tl-attach { margin: .6rem 0 0; font-size: .8125rem; color: var(--cd-muted); }
.tl-assignee { margin-top: .65rem; padding: .6rem .75rem; border-radius: .5rem; background: color-mix(in srgb, var(--cd-marigold) 12%, var(--cd-surface)); font-size: .9rem; }

.composer { background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: .75rem; padding: 1rem; margin-top: 1.25rem; box-shadow: var(--cd-shadow); }
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: .6rem; flex-wrap: wrap; }
@media (max-width: 575.98px) {
  .composer-foot .btn { width: 100%; }
  .page { padding-left: .75rem; padding-right: .75rem; }
  .ticket-head { padding: 1rem; }
  .info-list > div { grid-template-columns: 6.5rem 1fr; }
}
.closed-note { margin-top: 1rem; padding: .8rem 1rem; border-radius: .6rem; background: var(--cd-closed-bg); color: var(--cd-closed); font-size: .875rem; }

/* ---------- Reports ------------------------------------------------------ */
.report-table { --bs-table-bg: transparent; font-size: .875rem; }
.report-table th { font-size: .75rem; color: var(--cd-muted); font-weight: 600; }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.audit-table { --bs-table-bg: transparent; }
.audit-table th { font-size: .75rem; color: var(--cd-muted); background: var(--cd-surface-2); }
.audit-details { max-width: 340px; overflow-wrap: anywhere; }

/* ---------- Auth / setup / error pages ------------------------------- */
.auth-page { background: var(--cd-ink); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-wrap { grid-template-columns: 1.1fr 1fr; } }
.auth-intro { color: #dbe3ef; padding: 2.5rem 1.5rem 1.5rem; display: flex; flex-direction: column; justify-content: center; }
@media (min-width: 992px) { .auth-intro { padding: 4rem 5vw; } }
.auth-intro h1 { font-size: clamp(2.2rem, 1.6rem + 3vw, 3.6rem); font-weight: 700; color: #fff; margin: 1rem 0 .25rem; letter-spacing: -.03em; }
.auth-intro p { font-size: 1.05rem; max-width: 30rem; color: #aebad0; }
.auth-points { list-style: none; padding: 0; margin: 1.25rem 0 0; display: none; }
@media (min-width: 992px) { .auth-points { display: block; } }
.auth-points li { display: flex; gap: .7rem; padding: .45rem 0; color: #c7d1e2; }
.auth-points i { color: var(--cd-marigold); }
.auth-card { background: var(--cd-surface); color: var(--cd-text); padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom)); border-radius: 1.25rem 1.25rem 0 0; }
@media (min-width: 992px) { .auth-card { border-radius: 0; padding: 4rem 5vw; display: flex; flex-direction: column; justify-content: center; } .auth-card > * { max-width: 26rem; } }
.auth-card h2 { font-weight: 700; font-size: 1.5rem; }
.setup-wrap { max-width: 960px; margin: 0 auto; padding: 2rem 1rem; color: #dbe3ef; }
.setup-wrap .card { background: var(--cd-surface); color: var(--cd-text); border: 0; }
.message-page { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.message-card { max-width: 30rem; text-align: center; background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: 1rem; padding: 2.5rem 2rem; }
.message-icon { font-size: 2.5rem; color: var(--cd-primary); }
.message-code { color: var(--cd-muted); font-weight: 600; margin: .5rem 0 0; font-size: .85rem; }
.message-card h1 { font-size: 1.5rem; font-weight: 700; }

/* ---------- Records view ------------------------------------------------- */
.records-spinner { display: none; }
.records-filter.is-loading .records-spinner { display: flex; }
.records-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; margin: 0 0 .75rem; font-size: .9rem; color: var(--cd-muted); }
.records-summary strong { color: var(--cd-text); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.rs-active strong { color: var(--cd-active); }
.rs-urgent strong { color: var(--cd-urgent); }
.rs-filters { flex-basis: 100%; font-size: .8rem; }
@media (min-width: 768px) { .rs-filters { flex-basis: auto; margin-left: auto; } }
.records-table { --bs-table-bg: transparent; font-size: .875rem; }
.records-table thead th { font-size: .75rem; font-weight: 600; color: var(--cd-muted); background: var(--cd-surface-2); white-space: nowrap; padding: .65rem .75rem; }
.records-table td { padding: .6rem .75rem; border-color: var(--cd-border); }
.records-table tbody tr:hover { background: var(--cd-surface-2); }
.records-table .row-urgent td:first-child { box-shadow: inset 3px 0 0 var(--cd-urgent); }
.records-table .num { text-align: right; width: 2.5rem; font-variant-numeric: tabular-nums; }
.cell-complaint { min-width: 12rem; max-width: 26rem; }
@media print {
  .records-panel { border: 0 !important; }
  .records-panel .table-responsive { overflow: visible !important; }
  .records-table { font-size: 8.5pt; }
  .records-table thead th { background: #eee !important; color: #000 !important; }
  .records-table td, .records-table th { padding: 3pt 5pt !important; border: 1px solid #bbb !important; }
  .records-table tr { break-inside: avoid; }
  .records-table .badge { border: 1px solid #999; color: #000 !important; background: none !important; padding: 0 3pt; }
  .records-table a { color: #000 !important; }
  .records-summary strong, .records-summary { color: #000 !important; }
  .rs-filters { display: none; }
}

/* ---------- Print ------------------------------------------------------ */
@media print {
  .sidebar, .topbar, .desktop-bar, .fab, .app-footer, .filter-bar, .btn, .composer { display: none !important; }
  body, .panel, .stat-tile { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  .page { padding: 0; max-width: none; }
  .panel { border: 1px solid #bbb; break-inside: avoid; }
  .print-head { margin-bottom: 1rem; font-size: .9rem; }
  .stat-grid { grid-template-columns: repeat(5, 1fr) !important; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
