/* ColdHost AI – sdílený design systém */
:root {
  /* jediná sada barev pro web, chat i administraci (teplé neutrální tóny + ledový akcent) */
  --bg: #262624;
  --bg-2: #1f1e1d;
  --panel: #2b2a28;
  --panel-solid: #2b2a28;
  --panel-2: #30302e;
  --panel-3: #3a3936;
  --pop: #30302e;
  --bubble: #141413;
  --code: #1a1918;
  --line: rgba(222, 220, 209, .10);
  --line-2: rgba(222, 220, 209, .17);
  --hover: rgba(240, 238, 230, .055);
  --hover-2: rgba(240, 238, 230, .09);
  --text: #f5f4ef;
  --text-2: #dedcd1;
  --muted: #b7b5a9;
  --dim: #85837b;
  --accent: #a8d4ff;
  --accent-2: #7cbcf5;
  --accent-soft: rgba(168, 212, 255, .12);
  --ice: #a8d4ff;
  --blue: #7cbcf5;
  --violet: #c3b5f5;
  --green: #86d4a6;
  --amber: #e8c27a;
  --red: #f0938f;
  --cream: #f5f4ef;
  --on-cream: #1f1e1d;
  --grad: linear-gradient(135deg, #cfe8ff, #a8d4ff 55%, #c3b5f5);
  --grad-soft: rgba(240, 238, 230, .05);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .7), 0 0 0 1px var(--line);
  --glow: none;
  --spring: cubic-bezier(.32, 1.25, .44, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Inter", system-ui, -apple-system, sans-serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
.serif { font-family: var(--serif); font-weight: 500; letter-spacing: -.015em; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
code, pre, kbd { font-family: var(--mono); }
::selection { background: rgba(168, 212, 255, .3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(222, 220, 209, .14); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(222, 220, 209, .26); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.grad-text { color: var(--accent); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* tlačítka */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: 550 14px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .2s, border-color .2s, opacity .2s, transform .25s var(--spring);
}
.btn:hover { text-decoration: none; background: var(--panel-3); border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { border: 0; background: var(--cream); color: var(--on-cream); }
.btn-primary:hover { background: #fff; }
.btn-accent { border: 0; background: var(--accent); color: #10202e; }
.btn-accent:hover { background: #c2e1ff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.btn-danger { background: rgba(240, 147, 143, .1); border-color: rgba(240, 147, 143, .28); color: #f6b4b1; }
.btn-danger:hover { background: rgba(240, 147, 143, .16); border-color: var(--red); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s, transform .25s var(--spring);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.active { color: var(--accent); }

/* formuláře */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font: 14px var(--font); transition: border-color .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 100px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; 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='%23b7b5a9' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: rgba(168, 212, 255, .5); box-shadow: 0 0 0 3px rgba(168, 212, 255, .12); }
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; user-select: none; font-size: 14px; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 99px; transition: .25s var(--ease); cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); background: #10202e; }
.switch span::before { transition: transform .35s var(--spring), background .2s; }

/* karty, odznaky */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--hover); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.free { color: var(--muted); }
.badge.pro { color: #10202e; background: var(--accent); border: 0; }
.badge.ultra { color: #1f1e1d; background: linear-gradient(135deg, #cfe8ff, #c3b5f5); border: 0; }
.badge.ok { color: var(--green); background: rgba(134, 212, 166, .1); border-color: rgba(134, 212, 166, .28); }
.badge.warn { color: var(--amber); background: rgba(232, 194, 122, .1); border-color: rgba(232, 194, 122, .28); }
.badge.bad { color: var(--red); background: rgba(240, 147, 143, .1); border-color: rgba(240, 147, 143, .28); }
.badge.admin { color: var(--violet); background: rgba(195, 181, 245, .1); border-color: rgba(195, 181, 245, .3); }

/* toast */
#toasts { position: fixed; z-index: 1000; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast {
  min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 12px; background: var(--pop);
  border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; animation: toastUp .45s var(--spring);
  display: flex; gap: 10px; align-items: flex-start;
}
.toast::before { content: ""; width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.toast.error::before { background: var(--red); }
.toast.success::before { background: var(--green); }
@keyframes toastUp { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* modal – „sheet“ se zhoupnutím */
.modal-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(10, 9, 8, .6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: grid; place-items: center; padding: 16px; animation: fade .25s var(--ease); }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--pop); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); animation: sheet .45s var(--spring); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--pop); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
@keyframes sheet { from { opacity: 0; transform: translateY(18px) scale(.97); } }

/* tabulky */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 11px 14px; border-bottom: 1px solid var(--line); background: transparent; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--hover); }
.table tr.click { cursor: pointer; }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.tab { flex: 1; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 550 13.5px var(--font); cursor: pointer; transition: background .2s, color .2s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-3); color: var(--text); }

/* markdown obsah */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md table, .md pre { margin: 0 0 .9em; }
.md ul, .md ol { padding-left: 1.4em; }
.md li { margin: .25em 0; }
.md li::marker { color: var(--dim); }
.md h1, .md h2, .md h3, .md h4 { margin: 1.2em 0 .5em; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.3em; } .md h3 { font-size: 1.12em; }
.md strong { color: var(--text); font-weight: 650; }
.md h1, .md h2, .md h3 { font-weight: 650; letter-spacing: -.02em; }
.md img { max-width: 100%; border-radius: 14px; margin: 6px 0; }
.md a { text-decoration: underline; text-underline-offset: 3px; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.4em 0; }
.md blockquote { border-left: 3px solid var(--line-2); padding: .2em 1em; color: var(--muted); }
.md :not(pre) > code { font-size: .87em; padding: .15em .42em; border-radius: 6px; background: var(--hover-2); color: var(--text-2); }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: .94em; }
.md th, .md td { border: 1px solid var(--line-2); padding: 8px 12px; text-align: left; }
.md th { background: var(--hover); }
.code-block { margin: 0 0 1em; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--code); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: var(--hover); border-bottom: 1px solid var(--line); font: 12px var(--mono); color: var(--muted); }
.code-head button { display: inline-flex; gap: 6px; align-items: center; height: 26px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 12px var(--font); cursor: pointer; }
.code-head button:hover { background: var(--hover-2); color: var(--text); }
.code-head button svg { width: 14px; height: 14px; }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.6; }
.code-block pre code.hljs { background: transparent; padding: 0; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview-frame { width: 100%; height: 70vh; border: 0; border-radius: 12px; background: #fff; }
