@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Kalam:wght@400;700&display=swap");

:root {
  --bg: #f4f9ff;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --text: #052e3f;
  --muted: #6b7280;
  --border: rgba(5, 46, 63, 0.14);
  --accent: #1093bd;
  --accent-2: #5694ae;
  --cta-1: #f09c2d;
  --cta-2: #f05613;
  --danger: #ef4444;
  --shadow: 0 14px 34px rgba(5, 46, 63, 0.12);
  --shadow-sm: 0 8px 18px rgba(5, 46, 63, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --font-sans: "Eudoxus Sans", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans",
    sans-serif;
  --font-accent: Kalam, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  background: radial-gradient(1100px 750px at 10% 0%, rgba(16, 147, 189, 0.18), transparent 60%),
    radial-gradient(950px 700px at 95% 18%, rgba(240, 86, 19, 0.12), transparent 58%),
    radial-gradient(800px 600px at 70% 95%, rgba(86, 148, 174, 0.14), transparent 55%), var(--bg);
  color: var(--text);
}

body:not(.auth-page) {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar__header,
.sidebar__footer {
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.sidebar__footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
  justify-content: flex-start;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text);
}

.brand::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background-image: linear-gradient(90deg, var(--cta-1), var(--cta-2));
  display: inline-block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(5, 46, 63, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.btn:hover {
  border-color: rgba(16, 147, 189, 0.5);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  border-color: rgba(5, 46, 63, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.btn:disabled:hover {
  border-color: rgba(5, 46, 63, 0.12);
  box-shadow: none;
  transform: none;
}

.btn--primary {
  color: #fff;
  border-color: transparent;
  background-image: linear-gradient(90deg, var(--cta-1), var(--cta-2));
  box-shadow: 0 14px 34px rgba(240, 86, 19, 0.2);
}

.btn--danger {
  border-color: rgba(239, 68, 68, 0.6);
}

.sidebar__threads {
  padding: 10px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.thread-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 4px;
  border-radius: 14px;
}

.thread-row--archived {
  padding: 2px 4px;
  border: 1px solid rgba(143, 96, 53, 0.46);
  background: linear-gradient(90deg, rgba(190, 139, 90, 0.23), rgba(155, 113, 74, 0.14));
}

.thread {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.thread:hover {
  background: rgba(16, 147, 189, 0.08);
}

.thread--active {
  border-color: rgba(16, 147, 189, 0.55);
  background: rgba(16, 147, 189, 0.12);
}

.thread-row--archived .thread {
  border-color: transparent;
  background: transparent;
}

.thread-row--archived .thread:hover {
  background: rgba(209, 168, 126, 0.24);
}

.thread-row--archived .thread__title {
  color: rgba(99, 58, 22, 0.92);
}

.thread-row--archived .thread__meta {
  color: rgba(110, 70, 35, 0.68);
}

.thread-row--archived .thread--active {
  border-color: rgba(143, 96, 53, 0.65);
  background: rgba(173, 124, 79, 0.28);
}

.thread__title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread__meta {
  color: var(--muted);
  font-size: 12px;
}

.thread-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.thread-row:hover .thread-actions,
.thread-row:focus-within .thread-actions {
  opacity: 1;
  pointer-events: auto;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.icon-btn:hover {
  border-color: rgba(16, 147, 189, 0.5);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn--danger {
  border-color: rgba(239, 68, 68, 0.55);
}

.icon-btn--danger:hover {
  border-color: rgba(239, 68, 68, 0.8);
}

.main {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.main__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.thread-title {
  font-weight: 700;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-link {
  color: var(--text);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(16, 147, 189, 0.55);
  text-underline-offset: 4px;
}

.user-link:hover {
  text-decoration-color: rgba(16, 147, 189, 0.95);
}

.main__content {
  padding: 18px 20px;
  overflow: auto;
  overflow-anchor: none;
  scroll-behavior: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.msg {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px 10px;
  max-width: 900px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 0 rgba(5, 46, 63, 0.04);
}

.msg-stream-spacer {
  flex: 0 0 auto;
  pointer-events: none;
}

.msg--user {
  align-self: flex-end;
  background: rgba(16, 147, 189, 0.12);
  border-color: rgba(16, 147, 189, 0.28);
}

.msg--assistant,
.msg--system {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.86);
}

.msg__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.msg__actions {
  display: flex;
  gap: 8px;
}

.msg__content {
  white-space: pre-wrap;
  line-height: 1.55;
}

.msg__content table.md-table,
.msg__content table.md-table th,
.msg__content table.md-table td {
  white-space: normal;
}

.msg__content ul,
.msg__content ol {
  margin: 10px 0 0;
  padding-left: 24px;
}

.msg__content li + li {
  margin-top: 4px;
}

.msg__content h1,
.msg__content h2,
.msg__content h3,
.msg__content h4,
.msg__content h5,
.msg__content h6 {
  margin: 8px 0 0;
  line-height: 1.3;
  color: var(--text);
}

.source-ref {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
}

.source-ref__link {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 360px);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 147, 189, 0.24);
  background: rgba(16, 147, 189, 0.09);
  color: #055f7b;
  font-size: 0.93em;
  font-weight: 700;
  text-decoration: none;
  text-underline-offset: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.source-ref__link:hover,
.source-ref__link:focus-visible {
  border-color: rgba(16, 147, 189, 0.42);
  background: rgba(16, 147, 189, 0.14);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  text-decoration: none;
}

.source-ref__popover {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 12;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  width: min(360px, calc(100vw - 56px));
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(5, 46, 63, 0.14);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.source-ref:hover .source-ref__popover,
.source-ref:focus-within .source-ref__popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.source-ref__thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(5, 46, 63, 0.06);
  border: 1px solid rgba(5, 46, 63, 0.08);
}

.source-ref__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.source-ref__title {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--text);
}

.source-ref__type {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(5, 46, 63, 0.12);
  background: rgba(5, 46, 63, 0.04);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.source-ref__url {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

.msg__followups {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.msg__rating {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rating-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease, color 120ms ease, background-color 120ms ease;
}

.rating-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.rating-btn--active-up {
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.5);
  background: rgba(13, 148, 136, 0.12);
}

.rating-btn--active-down {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.5);
  background: rgba(220, 38, 38, 0.12);
}

.msg--system {
  border-color: rgba(240, 156, 45, 0.35);
  background: rgba(240, 156, 45, 0.12);
}

.msg__meta-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.msg__role-generating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.msg__typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.msg__typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(5, 46, 63, 0.48);
  animation: msgTypingPulse 1.1s infinite ease-in-out;
}

.msg__typing-dot:nth-child(2) {
  animation-delay: 0.18s;
}

.msg__typing-dot:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes msgTypingPulse {
  0%,
  80%,
  100% {
    transform: scale(0.75);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(5, 46, 63, 0.18);
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
}

.badge--system {
  border-color: rgba(240, 156, 45, 0.4);
  background: rgba(240, 156, 45, 0.12);
  color: rgba(124, 45, 18, 0.9);
}

.badge--short {
  border-color: rgba(16, 147, 189, 0.4);
  background: rgba(16, 147, 189, 0.1);
  color: rgba(3, 105, 161, 0.95);
}

.btn--sm {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.msg__content pre {
  margin: 10px 0 0;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(5, 46, 63, 0.14);
  background: rgba(5, 46, 63, 0.04);
  overflow: auto;
}

.msg__content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background: rgba(5, 46, 63, 0.06);
  border: 1px solid rgba(5, 46, 63, 0.1);
  padding: 1px 6px;
  border-radius: 8px;
}

.msg__content pre code {
  background: transparent;
  border: none;
  padding: 0;
}

.msg__content table.md-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  border: 1px solid rgba(5, 46, 63, 0.14);
  border-radius: 12px;
  overflow: hidden;
}

.msg__content table.md-table th,
.msg__content table.md-table td {
  border-bottom: 1px solid rgba(5, 46, 63, 0.12);
  padding: 8px 10px;
  vertical-align: top;
}

.msg__content table.md-table th {
  background: rgba(16, 147, 189, 0.08);
  font-weight: 700;
}

.msg__content table.md-table tr:last-child td {
  border-bottom: none;
}

.aux-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin-right: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  cursor: pointer;
}

.chip--followup {
  border-color: rgba(16, 147, 189, 0.35);
  background: rgba(16, 147, 189, 0.08);
}

button.chip {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
}

.main__composer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(5, 46, 63, 0.04);
}

.input:focus {
  outline: none;
  border-color: rgba(16, 147, 189, 0.6);
  box-shadow: 0 0 0 4px rgba(16, 147, 189, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 100px;
  font: inherit;
}

.main__status {
  padding: 8px 20px 14px;
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}

.auth-page {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 20px;
}

.auth-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 46, 63, 0.55);
  z-index: 100;
}

.modal-overlay.is-open {
  display: flex;
}

.modal {
  width: min(560px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.modal--wide {
  width: min(900px, 100%);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-weight: 900;
  font-size: 18px;
}

.modal__subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.modal__body {
  padding: 16px 18px 18px;
}

.json-viewer {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(5, 46, 63, 0.14);
  border-radius: 12px;
  background: rgba(5, 46, 63, 0.04);
  overflow: auto;
  max-height: min(68vh, 640px);
  white-space: pre;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.modal__close {
  border-radius: 12px;
  width: 38px;
  height: 38px;
}

.auth-error {
  color: #7f1d1d;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  display: none;
}

.auth-error.show {
  display: block;
}

.admin-page {
  overflow: hidden;
}

.admin-app {
  grid-template-columns: 300px 1fr;
}

.admin-sidebar {
  min-height: 0;
}

.admin-sidebar__header {
  align-items: flex-start;
  justify-content: flex-start;
}

.admin-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.admin-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-tab {
  text-align: left;
  font-weight: 700;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  min-height: 44px;
}

.admin-tab.is-active {
  border-color: rgba(16, 147, 189, 0.45);
  background: rgba(16, 147, 189, 0.14);
}

.admin-main {
  min-height: 0;
}

.admin-main__header {
  min-height: 66px;
}

.admin-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-main__content {
  align-items: stretch;
  gap: 14px;
  padding-bottom: 24px;
}

.admin-tab-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 0 rgba(5, 46, 63, 0.04);
}

.admin-tab-actions__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-tab-actions__title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.admin-tab-actions__hint {
  font-size: 12px;
  color: var(--muted);
}

.admin-tab-actions__buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.is-active {
  display: block;
}

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

.admin-card {
  grid-column: span 6;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 0 rgba(5, 46, 63, 0.04);
  padding: 14px 14px 12px;
}

.admin-card--wide {
  grid-column: span 12;
}

.admin-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.admin-card > .admin-actions,
.prompt-editor .admin-actions {
  display: none;
}

.admin-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  padding: 2px 2px 8px;
}

.admin-status--error {
  color: #b91c1c;
}

.admin-notice {
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  border-radius: 12px;
  padding: 16px;
}

.admin-fields .admin-field > span,
.model-editor .admin-field > span {
  color: var(--text);
  font-weight: 800;
}

.admin-field--full {
  grid-column: 1 / -1;
}

.admin-field__label {
  display: inline-flex;
  align-items: center;
}

.admin-field__label--hint {
  cursor: help;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: rgba(16, 147, 189, 0.55);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

.admin-field__label--hint:hover {
  color: rgba(3, 105, 161, 0.95);
  text-decoration-color: rgba(3, 105, 161, 0.8);
}

.admin-field__label--hint:focus-visible {
  outline: 2px solid rgba(16, 147, 189, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}

.admin-field--checkbox {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  margin-top: 2px;
  color: var(--text);
  user-select: none;
}

.admin-field--checkbox > span {
  line-height: 1.25;
  font-weight: 800;
}

.admin-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
  transform: none;
}

.admin-list-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-list-editor__row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.admin-list-editor__index {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.admin-list-editor__remove {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.admin-list-editor__remove[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.admin-list-editor__add {
  align-self: flex-start;
  margin-top: 2px;
}

.tippy-box[data-theme~="admin-hint"] {
  border: 1px solid rgba(5, 46, 63, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tippy-box[data-theme~="admin-hint"] .tippy-content {
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 12px;
}

.tippy-box[data-theme~="admin-hint"] > .tippy-arrow {
  color: rgba(255, 255, 255, 0.98);
}

.model-editor {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 9px 10px;
}

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

.model-field--compact {
  grid-column: span 2;
}

.model-field--compact .input {
  max-width: 170px;
}

.model-field--medium {
  grid-column: span 2;
}

.model-field--wide {
  grid-column: span 4;
}

.model-field--full {
  grid-column: 1 / -1;
}

.model-pricing {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  margin-top: -2px;
}

.prompt-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-meta {
  color: var(--muted);
  font-size: 12px;
}

.admin-reset-confirm__text {
  margin: 0 0 14px;
  color: var(--text);
  line-height: 1.45;
}

.admin-reset-confirm__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.is-hidden {
  display: none;
}

@media (max-width: 1000px) {
  .admin-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .admin-tabs {
    flex-direction: row;
    overflow: auto;
    padding-bottom: 6px;
  }

  .admin-tab {
    white-space: nowrap;
    width: auto;
    min-width: max-content;
  }

  .admin-tab-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-tab-actions__buttons {
    justify-content: flex-end;
  }

  .admin-card {
    grid-column: span 12;
  }

  .admin-fields {
    grid-template-columns: 1fr;
  }

  .model-editor {
    grid-template-columns: 1fr;
  }

  .model-field--compact .input {
    max-width: none;
  }

  .admin-header-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
