:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --border: #e3e8f2;
  --border-strong: #d4dceb;
  --text: #142033;
  --muted: #667085;
  --muted-2: #98a2b3;
  --accent: #2563eb;
  --accent-weak: #eaf1ff;
  --success: #14804a;
  --radius: 8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: #1d4ed8;
  text-decoration: none;
}

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

.app-sidebar {
  background: #0f172a;
  color: #e5edf8;
  height: 100vh;
  padding: 22px 18px;
  position: sticky;
  top: 0;
}

.brand {
  align-items: center;
  color: #fff;
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.brand:hover { color: #fff; }

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  border-radius: 8px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

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

.brand small {
  color: #9fb2cc;
  font-size: 12px;
  margin-top: 2px;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav a {
  align-items: center;
  border-radius: 8px;
  color: #c9d6e8;
  display: flex;
  font-size: 14px;
  font-weight: 600;
  gap: 10px;
  padding: 10px 12px;
}

.side-nav a:hover {
  background: #1e293b;
  color: #fff;
}

.side-nav a.active {
  background: #1d4ed8;
  color: #fff;
}

.side-nav a.active .nav-icon {
  color: #fff;
}

.nav-icon {
  color: #7dd3fc;
  display: inline-block;
  text-align: center;
  width: 18px;
}

.sidebar-note {
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  bottom: 18px;
  color: #c7d9f1;
  font-size: 12px;
  left: 18px;
  line-height: 1.45;
  padding: 12px;
  position: absolute;
  right: 18px;
}

.note-dot {
  background: #38bdf8;
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  margin-right: 6px;
  width: 8px;
}

.app-main { min-width: 0; }

.topbar {
  align-items: center;
  background: rgba(246, 248, 251, 0.94);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 68px;
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-search {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted-2);
  display: flex;
  gap: 8px;
  max-width: 420px;
  padding: 8px 12px;
  width: 100%;
}

.topbar-search input {
  border: 0;
  color: var(--text);
  font-size: 14px;
  outline: 0;
  width: 100%;
}

.topbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.user-chip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  display: flex;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
  padding: 5px 10px 5px 5px;
}

.avatar {
  align-items: center;
  background: var(--accent-weak);
  border-radius: 50%;
  color: var(--accent);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.content-shell { padding: 28px; }

.auth-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  width: 100%;
}

.auth-layout {
  display: flex;
  justify-content: center;
  width: 100%;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(20, 32, 51, 0.08);
  max-width: 460px;
  padding: 34px;
  width: min(460px, calc(100vw - 40px));
}

.auth-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 26px;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand strong {
  font-size: 15px;
}

.auth-brand span {
  color: var(--muted);
  font-size: 13px;
}

.auth-panel h1 {
  font-size: 30px;
  font-weight: 780;
  line-height: 1.15;
  margin: 0;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 10px 0 24px;
}

.auth-form .form-label {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 7px;
}

.auth-form .form-control {
  box-sizing: border-box;
  min-height: 46px;
  width: 100%;
}

.demo-logins {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 20px;
  padding: 14px;
}

.demo-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.demo-grid {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.demo-grid span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.demo-grid code {
  color: #be185d;
  font-size: 13px;
  white-space: nowrap;
}

.page-head {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title {
  font-size: 28px;
  font-weight: 760;
  line-height: 1.2;
  margin: 0;
}

.page-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 0;
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.card-header,
.panel-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 14px 16px;
}

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

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  color: var(--text);
  font-size: 30px;
  font-weight: 780;
  line-height: 1.1;
  margin-top: 8px;
}

.metric-hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 12px;
}

.form-control,
.form-select {
  border-color: var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
}

.form-control:focus,
.form-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn {
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.form-page {
  display: flex;
  justify-content: center;
  width: 100%;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 920px;
  width: 100%;
}

.form-card-head {
  border-bottom: 1px solid var(--border);
  padding: 26px 30px 18px;
}

.form-card-head h1 {
  font-size: 28px;
  font-weight: 780;
  line-height: 1.2;
  margin: 0;
}

.form-card-head p {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 0;
}

.app-form {
  padding: 26px 30px 30px;
}

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

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

.form-field-wide {
  grid-column: 1 / -1;
}

.app-form .form-label {
  color: var(--text);
  display: block;
  font-size: 14px;
  font-weight: 750;
  margin-bottom: 7px;
}

.app-form .form-control,
.app-form .form-select {
  min-height: 44px;
  width: 100%;
}

.app-form textarea.form-control {
  min-height: 180px;
  resize: vertical;
}

.form-help {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.form-errors {
  color: #b42318;
  font-size: 13px;
  margin-top: 7px;
}

.form-errors ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.form-actions {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
}

.comment-form {
  display: grid;
  gap: 10px;
}

.comment-form .form-label {
  font-size: 14px;
  font-weight: 750;
  margin: 0;
}

.comment-form textarea {
  min-height: 96px;
}

.table {
  --bs-table-bg: transparent;
  font-size: 14px;
}

.table thead th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.table td,
.table th { padding: 13px 16px; }

.status-pill,
.priority-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
}

.status-new { background: #eef4ff; color: #1d4ed8; }
.status-assigned { background: #f2f4f7; color: #475467; }
.status-in_progress { background: #fff7ed; color: #b45309; }
.status-resolved,
.status-closed { background: #ecfdf3; color: #047857; }
.status-rejected { background: #fef2f2; color: #b42318; }

.priority-low { background: #f2f4f7; color: #475467; }
.priority-medium { background: #eef4ff; color: #1d4ed8; }
.priority-normal { background: #eef4ff; color: #1d4ed8; }
.priority-high { background: #fff7ed; color: #b45309; }
.priority-urgent { background: #fef2f2; color: #b42318; }
.priority-critical { background: #fef2f2; color: #b42318; }

.queue-title {
  color: var(--text);
  font-weight: 750;
}

.muted-line {
  color: var(--muted);
  font-size: 13px;
}

.qr-card { text-align: center; }

.qr-img {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: auto;
  max-width: 100%;
  padding: 10px;
  width: 210px;
}

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

.definition-grid dt {
  color: var(--muted);
  font-size: 12px;
}

.definition-grid dd {
  font-weight: 700;
  margin: 2px 0 0;
}

.recommendation { border-left: 3px solid var(--accent); }

.score-badge {
  background: #ecfdf3;
  border-radius: 999px;
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.timeline-item {
  border-left: 2px solid var(--border);
  margin-left: 8px;
  padding: 0 0 16px 18px;
  position: relative;
}

.timeline-item::before {
  background: var(--accent);
  border: 3px solid var(--surface);
  border-radius: 50%;
  content: "";
  height: 12px;
  left: -7px;
  position: absolute;
  top: 4px;
  width: 12px;
}

@media (max-width: 992px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    height: auto;
    position: static;
  }
  .sidebar-note { display: none; }
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 576px) {
  .content-shell { padding: 18px; }
  .page-head { display: block; }
  .page-head .btn,
  .page-head .btn-group {
    margin-top: 12px;
    width: 100%;
  }
  .metric-grid,
  .definition-grid { grid-template-columns: 1fr; }
}
