:host {
  display: block;
  min-height: 100vh;
}

.loading-screen,
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(245, 158, 11, 0.10)),
    #f6f8fb;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid #dde5ee;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(24, 32, 42, 0.12);
}

.login-panel h1,
.login-panel p {
  margin: 0;
}

.login-panel h1 {
  margin-top: 14px;
  font-size: 28px;
  font-weight: 700;
}

.login-panel p {
  margin-top: 8px;
  color: #5b6673;
  line-height: 1.45;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

.app-shell {
  min-height: 100vh;
  background: #f6f8fb;
}

.sidenav {
  width: 244px;
  border-right: 1px solid #dfe7ef;
  background: #ffffff;
}

.side-title {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  color: #0f766e;
  font-size: 20px;
  font-weight: 700;
}

.nav-button {
  width: calc(100% - 20px);
  justify-content: flex-start;
  margin: 4px 10px;
  color: #334155;
}

.nav-button mat-icon {
  margin-right: 10px;
}

.nav-button.active {
  background: #dff4ef;
  color: #0f766e;
}

.topbar {
  height: 72px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid #dfe7ef;
}

.topbar h2 {
  margin: 2px 0 0;
  font-size: 22px;
  text-transform: capitalize;
}

.eyebrow {
  font-size: 12px;
  color: #667085;
  font-weight: 600;
}

.spacer {
  flex: 1 1 auto;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  margin: 0 12px;
  padding: 0 12px;
  border: 1px solid #d8e1ea;
  border-radius: 999px;
  color: #334155;
  background: #f8fafc;
  font-size: 14px;
}

.content {
  padding: 24px;
}

.alert-banner,
.inline-error,
.inline-status {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  line-height: 1.4;
}

.alert-banner {
  margin-bottom: 16px;
  padding: 12px 12px 12px 14px;
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: #991b1b;
}

.alert-banner span {
  flex: 1 1 auto;
}

.inline-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  background: #fff7f7;
  color: #9f1239;
  font-size: 14px;
}

.inline-status {
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 14px;
}

.inline-error mat-icon,
.inline-status mat-icon,
.alert-banner mat-icon {
  flex: 0 0 auto;
}

.view-stack {
  display: grid;
  gap: 20px;
}

.section-header,
.panel-header,
.table-footer,
.button-row,
.detail-title,
.result-head,
.result-actions {
  display: flex;
  align-items: center;
}

.section-header {
  justify-content: space-between;
  gap: 18px;
}

.section-header h3,
.section-header p,
.panel-header h4,
.result-row h4 {
  margin: 0;
}

.section-header h3 {
  font-size: 24px;
}

.section-header p {
  margin-top: 4px;
  color: #667085;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.kpi-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  padding: 18px;
  border: 1px solid #dfe7ef;
  box-shadow: none;
}

.kpi-card mat-icon {
  grid-row: span 2;
  color: #0f766e;
}

.kpi-card span {
  color: #667085;
  font-size: 13px;
}

.kpi-card strong {
  font-size: 28px;
  line-height: 1;
}

.kpi-card.warn.hot mat-icon,
.kpi-card.warn.hot strong {
  color: #b45309;
}

.dashboard-grid,
.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 18px;
}

.panel,
.table-panel,
.detail-panel {
  background: #ffffff;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
}

.panel,
.detail-panel {
  padding: 18px;
}

.panel-header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-header h4 {
  font-size: 18px;
}

.status-bad {
  color: #b42318;
  font-size: 13px;
  font-weight: 600;
}

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

.compact-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #edf1f5;
  border-radius: 6px;
  background: #ffffff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.compact-row:hover,
.selected-row {
  background: #edf8f6;
}

.ticket-number {
  color: #0f766e;
  font-weight: 700;
}

.compact-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-meta {
  color: #667085;
  font-size: 13px;
}

.empty-text,
.empty-state {
  color: #667085;
}

.filter-bar,
.search-panel,
.filter-create,
.settings-grid {
  display: grid;
  gap: 12px;
}

.filter-bar {
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(140px, 1fr)) auto;
  align-items: center;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
}

.filter-bar.compact {
  grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
}

.user-filter {
  grid-template-columns: minmax(240px, 0.45fr) 180px;
}

.filter-bar .mat-mdc-form-field,
.search-panel .mat-mdc-form-field,
.filter-create .mat-mdc-form-field,
.settings-grid .mat-mdc-form-field {
  width: 100%;
}

.search-panel {
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
}

.search-input {
  min-width: 0;
}

.table-panel {
  overflow: auto;
}

.data-table {
  width: 100%;
}

.data-table th {
  color: #667085;
  font-weight: 700;
}

.data-table td,
.data-table th {
  white-space: nowrap;
}

.data-table td:nth-child(3) {
  min-width: 280px;
  white-space: normal;
}

.table-footer {
  justify-content: space-between;
  min-height: 56px;
  padding: 0 16px;
  border-top: 1px solid #edf1f5;
  color: #667085;
}

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

.detail-title {
  justify-content: space-between;
  gap: 12px;
}

.detail-title strong {
  font-size: 22px;
  color: #0f766e;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-meta span,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2f6;
  color: #334155;
  font-size: 13px;
}

.status-pill.pending {
  background: #fef3c7;
  color: #92400e;
}

.detail-panel h5 {
  margin: 0;
  font-size: 18px;
}

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

.text-columns article {
  padding: 14px;
  border: 1px solid #edf1f5;
  border-radius: 8px;
  background: #fbfcfe;
}

.text-columns h6 {
  margin: 0 0 8px;
  color: #0f766e;
  font-size: 14px;
}

.text-columns p {
  margin: 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.results-stack {
  display: grid;
  gap: 12px;
}

.result-row {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #ffffff;
}

.result-head {
  justify-content: space-between;
  gap: 12px;
}

.result-head strong {
  color: #0f766e;
  font-size: 18px;
}

.result-head span {
  margin-left: 10px;
  color: #667085;
}

.result-row p {
  margin: 0;
  color: #334155;
  line-height: 1.45;
}

.empty-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px dashed #cbd5df;
  border-radius: 8px;
  background: #ffffff;
}

.user-table tr.mat-mdc-row {
  cursor: pointer;
}

.user-detail {
  min-width: 0;
}

.tab-content {
  display: grid;
  gap: 14px;
  padding: 16px 0 0;
}

.filter-create {
  grid-template-columns: 150px minmax(180px, 1fr) 140px auto;
  align-items: center;
}

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

.filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #edf1f5;
  border-radius: 8px;
}

.filter-item div {
  display: grid;
  gap: 3px;
}

.filter-item span {
  color: #667085;
}

.settings-form {
  align-items: start;
}

.settings-grid {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.button-row {
  justify-content: flex-end;
  gap: 10px;
}

.pick-user {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 10px;
  color: #667085;
  text-align: center;
}

.pick-user mat-icon {
  color: #0f766e;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .dashboard-grid,
  .users-layout,
  .text-columns {
    grid-template-columns: 1fr;
  }

  .filter-bar,
  .filter-bar.compact,
  .search-panel,
  .filter-create,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sidenav {
    width: 84px;
  }

  .side-title span,
  .nav-button span,
  .user-pill span {
    display: none;
  }

  .nav-button {
    justify-content: center;
  }

  .nav-button mat-icon {
    margin-right: 0;
  }

  .topbar {
    padding: 0 12px;
  }

  .content {
    padding: 14px;
  }

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