/* ============================================================
   PHP aplikace – vrstva nad design/app.css (optimalizace.ai)
   ============================================================ */

html,
body {
  min-height: 100%;
}

/* Bez patkového písma — celá vrstva používá Geist (--font-serif z prototypu = sans). */
:root {
  --font-serif: var(--font-sans);
}

.brand-mark {
  font-family: inherit;
  font-style: normal;
  letter-spacing: normal;
}
.brand-mark svg {
  width: 18px;
  height: 18px;
  display: block;
  color: var(--paper);
}

.welcome .mark svg {
  width: 40px;
  height: 40px;
  color: var(--amber);
}

.msg-php .msg-avatar.assistant {
  font-family: inherit;
  font-style: normal;
  font-size: unset;
  letter-spacing: normal;
}

.welcome h1,
.welcome h1 em {
  font-family: var(--font-sans);
}

/* ----- Horní panel: název chatu + výběr modelu ----- */
.topbar .crumbs {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}

.topbar .crumbs .current {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 450;
  letter-spacing: -0.005em;
}

.topbar-model-inline-php {
  flex: 0 1 auto;
  min-width: 148px;
  max-width: min(100%, 320px);
  display: flex;
  align-items: center;
}

.topbar-actions {
  flex-shrink: 0;
}

.subtopbar-php {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.model-hint-sub-php {
  margin: 0 auto;
  padding: 8px 24px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-width: 760px;
  box-sizing: border-box;
}
a.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
a.btn:hover,
button.btn:hover {
  background: var(--paper-3);
  border-color: var(--line-strong);
  color: var(--ink);
}
button.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
a.btn.primary,
button.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
a.btn.primary:hover,
button.btn.primary:hover {
  opacity: 0.88;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.sidebar-foot .btn {
  margin-top: 4px;
}

button.btn.danger {
  color: var(--danger);
  border-color: var(--amber-line);
  background: var(--paper);
}
button.btn.danger:hover {
  background: var(--paper-2);
}

/* ----- Přihlášení ----- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--paper);
}
.login-card {
  width: min(440px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.login-card h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--ink);
}
.login-card .lead {
  color: var(--ink-3);
  font-size: 14px;
  margin: 0 0 20px;
  line-height: 1.5;
}
.login-card label {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.login-card input:focus {
  border-color: var(--line-strong);
  background: var(--paper);
}
.login-card .form-row {
  margin-bottom: 16px;
}
.login-card hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.theme-bar-login {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
}

/* ----- Flash ----- */
.flash {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  background: var(--paper-2);
  color: var(--ink);
}
.flash.success {
  border-color: oklch(0.65 0.12 145 / 0.45);
}
.flash.error {
  border-color: oklch(0.65 0.18 25 / 0.4);
}
.flash.info {
  border-color: var(--amber-line);
}

/* ----- Chat: grid stejný jako prototyp ----- */
.app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: 100vh;
  background: var(--paper);
  overflow: hidden;
}

.app .main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

/* Seznam konverzací + akce */
.sidebar-scroll-php {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sb-section-head-php {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.chat-row {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin-bottom: 2px;
}
.chat-row .chat-item-main {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.chat-row .chat-item-main:hover {
  background: var(--paper-3);
  color: var(--ink);
}
.chat-row.active .chat-item-main {
  background: var(--paper);
  color: var(--ink);

}
.chat-row .title {
  font-size: 13px;
  font-weight: 450;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-row .preview {
  font-size: 11.5px;
  color: var(--ink-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-row-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.chat-row:hover .chat-row-tools,
.chat-row:focus-within .chat-row-tools,
.chat-row.active .chat-row-tools {
  opacity: 1;
}
.conv-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.conv-icon-btn:hover {
  background: var(--paper-3);
  color: var(--ink);
}
.conv-icon-btn.danger:hover {
  color: var(--danger);
}
.conv-icon-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.conv-rename-input {
  width: 100%;
  border: 1px solid var(--amber-line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  font-size: 13px;
}

/* Stav prázdné konverzace v oblasti scrollu — kompaktní welcome */
.chat-body .welcome {
  padding: 48px 24px 80px;
}
.chat-body .welcome h1 {
  font-size: 36px;
}

/* ----- Zprávy: uživatel vlevo (+ avatar vlevo), AI vpravo (+ avatar vpravo) ----- */
.msg-php {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
}
.msg-php.msg-user {
  flex-direction: row;
  justify-content: flex-start;
}
.msg-php.msg-assistant {
  flex-direction: row-reverse;
  justify-content: flex-start;
}
.msg-php .msg-body {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(640px, calc(100% - 52px));
}

/* AI odpověď — karta s jemným stínem a patičkou pro akce */
.msg-php.msg-assistant .msg-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  border-bottom-right-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.msg-php.msg-assistant:hover .msg-body {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.msg-php.msg-assistant .msg-body > .msg-content {
  padding: 14px 16px 12px;
  font-size: 14.5px;
  line-height: 1.65;
  letter-spacing: -0.003em;
  color: var(--ink);
}

.msg-php.msg-assistant .msg-body > .msg-content > * + * {
  margin-top: 12px;
}

.msg-php.msg-assistant .msg-body > .msg-content p {
  margin: 0;
  text-wrap: pretty;
}

.msg-php.msg-assistant .msg-body > .msg-content .codeblock-php:first-child {
  margin-top: 0;
}

.msg-php.msg-assistant .msg-body > .msg-actions-php {
  margin-top: 0;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  justify-content: flex-end;
  opacity: 1;
}

.msg-php.msg-assistant .msg-body > .msg-actions-php .copy-msg-btn {
  background: transparent;
  border-color: transparent;
  padding: 4px 8px;
}

.msg-php.msg-assistant .msg-body > .msg-actions-php .copy-msg-btn:hover {
  background: var(--paper-3);
  border-color: var(--line);
}

.msg-php.msg-user .msg-body > .msg-content {
  padding: 2px 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
}

.msg-php.msg-assistant .msg-actions-php {
  justify-content: flex-end;
}

.msg-php .msg-avatar svg {
  width: 14px;
  height: 14px;
}

.msg-php .msg-avatar.user svg {
  fill: currentColor;
}
.msg-php .msg-avatar.assistant svg {
  fill: currentColor;
}

.msg-content.bubble-reset .katex-block-php {
  margin: 0.75em 0;
  overflow-x: auto;
  overflow-y: visible;
}
.msg-content.bubble-reset .katex-block-php:first-child {
  margin-top: 0;
}
.msg-content.bubble-reset p .katex {
  white-space: normal;
}

.msg-content.bubble-reset a {
  color: var(--amber-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Blokové kódové okno s vlastním „Kopírovat“ (web.php fenced ```) */
.codeblock-php {
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
}
.codeblock-head-php {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.codeblock-head-php .lang {
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-2);
}
.codeblock-head-php .lang.muted-lang {
  text-transform: none;
  font-weight: 500;
  color: var(--ink-4);
}
.codeblock-copy-php {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-3);
  transition: background 0.12s, color 0.12s;
}
.codeblock-copy-php:hover {
  background: var(--paper);
  color: var(--ink);
}
.codeblock-copy-php.copied {
  color: var(--success);
}
.codeblock-copy-php svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}
.codeblock-php pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink);
  background: transparent;
}
.codeblock-php pre code {
  font-family: inherit;
  background: none;
  border: 0;
  padding: 0;
}

.msg-actions-php {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}
.msg-php.msg-user:hover .msg-actions-php,
.msg-php:hover .msg-actions-php {
  opacity: 1;
}
.copy-msg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-3);
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.copy-msg-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.copy-msg-btn.copied {
  color: var(--success);
  border-color: oklch(0.65 0.12 145 / 0.45);
}
.copy-msg-btn svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.caret-php {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--amber);
  vertical-align: -2px;
  border-radius: 1px;
  animation: blink-php 1s steps(2) infinite;
  margin-left: 2px;
}
@keyframes blink-php {
  50% {
    opacity: 0;
  }
}

@media (max-width: 820px) {
  .msg-actions-php {
    opacity: 1;
  }
}

/* ----- Horní panel: nativní select ----- */
.model-select-native {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.model-select-native:focus {
  border-color: var(--amber-line);
}

.topbar-archive {
  white-space: nowrap;
}

.tb-btn-visually-muted {
  color: var(--ink-2);
}

/* ----- Composer (PHP) ----- */
.composer-wrap {
  position: relative;
  padding-left: 16px;
  padding-right: 16px;
}

.composer-stack-php {
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.composer-row-php {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.composer-main-php {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  margin: 0;
}

.composer-aside-php {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  max-width: min(420px, 42%);
}

.composer-side-php {
  flex: 0 1 auto;
  min-width: 148px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--paper-2);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}

.composer-side-controls-php {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.composer-side-controls-php .composer-side-field-php {
  flex: 1 1 0;
  min-width: 88px;
}

.composer-usage-php {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 220px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--paper-2);
}

.composer-usage-php .usage-panel-php {
  width: 100%;
}

.composer-side-php:focus-within {
  border-color: var(--amber-line);
  background: var(--paper);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.composer-side-mark-php {
  display: none;
}

.composer-side-field-php {
  width: 100%;
  min-width: 0;
}

.composer-side-label-php {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
  line-height: 1;
}

.composer-side-select-php {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 26px 6px 8px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background-color: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  line-height: 1.3;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235c5c62' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition:
    border-color 0.12s,
    background-color 0.12s,
    box-shadow 0.12s;
}

.composer-side-select-php:focus {
  border-color: var(--amber-line);
  box-shadow: 0 0 0 2px var(--amber-soft);
}

.composer-side-select-php:hover:not(:disabled) {
  border-color: var(--line-strong);
}

.composer-side-select-php:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

[data-theme="dark"] .composer-side-select-php {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a9aa3' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.composer-side-hint-php {
  margin: 0;
  font-size: 10px;
  line-height: 1.35;
  color: var(--ink-3);
}

.usage-panel-side-php {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  gap: 7px;
}

.usage-panel-side-php .usage-limit-head-php {
  flex-wrap: wrap;
  gap: 2px 6px;
  font-size: 9.5px;
}

.usage-panel-side-php .usage-limit-head-php span:last-child {
  font-size: 9px;
  white-space: normal;
  text-align: right;
}

.usage-panel-side-php .usage-limit-meta-php {
  font-size: 9px;
}

.usage-panel-side-php .usage-per-msg-php {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.35;
}

.composer-stack-php .composer {
  max-width: none;
  margin: 0;
}

.tool-btn-stop:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.composer-meta-stack-php {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}

.composer-meta-status {
  max-width: none;
  margin: 0;
  font-size: 11px;
  color: var(--ink-4);
  text-align: left;
}

.composer-meta-tokens-php {
  margin: 0;
  font-size: 10px;
  line-height: 1.4;
  color: var(--ink-3);
  text-align: left;
  max-width: none;
  width: 100%;
}
.usage-panel-php {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
}
.usage-limit-row-php {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.usage-limit-head-php {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  color: var(--ink-3);
}
.usage-limit-head-php span:last-child {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.usage-limit-meta-php {
  font-size: 9.5px;
  color: var(--ink-4);
}
.usage-bar-track-php {
  height: 5px;
  border-radius: 999px;
  background: var(--paper-3);
  overflow: hidden;
}
.usage-bar-track-php.is-unlimited-php {
  opacity: 0.55;
}
.usage-bar-fill-php {
  height: 100%;
  border-radius: inherit;
  background: var(--amber);
  transition: width 0.25s ease;
}
.usage-bar-fill-php.warn {
  background: oklch(0.72 0.16 65);
}
.usage-bar-fill-php.danger {
  background: var(--danger);
}
.usage-bar-fill-php.unlimited {
  width: 100% !important;
  background: linear-gradient(90deg, var(--line-strong), var(--paper-3));
  opacity: 0.65;
}
.usage-per-msg-php {
  margin: 2px 0 0;
  font-size: 9.5px;
  line-height: 1.35;
  color: var(--ink-4);
}
.token-line-php {
  display: block;
}
.token-line-php + .token-line-php,
.usage-panel-php + .token-line-php {
  margin-top: 4px;
}
.muted-token-php {
  color: var(--ink-4);
}

/* Reasoning select — dědí z .composer-side-select-php */
.reasoning-select-native-php:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 820px) {
  .composer-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }
  .composer-row-php {
    flex-direction: column;
  }
  .composer-main-php {
    flex: 1 1 auto;
    max-width: 100%;
  }
  .composer-aside-php {
    flex-direction: column;
    max-width: none;
    width: 100%;
  }
  .composer-side-php {
    width: 100%;
    min-width: 0;
  }
  .composer-side-controls-php {
    flex-wrap: wrap;
  }
  .composer-usage-php {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}

.composer-file-input-php {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.composer-attachments-php {
  width: 100%;
  margin: 0;
  padding: 0 4px;
  box-sizing: border-box;
  font-size: 11px;
  color: var(--ink-3);
}
.composer-att-list-php {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.composer-att-chip-php {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 4px 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.composer-att-name-php {
  max-width: 36ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--ink);
}
.composer-att-remove-php {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.composer-att-remove-php:hover {
  background: var(--paper-3);
  color: var(--danger);
}
.composer-att-hint-php {
  margin: 0;
  line-height: 1.4;
}
.composer-att-hint-php a {
  color: var(--amber-ink);
}

.msg-attachments-php {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.msg-att-chip-php {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-3);
}

/* ----- Mobilní sidebar ----- */
.show-sb-mobile {
  display: none;
}
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(310px, 90vw);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .show-sb-mobile {
    display: grid;
  }
}

/* ----- Feedback panel (vpravo) ----- */
.feedback-tab-php {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 45;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 10px 0 0 10px;
  background: var(--paper);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
}
.feedback-tab-php:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.feedback-tab-php svg {
  display: block;
}
body.feedback-open-php .feedback-tab-php {
  transform: translate(calc(-1 * min(360px, 92vw)), -50%);
}
.feedback-backdrop-php {
  position: fixed;
  inset: 0;
  z-index: 48;
  background: rgba(15, 15, 15, 0.35);
}
.feedback-panel-php {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(360px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.feedback-panel-php.is-open {
  transform: translateX(0);
}
.feedback-panel-head-php {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.feedback-panel-head-php h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.feedback-panel-close-php {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.feedback-panel-close-php:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.feedback-panel-body-php {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.feedback-panel-body-php .form-row {
  margin-bottom: 16px;
}
.feedback-panel-body-php label {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.feedback-panel-body-php select,
.feedback-panel-body-php textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.feedback-panel-body-php select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.feedback-panel-body-php textarea {
  min-height: 140px;
  resize: vertical;
}
.feedback-panel-body-php textarea::placeholder {
  color: var(--ink-4);
}
.feedback-panel-body-php select:focus,
.feedback-panel-body-php textarea:focus {
  border-color: var(--line-strong);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
.feedback-panel-body-php select:hover,
.feedback-panel-body-php textarea:hover {
  border-color: var(--line-strong);
}
.feedback-meta-php {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
}
.feedback-panel-actions-php {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.feedback-status-php {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}
.feedback-status-php.is-error {
  color: #b42318;
}
@media (max-width: 820px) {
  body.feedback-open-php .feedback-tab-php {
    transform: translate(calc(-1 * 92vw), -50%);
  }
}

/* ============================================================
   Admin
   ============================================================ */

.admin-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--paper);
}
.admin-nav {
  border-right: 1px solid var(--line);
  background: var(--paper-2);
  padding: 18px 14px;
}
.admin-nav h1 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.admin-nav a {
  display: block;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.admin-nav a:hover,
.admin-nav a.active {
  background: var(--paper-3);
  color: var(--ink);
}
.admin-main {
  padding: 22px 24px 48px;
  max-width: 1280px;
  width: 100%;
}
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.admin-top h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.admin-muted {
  color: var(--ink-3);
  font-size: 13px;
  margin-top: 4px;
}
.admin-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
}
.admin-card-nested {
  background: var(--paper-3);
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.admin-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.admin-card label {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.admin-card input,
.admin-card textarea,
.admin-card select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
}
.admin-card textarea {
  min-height: 110px;
}
.admin-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-card th,
.admin-card td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}
.admin-card th {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-pill {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--ink-3);
  margin-left: 6px;
}
.admin-pill-muted {
  background: var(--paper-2);
}
.admin-users-overview {
  margin-bottom: 20px;
}
.admin-users-overview td,
.admin-users-overview th {
  vertical-align: top;
}
.admin-setup-checks {
  margin-top: 12px;
}
.admin-setup-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
}
.admin-setup-pill-ok {
  color: #1f6b3a;
  background: rgba(46, 125, 50, 0.12);
  border-color: rgba(46, 125, 50, 0.35);
}
.admin-setup-pill-warn {
  color: var(--amber-ink);
  background: var(--amber-soft);
  border-color: rgba(120, 84, 18, 0.25);
}
.admin-setup-pill-error {
  color: var(--danger);
  background: rgba(180, 40, 40, 0.08);
  border-color: rgba(180, 40, 40, 0.25);
}
html[data-theme="dark"] .admin-setup-pill-ok {
  color: #8fd4a8;
  background: rgba(46, 125, 50, 0.18);
}
.admin-models {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}
.admin-check {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
}
.admin-check input {
  width: auto;
}
.admin-model-line-php {
  align-items: flex-start;
}
.admin-model-line-php > input {
  margin-top: 3px;
}
.admin-model-line-body-php {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.admin-model-usefor-php {
  font-size: 11px;
  line-height: 1.35;
  max-width: 56ch;
}
@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-nav {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .admin-grid,
  .admin-grid-3 {
    grid-template-columns: 1fr;
  }
}

.admin-muted a {
  color: var(--amber-ink);
  text-underline-offset: 2px;
}

.admin-card h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 20px;
  margin: 0 0 12px;
  color: var(--ink);
}

.details.admin-card-nested summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
  list-style: none;
}

.details.admin-card-nested summary::-webkit-details-marker {
  display: none;
}

.admin-card code {
  font-family: var(--font-mono);
  font-size: 12px;
}
