@charset "UTF-8";
:root {
  --bg: #08111e;
  --bg-elevated: #0b1523;
  --surface: #0f1a2a;
  --surface-2: #142235;
  --surface-3: #192a40;
  --surface-hover: #17263a;
  --surface-subtle: rgba(20, 34, 53, 0.55);
  --surface-card-mobile: #101d2e;
  --border: #26374d;
  --border-strong: #3a506b;
  --border-soft: rgba(148, 163, 184, 0.13);
  --text: #f3f7fb;
  --text-soft: #d0dbea;
  --muted: #8fa0b6;
  --muted-2: #6f829b;
  --heading: #f7faff;
  --primary: #5b8fff;
  --primary-hover: #76a4ff;
  --primary-soft: rgba(91, 143, 255, 0.11);
  --primary-soft-strong: rgba(91, 143, 255, 0.15);
  --primary-border-soft: rgba(91, 143, 255, 0.17);
  --primary-focus: rgba(91, 143, 255, 0.10);
  --primary-contrast: #ffffff;
  --primary-button: #4f84ef;
  --primary-button-hover: #5d91f5;
  --success: #42c990;
  --success-soft: rgba(66, 201, 144, 0.10);
  --warning: #efb74f;
  --warning-soft: rgba(239, 183, 79, 0.10);
  --danger: #ef7580;
  --danger-soft: rgba(239, 117, 128, 0.10);
  --violet: #a58af5;
  --pink: #eb7ab8;
  --sidebar-bg: #091321;
  --brand-bg: #070d16;
  --sidebar-account-bg: rgba(15, 26, 42, 0.78);
  --nav-label: #647891;
  --nav-hover: rgba(148, 163, 184, 0.055);
  --nav-active-text: #f8fbff;
  --nav-active-bg: rgba(91, 143, 255, 0.10);
  --avatar-text: #dbe8ff;
  --link: #8fb2f9;
  --link-hover: #b0c9ff;
  --eyebrow: #7086a1;
  --form-label: #adbacb;
  --form-bg: #132137;
  --form-bg-focus: #15263c;
  --placeholder: #637890;
  --field-help: #71849d;
  --section-label: #afbed0;
  --icon-muted: #7287a1;
  --error-text: #ff929b;
  --form-danger-text: #f6b7be;
  --kpi-hover: #111e30;
  --kpi-icon: #9bb8ee;
  --kpi-label: #9eafc3;
  --kpi-value: #ffffff;
  --kpi-subtext: #6f829a;
  --metric-value: #dbe7f7;
  --subsection-title: #a9b9cc;
  --table-head-bg: #0c1726;
  --table-head-text: #72869f;
  --table-row-hover: rgba(148, 163, 184, 0.024);
  --protocol: #83aaff;
  --cell-subtext: #70849c;
  --compact-label: #8599b1;
  --mobile-label: #6e829b;
  --summary-bg: #121f31;
  --summary-value: #ffffff;
  --record-bg: rgba(20, 34, 53, 0.38);
  --status-blue: #83aaff;
  --status-violet: #beaaff;
  --status-warning: #f0c66c;
  --status-pink: #f3a0cb;
  --status-success: #72d5aa;
  --status-neutral: #9aabc0;
  --status-danger: #fb959e;
  --toast-danger-text: #ffd3d7;
  --toast-danger-bg: #26151d;
  --flash-success-bg: #10241f;
  --flash-danger-bg: #24171e;
  --flash-warning-bg: #241f16;
  --modal-backdrop: rgba(2, 7, 13, 0.74);
  --sidebar-backdrop: rgba(2, 7, 13, 0.66);
  --modal-border: #2a3b52;
  --modal-bg: #0d1827;
  --modal-header-bg: #0e1a2a;
  --modal-actions-bg: rgba(13, 24, 39, 0.97);
  --mobile-nav-bg: rgba(12, 22, 36, 0.96);
  --mobile-nav-text: #7f91a8;
  --mobile-nav-active: #a8c2fb;
  --scroll-track: rgba(255, 255, 255, 0.06);
  --scroll-thumb: rgba(91, 143, 255, 0.32);
  --scroll-thumb-hover: rgba(91, 143, 255, 0.50);
  --chat-header-bg: linear-gradient(180deg, rgba(18, 30, 48, 0.60), rgba(14, 24, 39, 0.20));
  --chat-panel-bg: rgba(8, 14, 24, 0.35);
  --chat-avatar-bg: rgba(15, 27, 45, 0.95);
  --chat-role-bg: rgba(12, 20, 34, 0.80);
  --chat-message-bg: rgba(14, 24, 39, 0.92);
  --chat-staff-bg: linear-gradient(155deg, rgba(30, 58, 110, 0.45), rgba(17, 29, 47, 0.95));
  --chat-requester-bg: rgba(17, 35, 32, 0.55);
  --chat-staff-text: #dbeafe;
  --chat-requester-text: #bbf7d0;
  --auth-glow: rgba(91, 143, 255, 0.14);
  --auth-shadow: 0 25px 60px rgba(0, 0, 0, 0.30);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.14);
  --sidebar-shadow: 18px 0 50px rgba(0, 0, 0, 0.38);
  --mobile-nav-shadow: 0 16px 45px rgba(0, 0, 0, 0.38);
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 13px;
  --sidebar-width: 232px;
  --content-max: 1440px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif; }

html[data-theme="light"] {
  --bg: #f6f8fb;
  --bg-elevated: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --surface-3: #edf2f7;
  --surface-hover: #f8fafc;
  --surface-subtle: #f7f9fc;
  --surface-card-mobile: #ffffff;
  --border: #cbd5e1;
  --border-strong: #aebdce;
  --border-soft: rgba(15, 23, 42, 0.10);
  --text: #172033;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #8795a8;
  --heading: #0f172a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --primary-soft-strong: rgba(37, 99, 235, 0.12);
  --primary-border-soft: rgba(37, 99, 235, 0.18);
  --primary-focus: rgba(37, 99, 235, 0.11);
  --primary-contrast: #ffffff;
  --primary-button: #2563eb;
  --primary-button-hover: #1d4ed8;
  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.08);
  --warning: #b45309;
  --warning-soft: rgba(180, 83, 9, 0.08);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.07);
  --violet: #7c3aed;
  --pink: #be185d;
  --sidebar-bg: #ffffff;
  --brand-bg: #f4f8ff;
  --sidebar-account-bg: #f8fafc;
  --nav-label: #94a3b8;
  --nav-hover: rgba(15, 23, 42, 0.045);
  --nav-active-text: #1d4ed8;
  --nav-active-bg: rgba(37, 99, 235, 0.08);
  --avatar-text: #1d4ed8;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --eyebrow: #64748b;
  --form-label: #475569;
  --form-bg: #ffffff;
  --form-bg-focus: #ffffff;
  --placeholder: #94a3b8;
  --field-help: #718096;
  --section-label: #64748b;
  --icon-muted: #73849a;
  --error-text: #dc2626;
  --form-danger-text: #b91c1c;
  --kpi-hover: #f8fbff;
  --kpi-icon: #356fd9;
  --kpi-label: #53657a;
  --kpi-value: #0f172a;
  --kpi-subtext: #7c8da3;
  --metric-value: #334155;
  --subsection-title: #52647a;
  --table-head-bg: #f8fafc;
  --table-head-text: #64748b;
  --table-row-hover: rgba(37, 99, 235, 0.025);
  --protocol: #1d4ed8;
  --cell-subtext: #73849a;
  --compact-label: #64748b;
  --mobile-label: #718096;
  --summary-bg: #f8fafc;
  --summary-value: #0f172a;
  --record-bg: #f8fafc;
  --status-blue: #1d4ed8;
  --status-violet: #6d28d9;
  --status-warning: #a16207;
  --status-pink: #be185d;
  --status-success: #15803d;
  --status-neutral: #64748b;
  --status-danger: #dc2626;
  --toast-danger-text: #991b1b;
  --toast-danger-bg: #fff5f5;
  --flash-success-bg: #f0fdf4;
  --flash-danger-bg: #fff5f5;
  --flash-warning-bg: #fffbeb;
  --modal-backdrop: rgba(15, 23, 42, 0.34);
  --sidebar-backdrop: rgba(15, 23, 42, 0.28);
  --modal-border: #d8e0ea;
  --modal-bg: #ffffff;
  --modal-header-bg: #f8fafc;
  --modal-actions-bg: rgba(255, 255, 255, 0.97);
  --mobile-nav-bg: rgba(255, 255, 255, 0.96);
  --mobile-nav-text: #64748b;
  --mobile-nav-active: #1d4ed8;
  --scroll-track: rgba(15, 23, 42, 0.06);
  --scroll-thumb: rgba(37, 99, 235, 0.28);
  --scroll-thumb-hover: rgba(37, 99, 235, 0.44);
  --chat-header-bg: linear-gradient(180deg, rgba(239, 246, 255, 0.95), rgba(248, 250, 252, 0.72));
  --chat-panel-bg: #fbfcfe;
  --chat-avatar-bg: #f1f5f9;
  --chat-role-bg: #f1f5f9;
  --chat-message-bg: #f8fafc;
  --chat-staff-bg: linear-gradient(155deg, #eff6ff, #f8fbff);
  --chat-requester-bg: #f0fdf4;
  --chat-staff-text: #1d4ed8;
  --chat-requester-text: #15803d;
  --auth-glow: rgba(37, 99, 235, 0.09);
  --auth-shadow: 0 22px 55px rgba(15, 23, 42, 0.10);
  --shadow: 0 20px 55px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 7px 22px rgba(15, 23, 42, 0.08);
  --sidebar-shadow: 18px 0 42px rgba(15, 23, 42, 0.16);
  --mobile-nav-shadow: 0 14px 36px rgba(15, 23, 42, 0.14); }

*, *::before, *::after {
  box-sizing: border-box; }

html {
  color-scheme: light;
  scroll-behavior: smooth; }

html[data-theme="dark"] {
  color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility; }

button, input, select, textarea {
  font: inherit; }

button, a {
  -webkit-tap-highlight-color: transparent; }

a {
  color: var(--primary);
  text-decoration: none; }

a:hover {
  color: var(--primary-hover); }

img {
  display: block;
  max-width: 100%; }

[hidden] {
  display: none !important; }

::selection {
  background: var(--primary-soft-strong);
  color: var(--text); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -80px;
  z-index: 999;
  padding: .55rem .75rem;
  border-radius: 8px;
  color: var(--primary-contrast);
  background: var(--primary);
  transition: top 120ms ease; }

.skip-link:focus {
  top: 1rem; }

.icon {
  display: block;
  flex: 0 0 auto; }

.nowrap {
  white-space: nowrap; }

/* App shell */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: var(--sidebar-bg); }

.sidebar-head {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .85rem .75rem .35rem; }

.brand {
  min-width: 0;
  flex: 1; }

.brand-panel {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .65rem .8rem;
  border: 1px solid var(--primary-border-soft);
  border-radius: 10px;
  background: var(--brand-bg); }

.brand-logo {
  width: auto;
  max-width: 145px;
  max-height: 31px;
  object-fit: contain; }

.brand-logo--theme-light,
.login-logo--theme-light {
  display: none; }

html[data-theme="light"] .brand-logo--theme-dark,
html[data-theme="light"] .login-logo--theme-dark {
  display: none; }

html[data-theme="light"] .brand-logo--theme-light,
html[data-theme="light"] .login-logo--theme-light {
  display: block; }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: .65rem;
  scrollbar-width: thin; }

.nav-section {
  display: grid;
  gap: .18rem;
  margin-bottom: 1rem; }

.nav-label {
  margin: .35rem 0 .25rem;
  padding: 0 .65rem;
  color: var(--nav-label);
  font-size: .65rem;
  font-weight: 760;
  letter-spacing: .09em;
  text-transform: uppercase; }

.nav-link {
  position: relative;
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: .66rem;
  padding: .5rem .68rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 580;
  transition: 120ms ease; }

.nav-link:hover {
  color: var(--text);
  background: var(--nav-hover); }

.nav-link.active {
  color: var(--nav-active-text);
  border-color: var(--primary-border-soft);
  background: var(--nav-active-bg); }

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -.65rem;
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--primary); }

.sidebar-account {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: .6rem;
  align-items: center;
  margin: .65rem;
  padding: .72rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--sidebar-account-bg); }

.account-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--avatar-text);
  background: var(--primary-soft-strong);
  font-size: .78rem;
  font-weight: 800; }

.account-copy {
  min-width: 0;
  display: flex;
  flex-direction: column; }

.account-copy strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: .78rem;
  white-space: nowrap;
  text-overflow: ellipsis; }

.account-copy span {
  color: var(--muted-2);
  font-size: .67rem; }

.sidebar-overlay, .menu-toggle, .mobile-nav {
  display: none; }

.main {
  min-width: 0;
  padding: 1rem clamp(1rem, 2.3vw, 2rem) 2rem; }

.topbar {
  width: 100%;
  max-width: var(--content-max);
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 auto .9rem; }

.topbar-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .65rem; }

.page-heading {
  min-width: 0; }

.page-title {
  margin: 0;
  color: var(--heading);
  font-size: clamp(1.28rem, 2vw, 1.58rem);
  line-height: 1.2;
  letter-spacing: -.025em;
  font-weight: 760; }

.page-subtitle {
  max-width: 760px;
  margin: .16rem 0 0;
  color: var(--muted);
  font-size: .79rem; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem; }

.page-content, .flash-stack {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto; }

/* Common */
.card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface); }

.section-card, .form-card {
  padding: .95rem 1rem; }

.page-content > .card + .card {
  margin-top: .8rem; }

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem; }

.section-header h2 {
  margin: 0;
  color: var(--text);
  font-size: .93rem;
  line-height: 1.25;
  font-weight: 700; }

.section-header p {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .72rem; }

.compact-header {
  margin-bottom: .58rem; }

.section-icon, .count-badge {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .5rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: .71rem;
  font-weight: 750; }

.eyebrow, .record-kicker {
  display: block;
  margin-bottom: .18rem;
  color: var(--eyebrow);
  font-size: .62rem;
  font-weight: 780;
  letter-spacing: .08em;
  text-transform: uppercase; }

.content-narrow {
  width: 100%;
  max-width: 850px; }

.registry-card {
  max-width: 1180px; }

.text-link, .table-action {
  color: var(--link);
  font-size: .74rem;
  font-weight: 680; }

.text-link:hover, .table-action:hover {
  color: var(--link-hover); }

.actions-col {
  width: 82px;
  text-align: right !important; }

.actions-cell {
  text-align: right; }

.stack-list {
  display: grid;
  gap: .58rem; }

/* Buttons */
.btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  padding: .48rem .78rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 680;
  line-height: 1;
  transition: 120ms ease; }

.btn:hover {
  color: var(--text);
  transform: translateY(-1px); }

.btn:active {
  transform: none; }

.btn:disabled, .btn.is-loading {
  opacity: .58;
  cursor: wait;
  transform: none; }

.btn.primary {
  border-color: var(--primary-border-soft);
  color: var(--primary-contrast);
  background: var(--primary-button);
  box-shadow: 0 6px 16px var(--primary-focus); }

.btn.primary:hover {
  background: var(--primary-button-hover); }

.btn.secondary {
  border-color: var(--border);
  background: var(--surface-2); }

.btn.secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-3); }

.btn.ghost {
  min-height: 31px;
  color: var(--muted); }

.btn.ghost:hover {
  color: var(--text);
  background: var(--nav-hover); }

.btn.sm {
  min-height: 30px;
  padding: .36rem .58rem;
  font-size: .7rem; }

.btn-block {
  width: 100%; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: 120ms ease; }

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-2); }

/* Theme switch */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important; }

.theme-switch {
  width: 64px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease; }

.theme-switch:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover); }

.theme-switch:focus-visible {
  outline-offset: 3px; }

.theme-switch-track {
  position: relative;
  width: 56px;
  height: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden; }

.theme-switch-thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  z-index: 1;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.16);
  transition: transform 170ms cubic-bezier(0.2, 0.75, 0.3, 1), background 140ms ease; }

.theme-switch-icon {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  transition: color 140ms ease, opacity 140ms ease; }

.theme-switch-icon--sun {
  color: var(--warning); }

.theme-switch-icon--moon {
  color: var(--muted-2);
  opacity: .68; }

html[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(30px); }

html[data-theme="dark"] .theme-switch-icon--sun {
  color: var(--muted-2);
  opacity: .56; }

html[data-theme="dark"] .theme-switch-icon--moon {
  color: #dbeafe;
  opacity: 1; }

html[data-theme="light"] .theme-switch-icon--sun {
  opacity: 1; }

html[data-theme="light"] .theme-switch-icon--moon {
  opacity: .58; }

.guest-theme-control {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 30; }

/* Feedback */
.flash-stack {
  position: relative;
  z-index: 25;
  display: grid;
  gap: .45rem;
  margin-bottom: .75rem; }

.client-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 180;
  width: min(92vw, 380px);
  padding: .7rem .8rem;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  border-radius: 9px;
  color: var(--toast-danger-text);
  background: var(--toast-danger-bg);
  box-shadow: var(--shadow-sm);
  font-size: .74rem;
  font-weight: 620; }

.flash {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 30px;
  gap: .6rem;
  align-items: center;
  padding: .58rem .65rem .58rem .75rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-soft);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: .78rem;
  transition: opacity 160ms ease, transform 160ms ease; }

.flash.is-leaving {
  opacity: 0;
  transform: translateY(-4px); }

.flash-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary); }

.flash.success {
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
  background: var(--flash-success-bg); }

.flash.success .flash-dot {
  background: var(--success); }

.flash.danger {
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
  background: var(--flash-danger-bg); }

.flash.danger .flash-dot {
  background: var(--danger); }

.flash.warning {
  border-color: color-mix(in srgb, var(--warning) 25%, transparent);
  background: var(--flash-warning-bg); }

.flash.warning .flash-dot {
  background: var(--warning); }

.flash.info {
  border-color: color-mix(in srgb, var(--primary) 25%, transparent); }

.flash-close {
  width: 30px;
  height: 30px; }

/* Forms */
.form-grid {
  display: grid;
  gap: .78rem;
  max-width: 670px; }

.form-grid.full-width {
  max-width: none; }

.form-grid.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: none; }

.form-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .27rem; }

.form-field label {
  color: var(--form-label);
  font-size: .71rem;
  font-weight: 640; }

.form-field input, .form-field select, .form-field textarea,
.compact-field input, .compact-field select {
  width: 100%;
  min-height: 38px;
  padding: .48rem .6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  background: var(--form-bg);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease; }

.form-field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.45; }

.form-field input::placeholder, .form-field textarea::placeholder {
  color: var(--placeholder); }

.form-field input:focus, .form-field select:focus, .form-field textarea:focus,
.compact-field input:focus, .compact-field select:focus {
  border-color: var(--primary);
  background: var(--form-bg-focus);
  box-shadow: 0 0 0 3px var(--primary-focus); }

.form-field.has-error input, .form-field.has-error select, .form-field.has-error textarea {
  border-color: var(--danger); }

.field-error, .error {
  color: var(--error-text);
  font-size: .68rem; }

.field-help {
  color: var(--field-help);
  font-size: .67rem;
  line-height: 1.35; }

.form-section {
  padding-bottom: .8rem;
  margin-bottom: .8rem;
  border-bottom: 1px solid var(--border-soft); }

.form-section:last-of-type {
  border-bottom: 0; }

.form-section-title, .mini-section-title, .modal-section-title {
  margin-bottom: .6rem;
  color: var(--section-label);
  font-size: .64rem;
  font-weight: 760;
  letter-spacing: .065em;
  text-transform: uppercase; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding-top: .1rem; }

.form-actions.align-start {
  justify-content: flex-start; }

.input-with-icon {
  position: relative; }

.input-with-icon > .icon {
  position: absolute;
  left: .72rem;
  top: 50%;
  z-index: 2;
  color: var(--icon-muted);
  transform: translateY(-50%);
  pointer-events: none; }

.form-field .input-with-icon input,
.compact-field .input-with-icon input,
.input-with-icon input {
  padding-left: 2.35rem; }

.switch-field {
  display: flex;
  align-items: flex-start;
  gap: .62rem;
  padding: .68rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-subtle);
  cursor: pointer; }

.switch-field input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: .08rem 0 0;
  accent-color: var(--primary); }

.switch-field span {
  display: flex;
  flex-direction: column;
  gap: .08rem; }

.switch-field strong {
  color: var(--text-soft);
  font-size: .74rem; }

.switch-field small {
  color: var(--muted);
  font-size: .66rem; }

.compact-switch {
  padding: .6rem .68rem; }

.form-alert {
  padding: .58rem .68rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .72rem; }

.form-alert.danger {
  color: var(--form-danger-text);
  border-color: color-mix(in srgb, var(--danger) 24%, transparent);
  background: var(--danger-soft); }

/* Dashboard */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  margin-bottom: .7rem; }

.kpi-card {
  min-width: 0;
  min-height: 78px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: .68rem;
  align-items: center;
  padding: .72rem .78rem;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: var(--surface); }

.kpi-link {
  color: inherit;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease; }

.kpi-link:hover {
  color: inherit;
  border-color: var(--primary-border-soft);
  background: var(--kpi-hover);
  transform: translateY(-1px); }

.kpi-link:active {
  transform: none; }

.active-scope {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  margin-bottom: .55rem;
  padding: .42rem .58rem;
  border: 1px solid var(--primary-border-soft);
  border-radius: 8px;
  color: var(--muted);
  background: var(--primary-soft);
  font-size: .68rem; }

.active-scope span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-width: 0; }

.active-scope strong {
  color: var(--text-soft); }

.active-scope a {
  flex: 0 0 auto;
  font-weight: 680; }

.kpi-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--primary-border-soft);
  border-radius: 9px;
  color: var(--kpi-icon);
  background: var(--primary-soft); }

.kpi-icon.warning-icon {
  color: #eac26e;
  border-color: rgba(239, 183, 79, 0.14);
  background: rgba(239, 183, 79, 0.06); }

.kpi-icon.success-icon {
  color: #77d6ad;
  border-color: rgba(66, 201, 144, 0.14);
  background: rgba(66, 201, 144, 0.06); }

.kpi-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: .05rem .5rem; }

.kpi-copy > span {
  overflow: hidden;
  color: var(--kpi-label);
  font-size: .69rem;
  font-weight: 670;
  white-space: nowrap;
  text-overflow: ellipsis; }

.kpi-copy > strong {
  grid-row: span 2;
  color: var(--kpi-value);
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 770;
  letter-spacing: -.035em; }

.kpi-copy > small {
  color: var(--kpi-subtext);
  font-size: .62rem;
  white-space: nowrap; }

.dashboard-grid {
  display: grid;
  gap: .7rem;
  margin-bottom: .7rem; }

.dashboard-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr)); }

.compact-panel {
  padding: .86rem .92rem; }

.operational-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .55rem; }

.month-inline {
  display: flex;
  align-items: center;
  gap: .7rem; }

.month-inline-item {
  display: flex;
  align-items: baseline;
  gap: .3rem; }

.month-inline-item span {
  color: var(--muted);
  font-size: .64rem; }

.month-inline-item strong {
  color: var(--kpi-value);
  font-size: .95rem; }

.month-divider {
  width: 1px;
  height: 22px;
  background: var(--border-soft); }

.metric-list {
  display: grid; }

.metric-row {
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .28rem 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-soft);
  font-size: .74rem; }

.metric-row:last-child {
  border-bottom: 0; }

.metric-row > span:first-child {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap; }

.metric-row strong {
  min-width: 25px;
  padding: .08rem .34rem;
  border-radius: 6px;
  text-align: center;
  color: var(--metric-value);
  background: var(--surface-2);
  font-size: .69rem; }

.status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--primary); }

.status-dot-em_atendimento {
  background: var(--violet); }

.status-dot-aguardando {
  background: var(--warning); }

.status-dot-escalonado {
  background: var(--pink); }

.status-dot-resolvido, .status-dot-fechado {
  background: var(--success); }

.status-dot-cancelado {
  background: #70839a; }

.distribution-grid, .report-distribution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem; }

.report-distribution-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)); }

.distribution-block {
  min-width: 0; }

.distribution-block + .distribution-block {
  padding-left: .8rem;
  border-left: 1px solid var(--border-soft); }

.subsection-title {
  margin-bottom: .28rem;
  color: var(--subsection-title);
  font-size: .66rem;
  font-weight: 720; }

.dashboard-distribution, .recent-panel {
  margin-top: 0 !important;
  margin-bottom: .7rem; }

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px; }

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .75rem; }

table.data th, table.data td {
  padding: .5rem .56rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft); }

table.data th {
  color: var(--table-head-text);
  background: var(--table-head-bg);
  font-size: .61rem;
  font-weight: 760;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap; }

table.data tbody tr:last-child td {
  border-bottom: 0; }

table.data tbody tr:hover td {
  background: var(--table-row-hover); }

.table-primary {
  color: var(--text-soft);
  font-weight: 650; }

.protocol-link {
  color: var(--protocol);
  font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size: .7rem;
  font-weight: 760;
  white-space: nowrap; }

.cell-subtext {
  display: block;
  max-width: 320px;
  margin-top: .05rem;
  overflow: hidden;
  color: var(--cell-subtext);
  font-size: .63rem;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis; }

.empty-cell {
  padding: 1.5rem !important; }

.empty-state {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .16rem;
  text-align: center;
  color: var(--muted); }

.empty-state strong {
  color: var(--text-soft);
  font-size: .8rem; }

.empty-state span {
  font-size: .69rem; }

.empty-state.small {
  min-height: 50px;
  align-items: flex-start;
  text-align: left; }

.row-warning td {
  background: rgba(239, 183, 79, 0.025); }

.ticket-mobile-list {
  display: none; }

/* Badges */
.badge {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: .14rem .42rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface-2);
  font-size: .62rem;
  font-weight: 720;
  white-space: nowrap; }

.badge.status-aberto {
  color: var(--status-blue);
  background: rgba(91, 143, 255, 0.07);
  border-color: rgba(91, 143, 255, 0.17); }

.badge.status-em_atendimento {
  color: var(--status-violet);
  background: rgba(165, 138, 245, 0.07);
  border-color: rgba(165, 138, 245, 0.17); }

.badge.status-aguardando, .badge.warning {
  color: var(--status-warning);
  background: var(--warning-soft);
  border-color: rgba(239, 183, 79, 0.18); }

.badge.status-escalonado {
  color: var(--status-pink);
  background: rgba(235, 122, 184, 0.07);
  border-color: rgba(235, 122, 184, 0.17); }

.badge.status-resolvido, .badge.status-fechado, .badge.active {
  color: var(--status-success);
  background: var(--success-soft);
  border-color: rgba(66, 201, 144, 0.18); }

.badge.status-cancelado, .badge.inactive, .badge.neutral {
  color: var(--status-neutral);
  background: rgba(148, 163, 184, 0.055); }

.badge.prio-baixa {
  color: var(--status-neutral); }

.badge.prio-media {
  color: var(--status-blue);
  border-color: rgba(91, 143, 255, 0.17); }

.badge.prio-alta {
  color: var(--status-warning);
  background: var(--warning-soft);
  border-color: rgba(239, 183, 79, 0.18); }

.badge.prio-urgente {
  color: var(--status-danger);
  background: var(--danger-soft);
  border-color: rgba(239, 117, 128, 0.18); }

/* Filters and registries */
.ticket-toolbar-card, .report-toolbar-card, .registry-toolbar-card {
  padding: .72rem .82rem;
  margin-bottom: .7rem; }

.ticket-filter-form {
  display: grid;
  gap: .5rem; }

.ticket-filter-primary {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) minmax(145px, 0.65fr) minmax(155px, 0.75fr) auto;
  gap: .55rem;
  align-items: end; }

.compact-field {
  gap: .18rem; }

.compact-field label {
  color: var(--compact-label);
  font-size: .61rem;
  font-weight: 660; }

.compact-field input, .compact-field select {
  min-height: 34px;
  padding: .38rem .52rem;
  font-size: .74rem; }

.filter-search {
  min-width: 220px; }

.clear-filter {
  margin-bottom: 1px; }

.advanced-filters {
  padding-top: .5rem;
  border-top: 1px solid var(--border-soft); }

.advanced-filters > summary {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  list-style: none;
  color: var(--muted);
  cursor: pointer;
  font-size: .67rem;
  font-weight: 680; }

.advanced-filters > summary::-webkit-details-marker {
  display: none; }

.advanced-filters > summary:hover {
  color: var(--text-soft); }

.filter-count {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .3rem;
  border-radius: 999px;
  color: var(--link);
  background: var(--primary-soft);
  font-size: .58rem;
  font-weight: 760; }

.advanced-filter-grid {
  display: grid;
  grid-template-columns: 120px 95px 110px repeat(4, minmax(135px, 1fr));
  gap: .52rem;
  margin-top: .5rem; }

.result-header {
  align-items: center; }

.result-meta {
  display: flex;
  align-items: center;
  gap: .5rem; }

.ticket-list-card {
  padding-bottom: .2rem; }

.loading-label {
  color: var(--primary);
  font-size: .66rem; }

.htmx-indicator {
  opacity: 0;
  transition: opacity 100ms ease; }

.htmx-request .htmx-indicator, .htmx-request.htmx-indicator {
  opacity: 1; }

.registry-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: .7rem; }

.registry-search {
  width: min(100%, 420px); }

.registry-search .input-with-icon input {
  min-height: 36px; }

.registry-count {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--muted);
  font-size: .68rem; }

[data-filter-empty] {
  padding: 1rem; }

/* Ticket detail */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  grid-template-areas: "main sidebar";
  gap: .75rem;
  align-items: start; }

.detail-main {
  grid-area: main;
  min-width: 0;
  display: grid;
  gap: .75rem;
  align-content: start; }

.ticket-overview {
  padding: .95rem 1rem; }

.detail-body {
  min-width: 0;
  display: grid;
  gap: .75rem; }

.detail-sidebar {
  grid-area: sidebar;
  min-width: 0;
  position: sticky;
  top: .75rem;
  align-self: start; }

.ticket-overview-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .78rem;
  margin-bottom: .78rem;
  border-bottom: 1px solid var(--border-soft); }

.ticket-state-line {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem; }

.ticket-owner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right; }

.ticket-owner span {
  color: var(--muted);
  font-size: .64rem; }

.ticket-owner strong {
  color: var(--text-soft);
  font-size: .78rem; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .72rem .8rem;
  margin: 0; }

.meta-item {
  min-width: 0; }

.meta-item dt {
  color: var(--muted);
  font-size: .63rem; }

.meta-item dd {
  margin: .12rem 0 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: .74rem;
  font-weight: 620; }

.action-panel {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface); }

.action-panel-head {
  padding: .8rem .85rem .62rem;
  border-bottom: 1px solid var(--border-soft); }

.action-panel-head h2 {
  margin: 0;
  font-size: .86rem; }

.action-disclosure {
  border-bottom: 1px solid var(--border-soft); }

.action-disclosure:last-child {
  border-bottom: 0; }

.action-disclosure summary, .inline-disclosure summary {
  list-style: none;
  cursor: pointer; }

.action-disclosure summary::-webkit-details-marker, .inline-disclosure summary::-webkit-details-marker {
  display: none; }

.action-disclosure > summary {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  gap: .58rem;
  align-items: center;
  padding: .64rem .75rem;
  transition: background 100ms ease; }

.action-disclosure > summary::after {
  content: "⌄";
  color: var(--muted-2);
  font-size: .85rem;
  transform: translateY(-1px);
  transition: transform 120ms ease; }

.action-disclosure[open] > summary::after {
  transform: rotate(180deg) translateY(-1px); }

.action-disclosure > summary:hover {
  background: var(--nav-hover); }

.summary-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2); }

.summary-icon.warning-icon {
  color: var(--warning); }

.action-disclosure summary span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex-direction: column; }

.action-disclosure summary strong {
  color: var(--text-soft);
  font-size: .72rem; }

.action-disclosure summary small {
  color: var(--muted);
  font-size: .63rem;
  font-weight: 400; }

.action-disclosure[open] > summary {
  background: var(--primary-soft); }

.disclosure-body {
  padding: .08rem .75rem .75rem; }

.compact-form {
  gap: .62rem;
  max-width: none; }

.pending-list {
  padding: .68rem .75rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(239, 183, 79, 0.02); }

.pending-item {
  padding: .62rem;
  margin-bottom: .45rem;
  border: 1px solid rgba(239, 183, 79, 0.15);
  border-radius: 8px;
  background: rgba(239, 183, 79, 0.035); }

.pending-item:last-child {
  margin-bottom: 0; }

.pending-item.is-resolved {
  opacity: .68;
  border-color: var(--border-soft);
  background: transparent; }

.pending-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .45rem; }

.pending-item-head strong {
  font-size: .7rem; }

.mini-status {
  color: var(--muted);
  font-size: .61rem; }

.pending-item p {
  margin: .34rem 0;
  color: var(--text-soft);
  font-size: .69rem; }

.record-card {
  padding: .78rem;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--record-bg); }

.record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .7rem; }

.record-head strong {
  color: var(--text-soft);
  font-size: .78rem; }

.record-text {
  margin: .45rem 0 .35rem;
  color: var(--text-soft);
  font-size: .71rem; }

.record-meta {
  color: var(--muted);
  font-size: .63rem; }

.inline-disclosure {
  margin-top: .58rem;
  padding-top: .55rem;
  border-top: 1px solid var(--border-soft); }

.inline-disclosure summary {
  color: var(--link);
  font-size: .68rem;
  font-weight: 680; }

.inline-disclosure .compact-form {
  margin-top: .6rem; }

/* Timeline */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none; }

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: .55rem;
  padding: 0 0 .85rem; }

.timeline li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 11px;
  bottom: -1px;
  width: 1px;
  background: var(--border); }

.timeline-marker {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: .18rem;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 1px rgba(91, 143, 255, 0.28); }

.timeline-time {
  color: var(--muted);
  font-size: .62rem; }

.timeline-title {
  margin-top: .04rem;
  color: var(--text-soft);
  font-size: .72rem;
  font-weight: 650; }

.timeline-content p {
  margin: .18rem 0 0;
  color: var(--muted);
  font-size: .68rem; }

.timeline-empty {
  display: block !important; }

/* Reports */
.report-toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 155px 105px auto auto;
  gap: .52rem;
  align-items: end; }

.report-period-copy {
  display: flex;
  flex-direction: column;
  align-self: center; }

.report-period-copy strong {
  color: var(--text-soft);
  font-size: .74rem; }

.report-period-copy small {
  margin-top: .03rem;
  color: var(--muted);
  font-size: .62rem; }

.report-kpi-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr)); }

.report-type-summary {
  margin-bottom: .7rem; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .42rem; }

.summary-tile {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .48rem .56rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-soft);
  background: var(--summary-bg);
  font-size: .68rem; }

.summary-tile strong {
  color: var(--summary-value);
  font-size: .86rem; }

.report-secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin-top: .7rem; }

.report-secondary-grid > .card {
  margin-top: 0 !important; }

/* Modal */
body.modal-open {
  overflow: hidden; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: var(--modal-backdrop);
  backdrop-filter: blur(5px);
  animation: fade-in 120ms ease-out; }

.modal {
  width: min(100%, 540px);
  max-height: min(90dvh, 820px);
  overflow: hidden;
  border: 1px solid var(--modal-border);
  border-radius: 13px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  animation: modal-in 140ms ease-out; }

.modal.modal-lg {
  width: min(100%, 690px); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .9rem;
  padding: .82rem .9rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--modal-header-bg); }

.modal-heading {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: .62rem; }

.modal-heading-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-top: .02rem;
  border: 1px solid var(--primary-border-soft);
  border-radius: 8px;
  color: var(--kpi-icon);
  background: var(--primary-soft); }

.modal-header h2 {
  margin: 0;
  color: var(--heading);
  font-size: .94rem; }

.modal-header p {
  max-width: 540px;
  margin: .14rem 0 0;
  color: var(--muted);
  font-size: .67rem; }

.modal-body {
  max-height: calc(90dvh - 66px);
  overflow-y: auto;
  overscroll-behavior: contain; }

.modal-form, .ticket-form.modal-form {
  display: grid;
  gap: .7rem;
  padding: .82rem .9rem .9rem; }

.modal-form .form-section {
  padding-bottom: .65rem;
  margin-bottom: 0; }

.modal-section {
  display: grid;
  gap: .52rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--border-soft); }

.modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin: .02rem -.9rem -.9rem;
  padding: 0.68rem 0.9rem calc(.68rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-soft);
  background: var(--modal-actions-bg);
  backdrop-filter: blur(10px); }

@keyframes fade-in {
  from {
    opacity: 0; }
  to {
    opacity: 1; } }

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.993); }
  to {
    opacity: 1;
    transform: none; } }

/* Auth */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: radial-gradient(circle at 50% -10%, var(--auth-glow), transparent 30rem), var(--bg); }

.auth-card {
  width: min(100%, 400px);
  padding: 1.1rem;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--auth-shadow); }

.login-brand {
  margin-bottom: 1rem;
  text-align: center; }

.login-brand-panel {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .85rem;
  padding: .8rem;
  border: 1px solid var(--primary-border-soft);
  border-radius: 12px;
  background: var(--brand-bg); }

.login-logo {
  width: auto;
  max-width: 175px;
  max-height: 41px;
  object-fit: contain; }

.login-brand h1 {
  margin: 0;
  font-size: 1.03rem; }

.login-brand p {
  margin: .22rem 0 0;
  color: var(--muted);
  font-size: .73rem; }

.auth-form {
  max-width: none; }

.auth-footnote {
  margin: .8rem 0 0;
  color: var(--muted-2);
  font-size: .65rem;
  text-align: center; }

/* Generic helpers */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .7rem; }

.section-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: .74rem; }

.table-action {
  display: inline-flex;
  padding: .28rem .42rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer; }

.table-action:hover {
  background: var(--primary-soft); }

/* Responsive */
@media (max-width: 1240px) {
  .report-distribution-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-distribution-grid .distribution-block:nth-child(3) {
    padding-left: 0;
    border-left: 0; }
  .advanced-filter-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .report-kpi-grid {
    grid-template-columns: repeat(5, minmax(125px, 1fr));
    overflow-x: auto; } }

@media (max-width: 1050px) {
  .meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-layout {
    grid-template-columns: minmax(0, 1fr) 310px; }
  .ticket-filter-primary {
    grid-template-columns: minmax(220px, 1fr) minmax(140px, 0.6fr) minmax(150px, 0.7fr) auto; }
  .report-secondary-grid {
    grid-template-columns: 1fr; } }

@media (max-width: 900px) {
  body.sidebar-open {
    overflow: hidden; }
  .app-shell {
    display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 280px);
    transform: translateX(-104%);
    transition: transform 180ms ease;
    box-shadow: var(--sidebar-shadow); }
  .sidebar-open .sidebar {
    transform: translateX(0); }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: var(--sidebar-backdrop); }
  .sidebar-open .sidebar-overlay {
    display: block; }
  .menu-toggle {
    display: inline-grid; }
  .main {
    padding-top: .75rem;
    padding-bottom: calc(5.2rem + env(safe-area-inset-bottom)); }
  .mobile-nav {
    position: fixed;
    left: .7rem;
    right: .7rem;
    bottom: calc(.55rem + env(safe-area-inset-bottom));
    z-index: 32;
    min-height: 58px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: stretch;
    padding: .3rem;
    border: 1px solid var(--border-soft);
    border-radius: 15px;
    background: var(--mobile-nav-bg);
    box-shadow: var(--mobile-nav-shadow);
    backdrop-filter: blur(16px); }
  .mobile-nav-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    padding: .28rem .15rem;
    border: 0;
    border-radius: 10px;
    color: var(--mobile-nav-text);
    background: transparent;
    cursor: pointer;
    font-size: .58rem;
    font-weight: 650; }
  .mobile-nav-item.active {
    color: var(--mobile-nav-active);
    background: var(--primary-soft); }
  .mobile-nav-primary {
    color: var(--primary-contrast);
    background: var(--primary-button); }
  .mobile-nav-primary:hover {
    color: var(--primary-contrast); }
  .dashboard-grid.two-columns {
    grid-template-columns: 1fr; }
  .detail-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "sidebar"; }
  .detail-sidebar {
    position: static; }
  .report-toolbar {
    grid-template-columns: minmax(180px, 1fr) 150px 100px auto; } }

@media (max-width: 760px) {
  body {
    font-size: 14px; }
  .main {
    padding-inline: .72rem; }
  .topbar {
    min-height: 50px;
    align-items: flex-start;
    margin-bottom: .7rem; }
  .topbar-main {
    width: 100%; }
  .page-title {
    font-size: 1.22rem; }
  .page-subtitle {
    display: none; }
  .topbar-actions {
    flex: 0 0 auto; }
  .topbar-actions .btn {
    min-height: 36px;
    padding-inline: .62rem; }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem; }
  .kpi-card {
    min-height: 68px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: .52rem;
    padding: .6rem; }
  .kpi-icon {
    width: 30px;
    height: 30px; }
  .kpi-copy > strong {
    font-size: 1.24rem; }
  .kpi-copy > small {
    display: none; }
  .distribution-grid, .report-distribution-grid {
    grid-template-columns: 1fr; }
  .distribution-block + .distribution-block, .report-distribution-grid .distribution-block:nth-child(3) {
    padding-left: 0;
    padding-top: .62rem;
    border-left: 0;
    border-top: 1px solid var(--border-soft); }
  .form-grid.two-cols, .meta-grid {
    grid-template-columns: 1fr; }
  .ticket-overview-head, .record-head, .section-header {
    align-items: flex-start; }
  .ticket-owner {
    align-items: flex-start;
    text-align: left; }
  .ticket-overview-head {
    flex-direction: column;
    gap: .58rem; }
  .ticket-filter-primary {
    grid-template-columns: 1fr 1fr; }
  .filter-search {
    grid-column: 1 / -1; }
  .advanced-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-toolbar {
    grid-template-columns: 1fr 1fr; }
  .report-period-copy {
    grid-column: 1 / -1; }
  .registry-toolbar {
    align-items: stretch;
    flex-direction: column; }
  .registry-search {
    width: 100%; }
  .report-kpi-grid {
    overflow: visible;
    grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-kpi-grid .kpi-card:last-child {
    grid-column: 1 / -1; }
  /* Ticket list becomes touch-friendly cards */
  .ticket-table-wrap {
    display: none; }
  .ticket-mobile-list {
    display: grid;
    gap: .48rem; }
  .ticket-mobile-card {
    display: block;
    padding: .68rem;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    color: inherit;
    background: var(--surface-card-mobile); }
  .ticket-mobile-card:hover {
    color: inherit;
    border-color: var(--primary-border-soft); }
  .ticket-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
    margin-bottom: .48rem; }
  .ticket-mobile-date {
    color: var(--muted);
    font-size: .62rem; }
  .ticket-mobile-person {
    min-width: 0;
    margin-bottom: .46rem; }
  .ticket-mobile-person strong {
    display: block;
    overflow: hidden;
    color: var(--text-soft);
    font-size: .76rem;
    white-space: nowrap;
    text-overflow: ellipsis; }
  .ticket-mobile-person span {
    color: var(--muted);
    font-size: .64rem; }
  .ticket-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-bottom: .48rem; }
  .ticket-mobile-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
    padding-top: .45rem;
    border-top: 1px solid var(--border-soft); }
  .ticket-mobile-owner {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: .64rem;
    white-space: nowrap;
    text-overflow: ellipsis; }
  /* Generic stacked registry/report tables */
  .mobile-stack-table thead {
    display: none; }
  .mobile-stack-table, .mobile-stack-table tbody {
    display: block; }
  .mobile-stack-table tr {
    display: grid;
    gap: 0;
    margin-bottom: .5rem;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--surface-card-mobile); }
  .mobile-stack-table tr:last-child {
    margin-bottom: 0; }
  .mobile-stack-table td {
    display: grid;
    grid-template-columns: minmax(88px, 0.72fr) minmax(0, 1.4fr);
    gap: .55rem;
    align-items: center;
    padding: .48rem .62rem !important;
    border-bottom: 1px solid var(--border-soft) !important; }
  .mobile-stack-table td:last-child {
    border-bottom: 0 !important; }
  .mobile-stack-table td::before {
    content: attr(data-label);
    color: var(--mobile-label);
    font-size: .61rem;
    font-weight: 710;
    text-transform: uppercase;
    letter-spacing: .035em; }
  .mobile-stack-table .actions-cell {
    text-align: left; }
  .mobile-stack-table .table-action {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: .5rem .65rem;
    border-radius: 8px;
    background: var(--primary-soft); }
  .mobile-stack-table .empty-cell {
    display: block; }
  .mobile-stack-table .empty-cell::before {
    content: none; }
  .mobile-stack-table .empty-state {
    min-height: 66px; }
  .cell-subtext {
    max-width: 100%;
    white-space: normal; } }

@media (max-width: 520px) {
  .client-toast {
    top: calc(.55rem + env(safe-area-inset-top));
    left: .55rem;
    right: .55rem;
    width: auto; }
  .main {
    padding-inline: .6rem; }
  .topbar {
    gap: .5rem; }
  .topbar-actions .btn .icon {
    width: 16px;
    height: 16px; }
  .topbar-actions .btn {
    font-size: .7rem; }
  .section-card, .form-card, .ticket-overview {
    padding: .78rem; }
  .compact-panel {
    padding: .76rem; }
  .section-header p {
    display: none; }
  .kpi-grid {
    gap: .42rem; }
  .kpi-card {
    min-height: 64px; }
  .kpi-copy > span {
    font-size: .64rem; }
  .month-inline {
    gap: .5rem; }
  .ticket-filter-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-filter-primary .filter-search {
    grid-column: 1 / -1; }
  .ticket-filter-primary .clear-filter {
    grid-column: 1 / -1;
    width: fit-content; }
  .advanced-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-toolbar {
    grid-template-columns: minmax(0, 1.45fr) minmax(88px, 0.75fr); }
  .report-period-copy {
    display: none; }
  .report-toolbar .btn {
    grid-column: 1 / -1;
    width: 100%; }
  .topbar-actions .mobile-action {
    width: 42px;
    min-width: 42px;
    padding-inline: 0; }
  .topbar-actions .mobile-action .btn-label {
    display: none; }
  .form-field input, .form-field select, .form-field textarea, .compact-field input, .compact-field select {
    min-height: 44px;
    font-size: 16px; }
  .form-field textarea {
    min-height: 100px; }
  .btn {
    min-height: 42px; }
  .btn.sm {
    min-height: 38px; }
  .icon-btn {
    width: 40px;
    height: 40px; }
  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch; }
  .form-actions .btn {
    width: 100%; }
  .modal-backdrop {
    padding: 0;
    align-items: end; }
  .modal, .modal.modal-lg {
    width: 100%;
    max-height: 96dvh;
    border-radius: 16px 16px 0 0; }
  .modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: .78rem .8rem; }
  .modal-heading-icon {
    width: 30px;
    height: 30px; }
  .modal-header p {
    display: none; }
  .modal-body {
    max-height: calc(96dvh - 60px); }
  .modal-form, .ticket-form.modal-form {
    padding: .75rem .8rem .8rem; }
  .modal-actions {
    flex-direction: column-reverse;
    margin-inline: -.8rem;
    margin-bottom: -.8rem;
    padding-inline: .8rem; }
  .modal-actions .btn {
    width: 100%; }
  .mobile-nav {
    left: .45rem;
    right: .45rem;
    bottom: calc(.4rem + env(safe-area-inset-bottom)); }
  .mobile-stack-table td {
    grid-template-columns: 82px minmax(0, 1fr); }
  .auth-card {
    padding: .95rem; } }

@media (max-width: 370px) {
  .ticket-filter-primary, .advanced-filter-grid, .report-toolbar {
    grid-template-columns: 1fr; }
  .ticket-filter-primary .filter-search, .ticket-filter-primary .clear-filter, .report-toolbar .btn {
    grid-column: auto; }
  .mobile-nav {
    left: .3rem;
    right: .3rem;
    padding-inline: .2rem; }
  .mobile-nav-item {
    font-size: .55rem; } }

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

/* Small compatibility helpers used by shared templates */
.panel-title {
  margin: 0;
  color: var(--text);
  font-size: .93rem;
  font-weight: 700; }

.flash-message {
  min-width: 0; }

.table-card {
  overflow: hidden; }

.compact-ticket-table th, .compact-ticket-table td {
  padding-top: .46rem;
  padding-bottom: .46rem; }

.metric-list.dense .metric-row {
  min-height: 30px; }

@media (max-width: 900px) {
  .mobile-redundant-action {
    display: none; } }

/* Light theme refinements */
html[data-theme="light"] .brand-panel,
html[data-theme="light"] .login-brand-panel {
  background: var(--brand-bg);
  border-color: rgba(37, 99, 235, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65); }

html[data-theme="light"] .nav-link.active::before {
  background: var(--primary); }

html[data-theme="light"] .account-avatar {
  border: 1px solid rgba(37, 99, 235, 0.1); }

html[data-theme="light"] .card,
html[data-theme="light"] .kpi-card,
html[data-theme="light"] .action-panel {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.025); }

html[data-theme="light"] .kpi-icon.warning-icon {
  color: #a16207;
  background: #fffbeb;
  border-color: rgba(180, 83, 9, 0.14); }

html[data-theme="light"] .kpi-icon.success-icon {
  color: #15803d;
  background: #f0fdf4;
  border-color: rgba(21, 128, 61, 0.14); }

html[data-theme="light"] .badge.status-aberto,
html[data-theme="light"] .badge.prio-media {
  background: #eff6ff;
  border-color: #bfdbfe; }

html[data-theme="light"] .badge.status-em_atendimento {
  background: #f5f3ff;
  border-color: #ddd6fe; }

html[data-theme="light"] .badge.status-aguardando,
html[data-theme="light"] .badge.warning,
html[data-theme="light"] .badge.prio-alta {
  background: #fffbeb;
  border-color: #fde68a; }

html[data-theme="light"] .badge.status-escalonado {
  background: #fdf2f8;
  border-color: #fbcfe8; }

html[data-theme="light"] .badge.status-resolvido,
html[data-theme="light"] .badge.status-fechado,
html[data-theme="light"] .badge.active {
  background: #f0fdf4;
  border-color: #bbf7d0; }

html[data-theme="light"] .badge.prio-urgente {
  background: #fff1f2;
  border-color: #fecdd3; }

html[data-theme="light"] .modal-backdrop {
  backdrop-filter: blur(4px); }

html[data-theme="light"] .modal {
  box-shadow: 0 24px 65px rgba(15, 23, 42, 0.18); }

html[data-theme="light"] .mobile-nav {
  border-color: rgba(15, 23, 42, 0.1); }

html[data-theme="light"] select {
  color-scheme: light; }
