:root {
  color-scheme: light;
  --bg: #eef3f1;
  --panel: #ffffff;
  --ink: #101820;
  --muted: #667085;
  --line: #d9e1e5;
  --brand: #6fb441;
  --brand-dark: #315f25;
  --warning: #9a5b00;
  --ok: #287a44;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(16, 24, 32, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(111, 180, 65, 0.1), transparent 36%),
    var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  font-size: 16px;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 44px);
  color: #f6fff2;
  background: #101820;
}

.brand,
.page-heading,
.panel-header,
.ticket-topline,
.toolbar,
.metrics {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.admin-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 22px;
  margin-right: auto;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.admin-nav-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: rgba(246, 255, 242, 0.82);
  background: transparent;
  font-weight: 800;
}

.admin-nav-button:hover,
.admin-nav-button.active {
  color: #102016;
  background: var(--brand);
}

.company-tagline {
  margin-left: auto;
  margin-right: 0;
  color: #b7e36d;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-nav:not(.hidden) + #logoutBtn {
  margin-left: 18px;
}

.notification-center {
  position: relative;
  margin-left: auto;
}

.admin-nav:not(.hidden) ~ .notification-center {
  margin-left: 16px;
}

.notification-button {
  position: relative;
  width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #102016;
  background: var(--brand);
  border-radius: var(--radius);
}

.notification-button span {
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 900;
}

.notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  color: #fff;
  background: #b91c1c;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: min(380px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid rgba(216, 224, 231, 0.95);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
}

.notification-panel small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.notification-list {
  display: grid;
  gap: 8px;
  max-height: 380px;
  margin-top: 12px;
  overflow: auto;
}

.notification-list article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdf9;
}

.notification-list article.unread {
  border-color: #bde7a6;
  background: #f1faea;
}

.notification-list span {
  color: #344054;
  line-height: 1.4;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(111, 180, 65, 0.85);
  border-radius: var(--radius);
  color: var(--brand);
  background: #17231f;
  font-weight: 900;
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 46px;
}

.login-screen {
  min-height: calc(100vh - 132px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 34px;
  align-items: center;
}

.login-copy h1,
.page-heading h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  line-height: 1.04;
}

.login-copy p,
.page-heading p {
  max-width: 620px;
  color: #344054;
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-heading-copy .eyebrow {
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

.login-card,
.panel,
.metrics article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card,
.panel {
  padding: 24px;
}

.login-card h2,
.panel h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.stack-form,
.ticket-form,
.ticket-admin-actions {
  display: grid;
  gap: 14px;
}

.stack-form,
.ticket-form {
  margin-top: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfa;
  color: var(--ink);
  outline: none;
}

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

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

.file-drop {
  position: relative;
  min-height: 132px;
  place-items: center;
  text-align: center;
  border: 1.5px dashed #a5b79d;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(111, 180, 65, 0.08), transparent),
    #fbfdf9;
  padding: 20px;
  cursor: pointer;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #102016;
  background: var(--brand);
  border-radius: var(--radius);
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 800;
}

.file-drop small {
  color: var(--muted);
  font-weight: 500;
}

.preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.preview-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.preview-item img {
  width: 100%;
  height: 86px;
  object-fit: cover;
  display: block;
}

.preview-item span {
  display: block;
  padding: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(111, 180, 65, 0.18);
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 16px;
  font-weight: 800;
}

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

.secondary-button {
  color: var(--ink);
  background: #e8eef0;
}

.danger-button {
  color: #7f1d1d;
  background: #fee2e2;
}

.danger-button:hover {
  background: #fecaca;
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.panel-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.panel-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.app-screen {
  display: grid;
  gap: 18px;
}

.page-heading {
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.panel-header {
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header {
  align-items: flex-start;
}

.toolbar {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar input {
  min-width: min(360px, 100%);
}

.toolbar select {
  min-width: 170px;
}

#companyFilter {
  min-width: 220px;
}

.admin-search-row {
  display: flex;
  justify-content: flex-end;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.admin-search-row input {
  width: min(520px, 100%);
}

.metrics {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metrics article {
  min-width: 128px;
  padding: 14px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
}

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

.client-list {
  display: grid;
  gap: 10px;
}

.client-search-row {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(260px, 420px);
  align-items: stretch;
  gap: 12px;
  margin: 0 0 14px;
}

.client-search-row input {
  width: 100%;
  min-height: 46px;
}

.client-role-filter {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4f8f6;
}

.client-role-filter-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 13px;
  color: #344054;
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.client-role-filter-button:hover {
  color: #102016;
  background: #e7efe9;
}

.client-role-filter-button.active {
  color: #102016;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(111, 180, 65, 0.22);
}

.client-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.client-card strong,
.client-card span,
.client-card small {
  display: block;
}

.client-card strong {
  margin-bottom: 6px;
}

.client-card-summary {
  min-width: 0;
}

.client-card span,
.client-card small {
  color: var(--muted);
  line-height: 1.45;
}

.client-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  align-items: center;
}

.client-card-actions .ticket-status {
  margin-right: 4px;
  flex: 0 0 auto;
}

.client-card-actions button {
  min-height: 40px;
  padding: 0 12px;
}

.client-edit-form {
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.ticket-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.client-ticket .ticket-card {
  grid-template-columns: 1fr;
}

.client-ticket .ticket-admin-actions {
  display: none;
}

.ticket-topline {
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ticket-protocol {
  font-size: 0.92rem;
}

.ticket-status,
.ticket-urgency {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: #e9f7df;
  font-size: 0.78rem;
  font-weight: 800;
}

.ticket-urgency {
  background: #f0f5f0;
  border: 1px solid #dbe8d8;
}

.ticket-urgency.sla-warning {
  color: #7a4a00;
  background: #fff4db;
  border-color: #f7d38a;
}

.ticket-urgency.sla-overdue {
  color: #7f1d1d;
  background: #fee2e2;
  border-color: #fecaca;
}

.ticket-urgency.sla-done {
  color: var(--ok);
  background: #e4f6ea;
  border-color: #bfe8ca;
}

.ticket-card.ticket-sla-warning {
  border-color: #f7c76d;
}

.ticket-card.ticket-sla-overdue {
  border-color: #fca5a5;
}

.sla-alert-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #f7d38a;
  border-radius: var(--radius);
  background: #fff8e8;
}

.sla-alert-panel h3,
.sla-alert-panel p {
  margin: 0;
}

.sla-alert-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.sla-alert-panel ul {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sla-alert-panel li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #f5dfad;
  border-radius: var(--radius);
  background: #fffdf8;
}

.sla-alert-panel em {
  font-style: normal;
  font-weight: 900;
}

.sla-alert-warning {
  color: #7a4a00;
}

.sla-alert-overdue {
  color: #991b1b;
}

.new-reply-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #7f1d1d;
  background: #fee2e2;
  font-size: 0.78rem;
  font-weight: 800;
}

.ticket-status.progress {
  color: #0f4f68;
  background: #dff4fb;
}

.ticket-status.waiting {
  color: var(--warning);
  background: #fff4db;
}

.ticket-status.done {
  color: var(--ok);
  background: #e4f6ea;
}

.ticket-status.cancelled {
  color: #7f1d1d;
  background: #fee2e2;
}

.ticket-card h3 {
  margin: 0 0 8px;
}

.ticket-meta,
.ticket-description,
.ticket-attachments {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ticket-description {
  margin-top: 8px;
  color: #344054;
}

.ticket-attachments {
  margin-top: 8px;
  font-size: 0.88rem;
}

.ticket-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ticket-image {
  overflow: hidden;
  width: 100%;
  min-height: 0;
  padding: 0;
  cursor: zoom-in;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.ticket-image img {
  display: block;
  width: 100%;
  height: 84px;
  object-fit: cover;
}

.ticket-image span {
  display: block;
  padding: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

details {
  margin-top: 12px;
}

.details-action {
  margin-top: 12px;
}

summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 800;
}

.ticket-history {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #344054;
  font-size: 0.86rem;
  line-height: 1.55;
}

.empty-state {
  padding: 26px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.ticket-dialog {
  width: min(920px, calc(100% - 28px));
  max-height: 88vh;
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 24, 32, 0.28);
}

.ticket-dialog::backdrop,
.image-dialog::backdrop {
  background: rgba(16, 24, 32, 0.55);
}

.image-dialog {
  width: min(980px, calc(100% - 28px));
  max-height: 92vh;
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 24, 32, 0.28);
}

.image-dialog-body {
  display: grid;
  place-items: center;
  padding: 16px;
  background: #101820;
}

.image-dialog-body img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 72vh;
  border-radius: var(--radius);
  object-fit: contain;
  background: #fff;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfa;
}

.dialog-header h2 {
  margin: 0;
}

.dialog-body {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dialog-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

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

.dialog-section h3 {
  margin: 0 0 10px;
}

.dialog-section p {
  margin: 6px 0;
  color: #344054;
  line-height: 1.5;
}

.comment-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.conversation-section {
  background: #fbfdf9;
}

.chat-thread {
  display: grid;
  gap: 10px;
}

.message-bubble {
  width: min(86%, 620px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.message-bubble strong {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.message-bubble p {
  margin: 0;
  color: var(--ink);
}

.admin-message {
  justify-self: end;
  border-color: #caeab6;
  background: #f0fae9;
}

.client-message {
  justify-self: start;
  border-color: #d8e0e7;
  background: #ffffff;
}

@media (max-width: 860px) {
  .login-screen,
  .form-grid,
  .ticket-card,
  .dialog-grid,
  .sla-alert-panel,
  .sla-alert-panel li {
    grid-template-columns: 1fr;
  }

  .topbar,
  .page-heading,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-nav {
    width: 100%;
    margin: 0;
    order: 3;
  }

  .admin-nav-button {
    flex: 1;
  }

  .company-tagline {
    margin: 0;
    font-size: 0.74rem;
  }

  .toolbar,
  .metrics {
    justify-content: stretch;
  }
}

/* Visual refinement inspired by Chamado 1.0 */
body {
  background:
    linear-gradient(180deg, rgba(20, 36, 29, 0.05), transparent 340px),
    radial-gradient(circle at 82% 18%, rgba(111, 180, 65, 0.10), transparent 260px),
    var(--bg);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  height: 72px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
}

.topbar::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: -1;
  height: 72px;
  background: rgba(16, 24, 32, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo-small {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius);
  background: #fff;
}

.login-screen {
  min-height: calc(100vh - 112px);
  grid-template-columns: minmax(0, 0.96fr) minmax(360px, 0.74fr);
  gap: 28px;
}

.login-screen.auth-signup {
  grid-template-columns: minmax(0, 0.86fr) minmax(360px, 0.82fr);
}

.login-copy {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px;
  text-align: center;
  color: #f9fafb;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(9, 15, 20, 0.88), rgba(9, 15, 20, 0.62)),
    url("assets/hero-cftv.png") center/cover,
    linear-gradient(135deg, #101820, #315f25);
  box-shadow: var(--shadow);
}

.login-copy::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 6px;
  background: linear-gradient(90deg, var(--brand), #b7e36d, var(--brand-dark));
}

.login-logo {
  position: absolute;
  left: 28px;
  top: 28px;
  width: 74px;
  height: 74px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.30);
}

.login-copy h1 {
  max-width: 760px;
  color: #fff;
  font-size: clamp(2.4rem, 5vw, 4.7rem);
}

.login-copy p {
  max-width: 620px;
  color: rgba(249, 250, 251, 0.86);
}

.login-copy .eyebrow {
  color: #b7e36d;
  opacity: 1;
}

.login-card,
.panel,
.metrics article,
.ticket-card,
.dialog-section {
  border: 1px solid rgba(216, 224, 231, 0.95);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card {
  position: relative;
  padding: 30px;
}

.text-button {
  width: max-content;
  min-height: 0;
  margin-top: 10px;
  padding: 0;
  color: var(--brand-dark);
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.text-button:hover {
  color: var(--brand-strong);
  background: transparent;
  text-decoration: underline;
}

.form-message {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.form-message.error {
  color: #991b1b;
}

.form-message.success {
  color: var(--brand-dark);
}

.primary-button {
  box-shadow: 0 12px 24px rgba(111, 180, 65, 0.24);
}

.ticket-admin-actions {
  padding: 12px;
  border: 1px solid #edf1f4;
  border-radius: var(--radius);
  background: #f8fbfa;
}

.ticket-card {
  transition: border-color 160ms ease, transform 160ms ease;
}

.ticket-card:hover {
  border-color: rgba(111, 180, 65, 0.55);
  transform: translateY(-1px);
}

.dialog-header {
  background: #101820;
  color: #fff;
}

.dialog-header .eyebrow {
  color: #b7e36d;
}

.dialog-header .secondary-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 860px) {
  .topbar {
    height: auto;
    min-height: 72px;
    padding: 12px 0;
  }

  .admin-nav {
    width: 100%;
    margin: 0;
  }

  .admin-nav-button {
    flex: 1;
  }

  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: 430px;
  }

  .login-logo {
    width: 62px;
    height: 62px;
  }
}

@media (max-width: 720px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  button,
  input,
  select {
    min-height: 44px;
  }

  body {
    background:
      linear-gradient(180deg, rgba(20, 36, 29, 0.05), transparent 240px),
      var(--bg);
  }

  main {
    width: min(100% - 20px, 1160px);
    padding: 14px 0 28px;
  }

  .topbar {
    width: min(100% - 20px, 1180px);
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand span {
    min-width: 0;
    overflow: hidden;
    font-size: 0.95rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .brand-logo-small {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .company-tagline {
    grid-column: 1 / -1;
    order: 4;
    width: 100%;
    margin: 0;
    font-size: 0.7rem;
    text-align: center;
    white-space: normal;
  }

  .admin-nav {
    grid-column: 1 / -1;
    order: 5;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .notification-center {
    margin-left: 0;
    justify-self: end;
  }

  .admin-nav:not(.hidden) ~ .notification-center {
    margin-left: 0;
  }

  #logoutBtn {
    min-height: 40px;
    padding: 0 12px;
    justify-self: end;
  }

  .notification-button {
    width: 40px;
    min-height: 40px;
  }

  .notification-panel {
    position: fixed;
    top: 74px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100dvh - 90px);
    overflow: auto;
  }

  .login-screen {
    min-height: auto;
    gap: 14px;
  }

  .login-copy {
    min-height: 320px;
    padding: 24px 18px;
  }

  .login-copy h1 {
    font-size: clamp(2rem, 12vw, 3.2rem);
  }

  .login-card,
  .panel {
    padding: 18px;
  }

  .login-card {
    width: 100%;
  }

  .page-heading {
    gap: 12px;
  }

  .page-heading h1 {
    font-size: clamp(2.2rem, 14vw, 3.5rem);
  }

  .admin-heading-copy .eyebrow {
    font-size: 0.9rem;
  }

  .metrics {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metrics article {
    min-width: 0;
    padding: 12px;
  }

  .toolbar,
  .actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .toolbar select,
  .toolbar input,
  .toolbar button,
  .actions button,
  .admin-search-row input,
  .client-search-row input {
    width: 100%;
  }

  .admin-search-row,
  .client-search-row {
    justify-content: stretch;
  }

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

  .client-role-filter {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .client-role-filter-button {
    flex: 1 0 auto;
  }

  .form-grid,
  .preview-list,
  .ticket-card,
  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .ticket-card {
    padding: 14px;
    overflow: hidden;
  }

  .ticket-topline {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .ticket-card h3 {
    font-size: 1.02rem;
    line-height: 1.35;
  }

  .ticket-meta,
  .ticket-description,
  .ticket-attachments {
    overflow-wrap: anywhere;
  }

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

  .ticket-admin-actions {
    padding: 10px;
  }

  .ticket-admin-actions button {
    width: 100%;
  }

  details,
  summary {
    width: 100%;
  }

  .client-card {
    padding: 12px;
    overflow: hidden;
  }

  .client-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .client-card-actions .ticket-status,
  .client-card-actions button {
    width: 100%;
    min-width: 0;
    margin-right: 0;
    justify-content: center;
    text-align: center;
  }

  .ticket-dialog,
  .image-dialog {
    width: calc(100% - 12px);
    max-width: calc(100% - 12px);
    max-height: calc(100dvh - 12px);
  }

  .dialog-header {
    gap: 12px;
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-body {
    padding: 14px;
    max-height: calc(100dvh - 122px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .message-bubble {
    width: 100%;
    overflow-wrap: anywhere;
  }

  .sla-alert-panel {
    padding: 14px;
  }

  .sla-alert-panel li {
    align-items: stretch;
  }
}

@media (max-width: 420px) {
  .metrics,
  .client-card-actions,
  .ticket-images {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: 250px;
    padding: 22px 16px;
  }

  .login-logo {
    width: 52px;
    height: 52px;
    left: 18px;
    top: 18px;
  }

  .login-copy h1 {
    font-size: clamp(1.85rem, 11vw, 2.65rem);
  }

  .login-copy p {
    font-size: 0.95rem;
  }

  .brand span {
    max-width: 145px;
  }

  .admin-nav-button {
    min-width: 120px;
  }

  .page-heading h1 {
    font-size: clamp(1.95rem, 12vw, 2.8rem);
  }
}
