/* Rádce Viagem — jednoduchý vlastní styl (vzor portal/pm, bez frameworku) */
:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1c2733;
    --muted: #64748b;
    --border: #dbe2ea;
    --primary: #0f6b4f;
    --primary-dark: #0b523d;
    --danger: #b3392f;
    --radius: 10px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
a { color: var(--primary); }

/* --- topbar --- */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--text); }
.brand span { color: var(--primary); }
.topbar-nav { display: flex; gap: 4px; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user form { margin: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; }

.container { max-width: 1000px; margin: 24px auto; padding: 0 16px; }
.page-chat .container { max-width: 1200px; }

/* --- tlacitka, formulare --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-block { display: flex; justify-content: center; width: 100%; }
.btn-google { padding: 10px 18px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: default; }

input[type=text], input[type=email], input[type=date], input[type=number], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}
textarea { resize: vertical; }
input.narrow { width: 80px; }
label { display: block; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; padding-top: 20px; }
label.check input { width: auto; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.form-grid .full { grid-column: 1 / -1; }

/* --- karty, tabulky, tagy --- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}
.card summary { cursor: pointer; font-weight: 600; }
.card h3 { margin-top: 0; }
.hidden { display: none; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; }

.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    background: var(--bg);
    color: var(--muted);
    font-size: 12px;
}
.tag-on { background: #dcefe7; color: var(--primary-dark); }
.tag-off { background: #f7e2e0; color: var(--danger); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; }
.flash-ok { background: #dcefe7; color: var(--primary-dark); }
.flash-err { background: #f7e2e0; color: var(--danger); }
.page-head h1 { margin-bottom: 4px; }

/* --- login --- */
.login-box {
    max-width: 380px;
    margin: 10vh auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
.dev-login { display: flex; flex-direction: column; gap: 8px; width: 100%; }

/* --- pokyny --- */
.guideline.inactive { opacity: .6; }
.guideline-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.guideline-actions { display: flex; gap: 4px; align-items: flex-start; }
.guideline-actions form { margin: 0; }
.guideline-body { margin: 8px 0; }
.revisions { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.revision { margin-bottom: 8px; }
.revision summary { cursor: pointer; color: var(--muted); font-size: 14px; }

.md h3, .md h4 { margin: 10px 0 4px; }
.md p, .md ul, .md ol, .md blockquote { margin: 6px 0; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--muted); }
.md pre { background: var(--bg); padding: 10px; border-radius: var(--radius); overflow-x: auto; }
.md code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 90%; }

/* --- prompt preview --- */
.prompt-pre {
    background: var(--bg);
    padding: 14px;
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-size: 13px;
    max-height: 480px;
    overflow-y: auto;
}
.meter { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--primary); }
.meter-fill.warn { background: var(--danger); }

/* --- chat --- */
.chat-wrap {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    height: calc(100vh - 110px);
}
.chat-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.conv-item {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-item:hover { background: #e9eef3; }
.conv-item.active { background: var(--card); border: 1px solid var(--border); }
.audit-note { margin: 0; }

.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 0;
}
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-body {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14.5px;
}
.msg-user .msg-body { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-assistant .msg-body { background: var(--bg); border-bottom-left-radius: 4px; white-space: normal; }
.msg-assistant .msg-body p:first-child { margin-top: 0; }
.msg-assistant .msg-body p:last-child { margin-bottom: 0; }
.msg-error { color: var(--danger); margin: 4px 0 0; }
.typing { color: var(--muted); }

.chat-form {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--border);
    align-items: flex-end;
}
.chat-form textarea { flex: 1; }

/* --- widget (iframe embed) --- */
.widget-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--card);
}
.widget-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.widget-body .chat-log { flex: 1; padding: 14px; }
.widget-body .chat-form { padding: 10px; }
.widget-body .msg-body { max-width: 88%; font-size: 14px; }
.widget-note { margin: 0; padding: 4px 12px 8px; text-align: center; }
.widget-login {
    margin: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px;
}

@media (max-width: 800px) {
    .chat-wrap { grid-template-columns: 1fr; height: auto; }
    .chat-side { order: 2; }
    .chat-log { max-height: 60vh; }
    .form-grid { grid-template-columns: 1fr 1fr; }
}
