/* ColdHost AI – sdílený design systém */
:root {
  --bg: #05070d;
  --bg-2: #0a0f1c;
  --panel: rgba(16, 23, 40, .72);
  --panel-solid: #0e1526;
  --panel-2: #131c32;
  --line: rgba(125, 180, 255, .12);
  --line-2: rgba(125, 180, 255, .22);
  --text: #e8eefc;
  --muted: #8c9bba;
  --dim: #5d6b8a;
  --ice: #7df9ff;
  --blue: #4f7cff;
  --violet: #9b6bff;
  --green: #3ee6a5;
  --amber: #ffc857;
  --red: #ff5c7a;
  --grad: linear-gradient(135deg, #7df9ff 0%, #4f7cff 50%, #9b6bff 100%);
  --grad-soft: linear-gradient(135deg, rgba(125, 249, 255, .16), rgba(79, 124, 255, .14) 50%, rgba(155, 107, 255, .16));
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .7), 0 0 0 1px var(--line);
  --glow: 0 0 0 1px rgba(125, 249, 255, .25), 0 10px 40px -10px rgba(79, 124, 255, .55);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::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);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--ice); text-decoration: none; }
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(79, 124, 255, .45); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(125, 180, 255, .16); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(125, 180, 255, .3); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; border-radius: 6px; }

.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.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 {
  --b: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--b); color: var(--text); font: 600 14px var(--font); cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, opacity .2s; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: rgba(125, 249, 255, .4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  border: 0; color: #041018; background: var(--grad); box-shadow: var(--glow);
}
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(125, 249, 255, .5), 0 14px 50px -10px rgba(79, 124, 255, .8); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(125, 180, 255, .07); color: var(--text); border-color: transparent; }
.btn-danger { background: rgba(255, 92, 122, .12); border-color: rgba(255, 92, 122, .35); color: #ffb3c1; }
.btn-danger:hover { border-color: var(--red); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(125, 180, 255, .09); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.active { color: var(--ice); }

/* 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: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: rgba(5, 8, 16, .6); 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='%238c9bba' 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(125, 249, 255, .55); box-shadow: 0 0 0 4px rgba(79, 124, 255, .15); }
.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-2); border: 1px solid var(--line-2); border-radius: 99px; transition: .2s; 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: rgba(79, 124, 255, .35); border-color: var(--blue); }
.switch input:checked + span::before { transform: translateX(18px); background: var(--ice); }

/* karty, odznaky */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(125, 180, 255, .1); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.free { color: var(--muted); }
.badge.pro { color: #041018; background: var(--grad); border: 0; }
.badge.ultra { color: #fff; background: linear-gradient(135deg, #ff8a5c, #ff4fa3 50%, #9b6bff); border: 0; }
.badge.ok { color: var(--green); background: rgba(62, 230, 165, .1); border-color: rgba(62, 230, 165, .3); }
.badge.warn { color: var(--amber); background: rgba(255, 200, 87, .1); border-color: rgba(255, 200, 87, .3); }
.badge.bad { color: var(--red); background: rgba(255, 92, 122, .1); border-color: rgba(255, 92, 122, .3); }
.badge.admin { color: var(--violet); background: rgba(155, 107, 255, .12); border-color: rgba(155, 107, 255, .35); }

/* 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(--panel-solid);
  border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; animation: toastIn .25s ease-out;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast::before { content: ""; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--ice); flex: none; box-shadow: 0 0 12px currentColor; }
.toast.error::before { background: var(--red); }
.toast.success::before { background: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(2, 4, 10, .7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-solid); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* tabulky */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 12px 14px; border-bottom: 1px solid var(--line); background: rgba(10, 15, 28, .6); 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: rgba(125, 180, 255, .04); }
.table tr.click { cursor: pointer; }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(5, 8, 16, .6); border: 1px solid var(--line); border-radius: 12px; }
.tab { flex: 1; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 14px var(--font); cursor: pointer; transition: .2s; }
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }

/* 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(--ice); }
.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: #fff; }
.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(--blue); padding: .2em 1em; color: var(--muted); background: rgba(79, 124, 255, .06); border-radius: 0 10px 10px 0; }
.md :not(pre) > code { font-size: .88em; padding: .15em .45em; border-radius: 6px; background: rgba(125, 180, 255, .12); color: #bfe9ff; }
.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: rgba(79, 124, 255, .1); }
.code-block { margin: 0 0 1em; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); background: #070b16; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: rgba(125, 180, 255, .06); 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: rgba(125, 180, 255, .1); 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 rgba(125, 180, 255, .2); border-top-color: var(--ice); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview-frame { width: 100%; height: 70vh; border: 0; border-radius: 12px; background: #fff; }
