:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef2f6;
  --text: #18202a;
  --muted: #5f6b7a;
  --line: #d9e0e8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --focus: #2563eb;
}

* {
  box-sizing: border-box;
}

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

header {
  background: #17212f;
  color: #ffffff;
  padding: 18px clamp(16px, 4vw, 40px);
}

header h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: 0;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

nav a {
  color: #d5f3ee;
  text-decoration: none;
  font-weight: 600;
}

main {
  width: min(1180px, calc(100% - 24px));
  margin: 24px auto 48px;
}

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

.grid-wide {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 16px;
}

@media (max-width: 820px) {
  .grid-wide {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(26, 34, 44, 0.06);
}

.panel h2,
.panel h3 {
  margin: 0 0 14px;
  letter-spacing: 0;
}

.panel h2 {
  font-size: 20px;
}

.panel h3 {
  font-size: 17px;
}

.stack {
  display: grid;
  gap: 14px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  border-color: var(--focus);
}

button,
.button-link {
  border: 0;
  border-radius: 6px;
  padding: 10px 13px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
}

button:hover,
.button-link:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #334155;
}

button.warning {
  background: var(--warning);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.muted {
  color: var(--muted);
}

.status {
  min-height: 44px;
  border-radius: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status.ok {
  border-color: rgba(6, 118, 71, 0.32);
  background: #ecfdf3;
  color: var(--success);
}

.status.error {
  border-color: rgba(180, 35, 24, 0.35);
  background: #fef3f2;
}

.ticket-number {
  font-size: clamp(42px, 11vw, 88px);
  line-height: 0.98;
  font-weight: 850;
  letter-spacing: 0;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.metric {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

pre {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #101828;
  color: #f8fafc;
  padding: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.ticket-card {
  display: grid;
  grid-template-columns: minmax(84px, 120px) 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.ticket-card.new {
  border-color: var(--success);
  box-shadow: 0 0 0 4px rgba(6, 118, 71, 0.12);
}

.ticket-card .number {
  font-size: 30px;
  font-weight: 850;
}

.ticket-card .details {
  display: grid;
  gap: 3px;
  color: var(--muted);
}

.display-board {
  background: #111827;
  color: #ffffff;
  border-radius: 8px;
  padding: clamp(16px, 3vw, 28px);
}

.display-board .ticket-card {
  background: #1f2937;
  border-color: #374151;
  color: #ffffff;
}

.display-board .details {
  color: #cbd5e1;
}

.display-board h2,
.display-board h3 {
  color: #ffffff;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fbfcfe;
}

/* User profile menu (rendered by app.js#checkAuth into #userProfileInfo).
   Uses the #userProfileInfo id (present wherever the widget is mounted, with
   or without the .header-profile layout class) so it renders correctly both
   in a dark page header (admin.html) and inside a plain light panel
   (operator.html) — the trigger has its own solid background rather than a
   transparent one, so it never blends into whatever it's placed on. */
#userProfileInfo {
  position: relative;
  flex-shrink: 0;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  min-height: auto;
  transition: all 0.2s ease;
}

.profile-trigger:hover {
  background: #273449;
}

.profile-trigger .profile-caret {
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

#userProfileInfo.open .profile-trigger .profile-caret {
  transform: rotate(180deg);
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  z-index: 20;
}

#userProfileInfo.open .profile-dropdown {
  display: block;
}

.profile-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.profile-dropdown-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.profile-dropdown-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.profile-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  min-height: auto;
}

.profile-dropdown-item:hover {
  background: #f8fafc;
}

.profile-dropdown-item.logout {
  color: #ef4444;
}
