:root {
  color-scheme: light;
  --bg: #f8f4f3;
  --surface: #ffffff;
  --surface-strong: #fff1f1;
  --text: #17211f;
  --muted: #66736f;
  --line: #e5d8d6;
  --primary: #b91c1c;
  --primary-strong: #8f1717;
  --secondary: #6b3f3f;
  --warning: #b7791f;
  --success: #2f855a;
  --danger: #b83232;
  --accent: #d6a72c;
  --gold: #d6a72c;
  --shadow: 0 18px 40px rgba(54, 18, 18, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(185, 28, 28, 0.08), transparent 35%),
    linear-gradient(315deg, rgba(214, 167, 44, 0.11), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

body.menu-hidden .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.menu-hidden .sidebar {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: linear-gradient(180deg, #611414 0%, #351010 100%);
  color: #f7fbfa;
}

.mobile-menu-button,
.mobile-menu-close,
.mobile-menu-backdrop {
  display: none;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-height: 116px;
  text-align: center;
}

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

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.05;
}

.brand small {
  margin-top: 3px;
  color: #f2d58c;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-button,
.primary-button,
.gold-button,
.secondary-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
}

.nav-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  background: transparent;
  color: #d8e7e4;
  text-align: left;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  color: #f6d878;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.nav-label {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f6d878;
  color: #351010;
  font-size: 0.76rem;
  font-weight: 700;
}

.nav-badge[hidden] {
  display: none !important;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.nav-item[hidden],
.topbar-summary[hidden] {
  display: none !important;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.ghost-button {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.ghost-button.danger {
  color: #ffd6d6;
}

.main-content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-title {
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
}

h3 {
  margin-bottom: 12px;
  font-size: 1rem;
  font-weight: 600;
}

.topbar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.topbar-summary span {
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-weight: 400;
}

.topbar-summary strong {
  color: var(--text);
  font-weight: 700;
}

.account-area {
  position: relative;
  flex: 0 0 auto;
}

.account-menu {
  display: inline-flex;
}

.topbar-login-button,
.account-trigger {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--secondary);
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(54, 18, 18, 0.07);
}

.topbar-login-button {
  padding: 0 18px;
}

.account-trigger {
  padding: 5px 14px 5px 5px;
}

.account-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.account-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), #6f1717);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

.account-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.account-copy strong,
.account-copy small {
  overflow: hidden;
  max-width: 150px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.account-copy small {
  color: var(--muted);
  font-size: 0.76rem;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  display: grid;
  min-width: 190px;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(54, 18, 18, 0.18);
}

.account-dropdown button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--secondary);
  font-weight: 600;
  text-align: left;
}

.account-dropdown button:hover {
  background: #fff1f1;
  color: var(--primary-strong);
}

.account-dropdown button.danger {
  color: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
  gap: 18px;
}

.collaborator-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 18px;
  max-width: 820px;
  margin: 32px auto 0;
}

.collaborator-action {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 18px;
  min-height: 220px;
  padding: 28px;
  border: 1px solid #f1b4b4;
  border-radius: 8px;
  background: #fffafa;
  color: var(--primary-strong);
  box-shadow: var(--shadow);
  text-align: left;
}

.collaborator-action:hover,
.collaborator-action:focus-visible {
  border-color: var(--primary);
  background: #fff1f1;
  outline: 0;
  box-shadow:
    0 0 0 3px rgba(185, 28, 28, 0.12),
    var(--shadow);
}

.collaborator-action span {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
}

.collaborator-action .plus-icon::before,
.collaborator-action .plus-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: #ffffff;
  transform: translate(-50%, -50%);
}

.collaborator-action .plus-icon::before {
  width: 24px;
  height: 5px;
}

.collaborator-action .plus-icon::after {
  width: 5px;
  height: 24px;
}

.collaborator-action .search-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  border: 5px solid #ffffff;
  border-radius: 999px;
  transform: translate(-60%, -60%);
}

.collaborator-action .search-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 5px;
  border-radius: 999px;
  background: #ffffff;
  transform: translate(3px, 7px) rotate(45deg);
  transform-origin: left center;
}

.collaborator-action strong {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(32, 11, 11, 0.52);
}

.modal-panel {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 22px;
  border: 1px solid #f1b4b4;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(32, 11, 11, 0.28);
}

.small-modal {
  width: min(460px, 100%);
}

.wide-modal {
  width: min(900px, 100%);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #f1b4b4;
  border-radius: 8px;
  background: #fff1f1;
  color: var(--primary-strong);
  font-size: 1.15rem;
  font-weight: 700;
}

.icon-button:hover {
  background: #fee2e2;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: 0;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  padding: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.13);
}

.primary-button,
.gold-button,
.secondary-button {
  padding: 0 16px;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

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

.gold-button {
  background: var(--gold);
  color: #351010;
}

.gold-button:hover {
  background: #bf8f18;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--secondary);
}

.secondary-button:hover {
  border-color: #a8b8b4;
  background: var(--surface-strong);
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.ticket-list {
  display: grid;
  gap: 12px;
}

.ticket-list.wide {
  grid-template-columns: repeat(auto-fill, minmax(360px, 426px));
  align-items: start;
}

.ticket-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.ticket-card.needs-attention {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.ticket-card.priority-ticket {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.priority-badge {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
}

.attention-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.attention-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fee2e2;
}

.attention-note strong {
  color: #991b1b;
  font-size: 0.82rem;
}

.attention-note p {
  color: #7f1d1d;
}

.ticket-card.dragging {
  opacity: 0.55;
}

.ticket-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticket-card-header .ticket-id {
  margin-right: auto;
}

.ticket-card h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

.ticket-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.ticket-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.ticket-card dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
}

.ticket-card dd {
  margin: 4px 0 0;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #2d3748;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.open {
  background: #fee2e2;
  color: var(--primary-strong);
}

.status-pill.waiting {
  background: #fff4d6;
  color: var(--warning);
}

.status-pill.resolved {
  background: #e6f4ea;
  color: var(--success);
}

.technician-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.kanban-column {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
}

.kanban-column.unassigned-column {
  border-color: #f1b4b4;
  background: #fff4f4;
}

.kanban-column.unassigned-column .kanban-heading {
  background: #fee2e2;
}

.kanban-column.over {
  outline: 3px solid rgba(185, 28, 28, 0.18);
}

.kanban-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.kanban-heading h3 {
  margin: 0;
}

.kanban-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
}

.compact-field {
  min-width: 220px;
}

.resolution-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafa;
}

.technician-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.technician-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.technician-actions .gold-button,
.technician-actions .primary-button {
  min-height: 56px;
  line-height: 1.25;
  padding-block: 8px;
}

.ticket-updates {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #f3dfab;
  border-radius: 8px;
  background: #fffbeb;
}

.ticket-updates h4 {
  margin: 0;
  color: #92400e;
  font-size: 0.86rem;
}

.ticket-updates ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticket-updates li {
  display: grid;
  gap: 4px;
}

.ticket-updates span {
  color: #7c5b15;
  font-size: 0.78rem;
  font-weight: 600;
}

.ticket-updates p {
  color: #3f3a22;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

#view-dashboard.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 128px);
}

.dashboard-active-panel {
  margin-bottom: 0;
}

.dashboard-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: auto;
  padding-top: 28px;
}

.checkbox-control {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

.checkbox-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.priority-control {
  justify-content: flex-start;
  width: fit-content;
}

.dashboard-ticket-field {
  margin-top: 16px;
}

.dashboard-priority-control {
  margin-top: 12px;
}

.dashboard-ticket-list {
  display: grid;
  gap: 8px;
}

.dashboard-ticket-header,
.dashboard-ticket-row {
  display: grid;
  grid-template-columns: 110px minmax(150px, 1fr) minmax(130px, 0.8fr) minmax(180px, 1.4fr) minmax(150px, 0.8fr) auto;
  align-items: center;
  gap: 12px;
}

.dashboard-ticket-header {
  padding: 0 14px 2px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.dashboard-ticket-row {
  position: relative;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.dashboard-ticket-row:hover,
.dashboard-ticket-row:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 8px 22px rgba(54, 18, 18, 0.11);
  outline: 0;
  transform: translateY(-1px);
}

.dashboard-ticket-id,
.dashboard-ticket-requester,
.dashboard-ticket-department,
.dashboard-ticket-subject {
  min-width: 0;
}

.dashboard-ticket-id {
  color: var(--text);
}

.dashboard-ticket-requester {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 600;
}

.dashboard-ticket-department,
.dashboard-ticket-subject,
.dashboard-ticket-date {
  overflow: hidden;
  color: var(--muted);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-ticket-date {
  font-size: 0.86rem;
  text-align: left;
}

.dashboard-ticket-state {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-ticket-waiting {
  grid-column: 2 / -1;
  margin-top: -4px;
}

.waiting-label {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.78rem;
  font-weight: 700;
}

.dashboard-ticket-row.dashboard-new-ticket {
  border-color: #fecaca;
  background: #fff5f5;
}

.dashboard-ticket-row.dashboard-service-ticket {
  border-color: #fde68a;
  background: #fffbeb;
}

.dashboard-ticket-row.needs-attention {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.dashboard-ticket-row.priority-ticket {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.dashboard-ticket-row .attention-badge {
  position: static;
  width: 26px;
  height: 26px;
}

.dashboard-ticket-row .priority-badge {
  width: 26px;
  height: 26px;
}

.dashboard-action-summary {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafa;
}

.dashboard-action-summary dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin: 0;
}

.dashboard-action-summary dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.dashboard-action-summary dd {
  margin: 4px 0 0;
  font-weight: 600;
}

.dashboard-action-summary > strong {
  font-size: 1.05rem;
}

.dashboard-action-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.metric-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
}

.metric-label {
  color: var(--muted);
  font-weight: 600;
}

.metric-card strong {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.metric-card.open-metric {
  border-color: #fecaca;
  background: #fff5f5;
}

.metric-card.open-metric::before {
  background: #dc2626;
}

.metric-card.open-metric .metric-label,
.metric-card.open-metric strong {
  color: #991b1b;
}

.metric-card.waiting-metric {
  border-color: #fde68a;
  background: #fffbeb;
}

.metric-card.waiting-metric::before {
  background: #f59e0b;
}

.metric-card.waiting-metric .metric-label,
.metric-card.waiting-metric strong {
  color: #92400e;
}

.metric-card.resolved-metric {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.metric-card.resolved-metric::before {
  background: #16a34a;
}

.metric-card.resolved-metric .metric-label,
.metric-card.resolved-metric strong {
  color: #166534;
}

.metric-card.neutral-metric {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.metric-card.neutral-metric::before {
  background: var(--secondary);
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.report-chart-grid {
  margin-bottom: 18px;
}

.report-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.report-actions label {
  min-width: 220px;
}

.report-actions .secondary-button {
  white-space: nowrap;
}

.report-ticket-row {
  cursor: pointer;
}

.report-ticket-row:hover td,
.report-ticket-row:focus-visible td {
  background: #fff7f7;
}

.report-ticket-row:focus-visible {
  outline: 2px solid rgba(185, 28, 28, 0.35);
  outline-offset: -2px;
}

.report-ticket-detail {
  display: grid;
  gap: 14px;
}

.report-detail-block {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.report-detail-block h3 {
  margin: 0;
  font-size: 1rem;
}

.report-detail-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.report-detail-updates {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.report-detail-updates li {
  padding: 10px;
  border-radius: 8px;
  background: #fffafa;
}

.report-detail-updates span {
  display: block;
  color: var(--secondary);
  font-size: 0.82rem;
  font-weight: 600;
}

.report-detail-updates p {
  margin-top: 5px;
}

.company-page-heading {
  margin-bottom: 18px;
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.company-manager {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.company-manager-wide {
  grid-column: 1 / -1;
}

.company-manager h3 {
  margin-bottom: 0;
}

.company-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.technician-access-form {
  grid-template-columns:
    minmax(180px, 1.2fr)
    minmax(140px, 0.9fr)
    minmax(140px, 0.9fr)
    minmax(150px, 0.8fr)
    minmax(180px, 0.8fr)
    auto;
}

.technician-access-form .primary-button {
  min-width: 140px;
}

.user-receive-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.user-receive-field input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.company-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.company-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafa;
}

.company-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.company-list span {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-list-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.company-list-main small {
  overflow: hidden;
  color: var(--muted);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-user-list {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.company-user-list li {
  grid-template-columns:
    minmax(160px, 1.2fr)
    minmax(120px, 0.8fr)
    minmax(160px, 0.9fr)
    minmax(170px, 0.8fr)
    96px;
  min-height: 58px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
}

.company-user-list li:last-child {
  border-bottom: 0;
}

.company-user-header {
  min-height: 44px !important;
  background: #f7f5f5 !important;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.company-user-header span {
  color: var(--muted);
  font-weight: 600;
}

.company-user-header span:nth-child(4) {
  text-align: center;
}

.company-user-row:hover {
  background: #fff7f7;
}

.company-user-login {
  color: var(--muted);
  font-weight: 500 !important;
}

.company-user-list .company-actions {
  justify-content: flex-end;
}

.user-access-select {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
}

.switch-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-self: center;
  width: 46px;
  height: 26px;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #e5e7eb;
  cursor: pointer;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.switch-slider::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(55, 65, 81, 0.24);
  content: "";
  transition: transform 0.2s ease;
}

.switch-control input:checked + .switch-slider {
  background: var(--primary);
}

.switch-control input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 3px rgba(197, 27, 27, 0.16);
}

.switch-control input:checked + .switch-slider::after {
  transform: translateX(20px);
}

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

.company-empty {
  display: block !important;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
}

.company-icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #f1b4b4;
  border-radius: 8px;
  background: #fff1f1;
  color: var(--primary-strong);
}

.company-icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.company-icon-button:hover {
  border-color: var(--primary);
  background: #fee2e2;
}

.company-icon-button.danger {
  color: #991b1b;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr 42px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  overflow: hidden;
  color: var(--muted);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e5ecea;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.empty-state {
  padding: 18px;
  border: 1px dashed #b8c8c4;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f3f7f6;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #351010;
  color: #ffffff;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(320px, 86vw);
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 44px rgba(32, 11, 11, 0.28);
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  body.mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  body.menu-hidden .sidebar {
    display: flex;
  }

  .mobile-menu-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(32, 11, 11, 0.42);
  }

  .mobile-menu-button,
  .mobile-menu-close {
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--primary-strong);
    box-shadow: 0 8px 18px rgba(54, 18, 18, 0.08);
  }

  .mobile-menu-button {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    gap: 4px;
  }

  .mobile-menu-button span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .mobile-menu-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
  }

  .main-content {
    padding: 20px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: -20px -20px 20px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(248, 244, 243, 0.96);
    box-shadow: 0 10px 24px rgba(54, 18, 18, 0.08);
    backdrop-filter: blur(12px);
  }

  .topbar-title h1 {
    font-size: 1.45rem;
  }

  .topbar-title .eyebrow {
    margin-bottom: 3px;
  }

  .nav-list {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .sidebar-footer {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .split-layout,
  .chart-grid,
  .company-grid {
    grid-template-columns: 1fr;
  }

  .collaborator-actions {
    max-width: none;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 1180px) {
  .technician-access-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .technician-access-form .primary-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .main-content {
    padding: 16px;
  }

  .section-heading {
    display: grid;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin: -16px -16px 16px;
    padding: 10px 12px;
  }

  .topbar-title h1 {
    font-size: 1.28rem;
  }

  .topbar-title .eyebrow {
    font-size: 0.68rem;
  }

  .topbar-right {
    display: flex;
    justify-content: flex-end;
  }

  .topbar-summary {
    display: none;
  }

  .topbar-login-button {
    min-height: 40px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .account-trigger {
    min-height: 40px;
    padding: 4px 10px 4px 4px;
  }

  .account-avatar {
    width: 32px;
    height: 32px;
  }

  .account-copy strong,
  .account-copy small {
    max-width: 96px;
  }

  .topbar-summary,
  .filter-row,
  .technician-form,
  .technician-controls,
  .technician-actions,
  .modal-actions,
  .report-actions,
  .company-add-form,
  .form-grid,
  .collaborator-actions,
  .metric-grid,
  .dashboard-ticket-row {
    grid-template-columns: 1fr auto;
  }

  .dashboard-ticket-header {
    display: none;
  }

  .dashboard-ticket-id,
  .dashboard-ticket-requester,
  .dashboard-ticket-department,
  .dashboard-ticket-subject,
  .dashboard-ticket-date,
  .dashboard-ticket-waiting {
    grid-column: 1 / 2;
  }

  .dashboard-ticket-date {
    text-align: left;
  }

  .dashboard-ticket-state {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
  }

  .metric-grid,
  .collaborator-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-action-summary dl {
    grid-template-columns: 1fr;
  }

  .collaborator-action {
    min-height: 132px;
    padding: 22px;
  }

  .modal-overlay {
    align-items: start;
    padding: 14px;
  }

  .account-area {
    justify-self: end;
  }

  .compact-field {
    min-width: 0;
  }

  .report-actions label {
    min-width: 0;
  }

  .ticket-list.wide {
    grid-template-columns: 1fr;
  }

  .technician-access-form {
    grid-template-columns: 1fr;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .company-user-header {
    display: none !important;
  }

  .company-user-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .company-user-login,
  .user-access-select,
  .switch-control {
    grid-column: 1 / -1;
  }

  .company-user-list .company-actions {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  * {
    box-shadow: none !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    min-height: auto;
    background: #ffffff !important;
    color: #000000;
  }

  .app-shell {
    display: block;
    min-height: auto;
  }

  .sidebar,
  .toast,
  .modal-overlay,
  .view:not(#view-relatorios),
  .no-print {
    display: none !important;
  }

  .main-content {
    padding: 0;
  }

  .topbar {
    margin-bottom: 16px;
  }

  #view-relatorios,
  #view-relatorios.view.active {
    display: block !important;
  }

  #view-relatorios .panel {
    padding: 0;
    border: 0;
    background: #ffffff;
  }

  .report-actions {
    justify-content: flex-end;
  }

  .chart-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    break-inside: avoid;
  }

  .bar-fill {
    background: var(--primary) !important;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
    font-size: 0.72rem;
  }

  th,
  td {
    padding: 7px 8px;
  }
}
