/* AI Visibility Monitor - interny nastroj
   Paleta: atrament #123a63 (data), papier #f7f8fa, signal #e8590c (akcie) */
:root {
  --ink: #123a63;
  --ink-deep: #0b2545;
  --paper: #f7f8fa;
  --card: #ffffff;
  --line: #e3e7ee;
  --text: #1d2733;
  --muted: #6b7686;
  --signal: #e8590c;
  --ok: #1d7a46;
  --warn: #b54708;
  --err: #b3261e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--paper);
  color: var(--text);
}
h1 { font-size: 1.5rem; margin: 0 0 .35rem; letter-spacing: -.015em; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: .85rem; margin: .5rem 0 .3rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
a { color: var(--ink); }
.muted { color: var(--muted); font-size: .85rem; }

/* Nav */
nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 1.4rem; background: var(--ink-deep); color: #fff;
}
nav a { color: #cdd9ea; text-decoration: none; margin-left: 1rem; }
nav a:hover { color: #fff; }
.logo {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-weight: 700; letter-spacing: .12em; font-size: .95rem; color: #fff;
}
.logo span { color: var(--signal); }

/* Layout */
main { max-width: 1080px; margin: 1.6rem auto 3rem; padding: 0 1.2rem; }
main.narrow { max-width: 720px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 1.1rem 1.3rem; margin-bottom: 1.1rem;
}
.card.empty { color: var(--muted); text-align: center; padding: 2.5rem; }
.project-card { display: block; text-decoration: none; color: inherit; transition: border-color .12s; }
.project-card:hover { border-color: var(--ink); }
.proj-top { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.proj-top h2 { margin: 0; }
.progress { height: 5px; background: var(--line); border-radius: 3px; margin: .7rem 0 .4rem; overflow: hidden; }
.progress div { height: 100%; background: var(--ink); }

/* Badges */
.badge { font-size: .72rem; padding: .15rem .55rem; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.badge-active { background: #fff3e8; color: var(--warn); }
.badge-done { background: #e7f5ec; color: var(--ok); }
.badge-ok { background: #e7f5ec; color: var(--ok); }
.badge-warn { background: #fdf0e6; color: var(--warn); }

/* Forms */
.form label, .auth-card label { display: block; margin-bottom: .9rem; font-weight: 600; font-size: .85rem; }
input, textarea, select {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 .9rem; padding: .7rem 1rem; }
legend { font-weight: 600; font-size: .85rem; padding: 0 .4rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; margin-right: 1.2rem; font-weight: 400; }
.check input { width: auto; display: inline; margin: 0; }
button, .btn {
  display: inline-block; padding: .55rem 1.1rem; border: 0; border-radius: 6px;
  background: var(--ink); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: var(--ink-deep); }
.btn-accent { background: var(--signal); }
.btn-accent:hover { background: #c94c09; }
.actions { display: flex; gap: .6rem; align-items: center; }

/* Auth */
body.auth { display: grid; place-items: center; min-height: 100vh; }
.auth-card { width: min(360px, 92vw); }
.auth-card .logo { color: var(--ink-deep); text-align: center; margin-bottom: .8rem; font-size: 1.1rem; }
.auth-card h1 { text-align: center; font-size: 1.15rem; margin-bottom: 1rem; }
.auth-card button { width: 100%; margin-top: .4rem; }

/* Messages */
.error { background: #fdecea; color: var(--err); padding: .6rem .9rem; border-radius: 6px; font-size: .88rem; }
.flash { background: #e8f0fb; color: var(--ink-deep); padding: .6rem .9rem; border-radius: 6px; font-size: .88rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .84rem; }
td.brand { font-weight: 600; }
td.strong { font-weight: 700; color: var(--ink-deep); }
td.heat { background: color-mix(in srgb, var(--ink) calc(var(--h) * .55%), transparent); }
table.mini td { padding: .3rem .5rem; font-size: .82rem; }

/* Citations */
.cit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; }

/* Chat */
.chat-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 1rem; height: 55vh; overflow-y: auto; margin-bottom: .8rem;
}
.msg { max-width: 85%; padding: .6rem .9rem; border-radius: 10px; margin-bottom: .6rem; white-space: pre-wrap; }
.msg.user { background: var(--ink); color: #fff; margin-left: auto; border-bottom-right-radius: 3px; }
.msg.assistant { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.chat-form { display: flex; gap: .6rem; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: vertical; margin: 0; }

@media (max-width: 640px) {
  .page-head { flex-direction: column; }
  .msg { max-width: 95%; }
}

/* v2: metodika */
.ci { font-size: .74rem; color: var(--muted); font-weight: 400; }
.tie { color: var(--signal); font-weight: 700; margin-left: .25rem; cursor: help; }
.warn-card { border-left: 4px solid var(--warn); background: #fffaf5; }
.err-text { color: var(--err); }
.resp-text { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: .7rem .9rem; max-height: 260px; overflow-y: auto; font-size: .86rem; margin-bottom: .7rem; }
code { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .35rem; font-size: .8em; }
