:root {
  --tk-bg: #eef2f7;
  --tk-surface: #ffffff;
  --tk-panel: #f8fafc;
  --tk-line: #d8dee8;
  --tk-line-strong: #c7d0dd;
  --tk-text: #162033;
  --tk-muted: #607089;
  --tk-navy: #10233f;
  --tk-blue: #2563eb;
  --tk-green: #15803d;
  --tk-amber: #b45309;
  --tk-red: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--tk-bg);
  color: var(--tk-text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
}

.tk-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

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

.tk-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--tk-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tk-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--tk-text);
  text-decoration: none;
}

.tk-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--tk-navy);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}

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

.tk-brand strong {
  font-size: 16px;
  line-height: 1.1;
}

.tk-brand small {
  margin-top: 2px;
  color: var(--tk-muted);
  font-size: 12px;
}

.tk-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tk-nav a,
.tk-link-button {
  border: 0;
  background: transparent;
  color: var(--tk-navy);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  padding: 8px;
}

.tk-page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.tk-login-shell {
  width: min(440px, 100%);
  padding: 20px;
}

.tk-login-panel {
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: 8px;
  padding: 22px;
}

.tk-login-heading {
  margin: 26px 0 18px;
}

.tk-login-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.tk-login-heading p {
  margin: 8px 0 0;
  color: var(--tk-muted);
  font-size: 14px;
}

.tk-login-form {
  display: grid;
  gap: 12px;
}

.tk-login-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--tk-muted);
  font-size: 12px;
  font-weight: 800;
}

.tk-login-form input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--tk-line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--tk-text);
  padding: 8px 10px;
  outline: none;
}

.tk-login-form input:focus {
  border-color: var(--tk-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.tk-title-row h1 {
  margin: 0;
  color: var(--tk-text);
  font-size: 30px;
  line-height: 1.15;
}

.tk-title-row p {
  margin: 6px 0 0;
  color: var(--tk-muted);
  font-size: 14px;
}

.tk-title-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tk-back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--tk-blue);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.tk-alert {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 800;
}

.tk-alert-success {
  background: #dcfce7;
  color: #14532d;
  border: 1px solid #86efac;
}

.tk-alert-error {
  background: #fee2e2;
  color: #7f1d1d;
  border: 1px solid #fca5a5;
}

.tk-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.tk-metrics-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tk-metric {
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.tk-metric span,
.tk-metric small {
  display: block;
  color: var(--tk-muted);
  font-size: 12px;
  font-weight: 800;
}

.tk-metric strong {
  display: block;
  margin-top: 6px;
  color: var(--tk-text);
  font-size: 26px;
  line-height: 1.1;
  word-break: break-word;
}

.tk-metric small {
  margin-top: 8px;
  font-weight: 700;
}

.tk-metric-danger strong {
  color: var(--tk-red);
}

.tk-metric-good strong {
  color: var(--tk-green);
}

.tk-band {
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}

.tk-band-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tk-band-head-wrap {
  align-items: flex-start;
}

.tk-band h2 {
  margin: 0;
  font-size: 18px;
  color: var(--tk-text);
}

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

.tk-form-grid label {
  min-width: 0;
}

.tk-form-grid span,
.tk-filter label {
  display: block;
  margin-bottom: 6px;
  color: var(--tk-muted);
  font-size: 12px;
  font-weight: 800;
}

.tk-form-grid input,
.tk-form-grid select,
.tk-form-grid textarea,
.tk-filter input,
.tk-filter select,
.tk-compact-table input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--tk-line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--tk-text);
  padding: 8px 10px;
  outline: none;
}

.tk-form-grid input:focus,
.tk-form-grid select:focus,
.tk-form-grid textarea:focus,
.tk-filter input:focus,
.tk-filter select:focus,
.tk-compact-table input:focus {
  border-color: var(--tk-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.tk-form-grid textarea {
  min-height: 96px;
  resize: vertical;
}

.tk-wide {
  grid-column: 1 / -1;
}

.tk-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin-top: 20px;
}

.tk-check-row input {
  width: 18px;
  min-height: 18px;
  height: 18px;
}

.tk-check-row span {
  margin: 0;
  color: var(--tk-text);
}

.tk-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.tk-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--tk-blue);
  color: #ffffff;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

.tk-button-dark {
  background: var(--tk-navy);
}

.tk-filter {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 150px auto;
  gap: 8px;
  align-items: end;
  width: min(760px, 100%);
}

.tk-table-wrap {
  overflow-x: auto;
}

.tk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tk-table th {
  background: var(--tk-panel);
  color: var(--tk-muted);
  border-bottom: 1px solid var(--tk-line);
  padding: 10px;
  text-align: left;
  white-space: nowrap;
}

.tk-table td {
  border-bottom: 1px solid var(--tk-line);
  padding: 12px 10px;
  vertical-align: top;
}

.tk-table td small,
.tk-ticket-link + small {
  display: block;
  margin-top: 4px;
  color: var(--tk-muted);
  font-size: 12px;
}

.tk-ticket-link {
  color: var(--tk-blue);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.tk-subject {
  min-width: 240px;
}

.tk-empty {
  color: var(--tk-muted);
  text-align: center;
  padding: 22px !important;
}

.tk-badge,
.tk-sla {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
  text-transform: capitalize;
  white-space: nowrap;
}

.tk-status-new {
  background: #dbeafe;
  color: #1d4ed8;
}

.tk-status-open {
  background: #e0f2fe;
  color: #0369a1;
}

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

.tk-status-resolved,
.tk-status-closed,
.tk-sla-met,
.tk-comment-reply {
  background: #dcfce7;
  color: #166534;
}

.tk-priority-urgent,
.tk-sla-breached {
  background: #fee2e2;
  color: #991b1b;
}

.tk-priority-high {
  background: #ffedd5;
  color: #9a3412;
}

.tk-priority-medium,
.tk-comment-note {
  background: #dbeafe;
  color: #1e40af;
}

.tk-priority-low,
.tk-sla-pending,
.tk-comment-system {
  background: #f1f5f9;
  color: #475569;
}

.tk-two-column,
.tk-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.48fr);
  gap: 18px;
  align-items: start;
}

.tk-compact-table td,
.tk-compact-table th {
  padding: 9px;
}

.tk-priority-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tk-priority-row {
  border: 1px solid var(--tk-line);
  border-radius: 8px;
  padding: 12px;
  background: var(--tk-panel);
}

.tk-priority-row strong,
.tk-priority-row small {
  display: block;
}

.tk-priority-row strong {
  margin-top: 10px;
  font-size: 24px;
}

.tk-priority-row small {
  color: var(--tk-muted);
  font-size: 12px;
}

.tk-record-list {
  margin: 0;
}

.tk-record-list div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--tk-line);
  padding: 10px 0;
}

.tk-record-list dt {
  color: var(--tk-muted);
  font-size: 12px;
  font-weight: 900;
}

.tk-record-list dd {
  margin: 0;
  color: var(--tk-text);
  font-weight: 800;
}

.tk-timeline {
  display: grid;
  gap: 10px;
}

.tk-timeline-item {
  border: 1px solid var(--tk-line);
  border-radius: 8px;
  background: var(--tk-panel);
  padding: 12px;
}

.tk-timeline-item div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tk-timeline-item p {
  margin: 10px 0;
  white-space: pre-wrap;
}

.tk-timeline-item small {
  color: var(--tk-muted);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .tk-metrics,
  .tk-priority-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .tk-two-column,
  .tk-detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .tk-header,
  .tk-title-row,
  .tk-band-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tk-header {
    position: static;
    padding: 14px;
  }

  .tk-page {
    padding: 14px;
  }

  .tk-metrics,
  .tk-metrics-four,
  .tk-priority-grid,
  .tk-form-grid,
  .tk-filter {
    grid-template-columns: 1fr;
  }

  .tk-form-actions,
  .tk-button,
  .tk-filter {
    width: 100%;
  }

  .tk-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }

  .tk-record-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
