/* Компоненты панели — только через токены (tokens.css). Прямые углы,
   моноширинный шрифт, чёткие границы вместо теней. */

* { box-sizing: border-box; border-radius: var(--radius); }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  font-family: var(--font-mono);
  font-size: 14px; line-height: 1.5;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: background-color .15s, color .15s;
}
a { color: hsl(var(--primary)); }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 24px 0 10px; text-transform: uppercase; letter-spacing: .06em; color: hsl(var(--muted-foreground)); }
code { font-family: inherit; background: hsl(var(--secondary)); padding: 1px 4px; }
.spacer { flex: 1; }

main { padding: 24px 16px; max-width: 1100px; margin: 0 auto; }

/* ---------- кнопки ---------- */
.btn, button {
  font: inherit; font-size: 13px; cursor: pointer;
  padding: 7px 12px;
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border));
  transition: border-color .1s, background-color .1s;
}
.btn:hover, button:hover { border-color: hsl(var(--ring)); }
.btn:disabled, button:disabled { opacity: .5; cursor: default; }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-destructive { background: transparent; color: hsl(var(--destructive)); border-color: hsl(var(--destructive)); }
.btn-destructive:hover { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { border-color: hsl(var(--border)); }
.btn-icon { width: 34px; padding: 6px 0; text-align: center; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 1px; }

/* ---------- поля ---------- */
input, select, textarea {
  font: inherit; font-size: 13px;
  background: hsl(var(--background)); color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input));
  padding: 7px 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: hsl(var(--ring)); box-shadow: 0 0 0 1px hsl(var(--ring)); }
input[type=checkbox] { accent-color: hsl(var(--primary)); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: hsl(var(--muted-foreground)); }

/* ---------- сообщения ---------- */
.error { color: hsl(var(--destructive)); font-size: 13px; }
.note { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); padding: 10px; word-break: break-all; font-size: 13px; }
.note-small { font-size: 12px; color: hsl(var(--muted-foreground)); }

/* ---------- таблицы ---------- */
table { border-collapse: collapse; width: 100%; margin-bottom: 16px; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid hsl(var(--border)); font-size: 13px; }
th { font-weight: 600; color: hsl(var(--muted-foreground)); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
td .btn, td button { padding: 4px 8px; font-size: 12px; }
.table-wrap { overflow-x: auto; }

/* ---------- бейджи статусов (Aurora) ---------- */
.badge { display: inline-block; padding: 1px 8px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; }
.badge-new { color: hsl(var(--frost-3)); }
.badge-work { color: hsl(var(--yellow)); }
.badge-prod { color: hsl(var(--green)); }

/* ---------- карточки проектов ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 12px 0; }
.card {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.card:hover { border-color: hsl(var(--ring)); }
.card h3 { margin: 0; font-size: 15px; word-break: break-all; }
.card .meta { font-size: 12px; color: hsl(var(--muted-foreground)); display: flex; flex-direction: column; gap: 6px; }
.card .meta select { padding: 3px 6px; font-size: 12px; }
.card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.card .actions button { padding: 5px 10px; font-size: 12px; }

/* ---------- эксплорер ---------- */
.explorer { border: 1px solid hsl(var(--border)); background: hsl(var(--card)); margin-top: 16px; }
.explorer-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid hsl(var(--border)); }
.crumbs { font-size: 12px; color: hsl(var(--muted-foreground)); }
.explorer-body { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; min-height: 320px; }
.tree { list-style: none; margin: 0; padding: 6px; border-right: 1px solid hsl(var(--border)); overflow: auto; max-height: 60vh; font-size: 13px; }
.tree li { padding: 3px 6px; cursor: pointer; white-space: nowrap; }
.tree li:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.file-view { margin: 0; padding: 10px; overflow: auto; max-height: 60vh; font-size: 12px; white-space: pre; background: hsl(var(--background)); }

/* ---------- чат ---------- */
.chat-head { display: flex; align-items: center; gap: 10px; }
.chat-head h1 { margin: 0; }
.chat-log {
  margin-top: 12px; border: 1px solid hsl(var(--border)); background: hsl(var(--card));
  min-height: 320px; max-height: 62vh; overflow: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { padding: 8px 12px; border: 1px solid hsl(var(--border)); white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.5; }
.msg-user { align-self: flex-end; max-width: 85%; background: hsl(var(--accent)); border-color: hsl(var(--primary) / .5); }
.msg-assistant { align-self: flex-start; max-width: 95%; background: hsl(var(--background)); }
.msg-error { align-self: stretch; border-color: hsl(var(--destructive)); color: hsl(var(--destructive)); }
.msg pre { background: hsl(var(--secondary)); border: 1px solid hsl(var(--border)); padding: 8px; overflow: auto; white-space: pre; margin: 6px 0; }
.msg-meta { font-size: 11px; color: hsl(var(--muted-foreground)); margin-top: 4px; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }
.chat-form textarea { flex: 1; resize: vertical; }

/* ---------- модалки ---------- */
.modal { position: fixed; inset: 0; z-index: 20; background: hsl(var(--background) / .8); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box {
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border));
  padding: 24px; display: flex; flex-direction: column; gap: 12px; width: min(360px, 100%);
}
.modal-box h2 { margin: 0 0 4px; text-transform: none; letter-spacing: 0; font-size: 17px; color: hsl(var(--foreground)); }

@media (max-width: 700px) {
  main { padding: 16px 12px; }
  .explorer-body { grid-template-columns: 1fr; }
  .tree { border-right: 0; border-bottom: 1px solid hsl(var(--border)); max-height: 30vh; }
  .chat-form { flex-direction: column; }
}

/* Форма как самостоятельная страница (invite.html): без оверлея поверх шапки */
.page-modal { position: static; background: transparent; min-height: calc(100vh - 52px); }
