/* Site Pilot – arkusz stylów panelu. Bez frameworka, bez stylów inline (CSP style-src 'self'). */

/* ---------- Tokeny ---------- */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9ecf1;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #5f6b7c;
  --line: #e4e7ec;
  --line-strong: #cfd4dc;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-ink: #3730a3;
  --success: #067647;
  --success-soft: #e7f6ee;
  --warning: #b54708;
  --warning-soft: #fff4e5;
  --danger: #c01048;
  --danger-soft: #fdecf1;
  --progress: #175cd3;
  --progress-soft: #e8f1fd;
  --pending: #6e4f9a;
  --pending-soft: #f4effb;
  --diff-add: #e6f6ec;
  --diff-add-strong: #c5ecd4;
  --diff-del: #fdeceb;
  --diff-del-strong: #f8cfcc;
  --diff-hunk: #eef2fb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 10%);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c111d;
    --surface: #131a28;
    --surface-2: #182032;
    --surface-3: #1f2a40;
    --ink: #f2f4f7;
    --ink-2: #d0d5dd;
    --muted: #98a2b3;
    --line: #253047;
    --line-strong: #344260;
    --accent: #7c74ff;
    --accent-hover: #918bff;
    --accent-soft: #23234a;
    --accent-ink: #c7c4ff;
    --success: #47cd89;
    --success-soft: #0f2a1f;
    --warning: #fdb022;
    --warning-soft: #2e2210;
    --danger: #f97090;
    --danger-soft: #331622;
    --progress: #84adff;
    --progress-soft: #152340;
    --pending: #c4a8f0;
    --pending-soft: #261d38;
    --diff-add: #0f2a1d;
    --diff-add-strong: #164029;
    --diff-del: #31151a;
    --diff-del-strong: #4a1d25;
    --diff-hunk: #18213a;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 45%);
    color-scheme: dark;
  }
}

/* ---------- Podstawy ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1rem; font-weight: 600; }
h3 { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 12px 0 6px; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }
form.inline { display: inline; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Pasek górny ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; padding: 0 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 650; font-size: 1rem; }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; flex: none; }
.logo rect { fill: var(--accent); }
.logo path { fill: #fff; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav > a { color: var(--ink-2); font-weight: 500; padding: 6px 12px; border-radius: var(--radius-sm); }
.nav > a:hover { background: var(--surface-2); text-decoration: none; }
.nav > a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }
.nav-user { display: inline-flex; align-items: center; gap: 8px; margin: 0 4px 0 12px; padding-left: 16px; border-left: 1px solid var(--line); color: var(--ink-2); }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; font-size: 0.8125rem; }
.nav-login { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Układ strony ---------- */
.page, .container { max-width: 1320px; margin: 0 auto; padding: 28px 24px 64px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header h1 { overflow-wrap: anywhere; }
.page-header .muted { margin: 4px 0 0; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; font-size: 0.8125rem; color: var(--muted); }
.crumbs > * + *::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.crumbs a { color: var(--muted); }
.subnav { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-2 > .card { margin-bottom: 0; }

/* ---------- Karty ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; min-width: 0; }
.card > h2 { margin-bottom: 12px; }
.card-flush { padding: 0; overflow: hidden; }
.card-pad { padding: 16px 20px; }
.card-narrow { max-width: 520px; margin: 24px auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-flush > .card-head { margin-bottom: 0; border-bottom: 1px solid var(--line); }
.card-head .muted { margin: 2px 0 0; }

/* ---------- Przyciski ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px; font: inherit; font-weight: 600; font-size: 0.875rem; line-height: 1.2; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background-color 0.15s, border-color 0.15s, color 0.15s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn[disabled] { cursor: not-allowed; opacity: 0.5; }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 0.8125rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not([disabled]):hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn-secondary:not([disabled]):hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:not([disabled]):hover { background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn-danger-outline:not([disabled]):hover { background: var(--danger-soft); }

/* ---------- Plakietki ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; font-size: 0.75rem; font-weight: 600; line-height: 1.6; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-neutral { background: var(--surface-3); color: var(--ink-2); }
.tone-progress { background: var(--progress-soft); color: var(--progress); }
.tone-attention { background: var(--warning-soft); color: var(--warning); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-pending { background: var(--pending-soft); color: var(--pending); font-weight: 500; }
.tone-outline { background: transparent; border: 1px solid var(--line-strong); color: var(--ink-2); }
.tone-progress .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.deploy-succeeded { background: var(--success-soft); color: var(--success); }
.deploy-failed { background: var(--danger-soft); color: var(--danger); }
.deploy-running, .deploy-pending { background: var(--progress-soft); color: var(--progress); }
.dot-inline { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; background: var(--muted); }
.dot-inline.deploy-succeeded { background: var(--success); }
.dot-inline.deploy-failed { background: var(--danger); }
.dot-inline.deploy-running, .dot-inline.deploy-pending { background: var(--progress); }

/* ---------- Komunikaty ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.875rem; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--accent-soft); color: var(--accent-ink); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.notice { margin: 0; padding: 48px 24px; text-align: center; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.empty { padding: 48px 24px; text-align: center; }
.empty-title { font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

/* ---------- Formularze ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
label { font-weight: 600; font-size: 0.8125rem; color: var(--ink-2); }
input, textarea, select { width: 100%; padding: 9px 12px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); transition: border-color 0.15s, box-shadow 0.15s; }
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
input[disabled], textarea[disabled] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input-code { font-family: var(--mono); font-size: 1.25rem; letter-spacing: 0.25em; text-align: center; }
.form > .btn:not(.btn-block) { justify-self: start; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.form-foot p { margin: 0; }

/* ---------- Logowanie ---------- */
.auth-body { min-height: 100vh; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 32px 16px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-weight: 650; font-size: 1.125rem; }
.auth-brand .logo { width: 34px; height: 34px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card h1 { font-size: 1.375rem; margin-bottom: 8px; }
.auth-card .alert { margin: 12px 0 0; }
.auth-card .form { margin-top: 20px; }
.auth-tagline { max-width: 420px; margin-top: 20px; text-align: center; color: var(--muted); font-size: 0.8125rem; }
.setup-steps { display: flex; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; font-size: 0.75rem; color: var(--muted); }
.setup-steps li { display: flex; align-items: center; gap: 6px; flex: 1; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.setup-steps li.current { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.setup-steps li.done { color: var(--success); border-bottom-color: var(--success); }
.setup-num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); font-weight: 600; }
.setup-steps .current .setup-num { background: var(--accent); color: #fff; }
.setup-steps .done .setup-num { background: var(--success); color: #fff; }
.qr-box { display: flex; justify-content: center; margin: 16px 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.qr { display: block; }
.secret { word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0 20px; padding: 0; list-style: none; counter-reset: code; }
.codes li { counter-increment: code; display: flex; align-items: center; gap: 8px; }
.codes li::before { content: counter(code) "."; width: 22px; color: var(--muted); font-size: 0.75rem; text-align: right; }
.codes code { font-size: 0.95rem; padding: 4px 8px; letter-spacing: 0.04em; }

/* ---------- Kafelki stron ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.tile { display: flex; flex-direction: column; gap: 16px; height: 100%; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
a.tile[href]:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile-disabled { opacity: 0.7; }
.tile-head { display: flex; align-items: center; gap: 12px; }
.tile-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.tile-title { display: grid; min-width: 0; flex: 1; }
.tile-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { margin: 0; font-size: 0.875rem; }
.tile-meta dt { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.tile-meta dd { margin: 4px 0 0; }
.tile-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- Tabele ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { padding: 10px 20px; text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-main { max-width: 520px; }
.cell-main a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }

/* ---------- Postęp zlecenia ---------- */
.steps { display: flex; margin: 0 0 20px; padding: 0; list-style: none; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; font-size: 0.75rem; color: var(--muted); text-align: center; }
.step::before { content: ""; position: absolute; top: 7px; left: calc(-50% + 10px); right: calc(50% + 10px); height: 2px; background: var(--line); }
.step:first-child::before { display: none; }
.step-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); z-index: 1; }
.step-done { color: var(--ink-2); }
.step-done .step-dot { border-color: var(--success); background: var(--success); }
.step-done::before, .step-current::before { background: var(--success); }
.step-current { color: var(--ink); font-weight: 600; }
.step-current .step-dot { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.steps-stopped { opacity: 0.55; }

/* ---------- Widok zlecenia ---------- */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.live.is-connected { color: var(--success); }
.live.is-connected .live-dot { background: var(--success); animation: pulse 2s ease-in-out infinite; }
.workspace { display: grid; grid-template-columns: minmax(320px, 2fr) minmax(0, 3fr); gap: 20px; align-items: stretch; }
.workspace > .card { margin-bottom: 0; }
.chat { display: flex; flex-direction: column; max-height: 760px; }
.chat-log { flex: 1; min-height: 240px; margin: 0 -20px; padding: 4px 20px 16px; overflow-y: auto; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { padding: 24px 0; text-align: center; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.msg-user { align-self: flex-end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 20%, transparent); border-bottom-right-radius: 4px; }
.msg-agent { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-system { align-self: center; max-width: 100%; background: transparent; border-style: dashed; font-size: 0.8125rem; color: var(--muted); }
.msg-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.msg-author { font-weight: 600; font-size: 0.8125rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-input { display: grid; gap: 8px; margin: 0 -20px -20px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.chat-input-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.viewer { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.tabs { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.tablist { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tabs:not(.tabs-ready) .tablist { display: none; }
.tablist [role="tab"] { padding: 14px 12px; font: inherit; font-weight: 600; font-size: 0.875rem; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tablist [role="tab"]:hover { color: var(--ink); }
.tablist [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel { padding: 16px; flex: 1; min-height: 0; }
.tabs:not(.tabs-ready) .tabpanel + .tabpanel { border-top: 1px solid var(--line); }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.segmented button { padding: 5px 12px; font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--muted); background: none; border: 0; border-radius: 7px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.preview-stage { position: relative; overflow: hidden; min-height: 320px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 50% / 20px 20px; border: 1px solid var(--line); border-radius: var(--radius-sm); display: flex; justify-content: center; }
.preview-frame { flex: none; width: 100%; height: 720px; border: 0; background: #fff; transform-origin: top center; }

/* ---------- Diff ---------- */
.diff-summary { margin-bottom: 10px; }
.diff-add-count { color: var(--success); font-weight: 600; }
.diff-del-count { color: var(--danger); font-weight: 600; }
.diff-file { margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.diff-file > summary { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); cursor: pointer; list-style: none; border-bottom: 1px solid var(--line); }
.diff-file > summary::-webkit-details-marker { display: none; }
.diff-file:not([open]) > summary { border-bottom: 0; }
.diff-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; padding: 0; }
.diff-counts { font-size: 0.75rem; font-family: var(--mono); }
.diff-status { width: 8px; height: 8px; border-radius: 2px; background: var(--progress); flex: none; }
.diff-status-added { background: var(--success); }
.diff-status-deleted { background: var(--danger); }
.diff-binary { padding: 12px; margin: 0; }
.diff-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.78rem; line-height: 1.55; table-layout: fixed; }
.diff-table td { padding: 0 8px; vertical-align: top; }
.diff-no { width: 48px; color: var(--muted); text-align: right; user-select: none; opacity: 0.75; }
.diff-sign { width: 18px; user-select: none; text-align: center; }
.diff-code { white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-add { background: var(--diff-add); }
.diff-add .diff-no, .diff-add .diff-sign { background: var(--diff-add-strong); color: var(--success); }
.diff-del { background: var(--diff-del); }
.diff-del .diff-no, .diff-del .diff-sign { background: var(--diff-del-strong); color: var(--danger); }
.diff-hunk { background: var(--diff-hunk); color: var(--muted); }
.diff-hunk .diff-code { padding: 4px 8px; }
.diff-meta { color: var(--muted); font-style: italic; }

/* ---------- Dolna część zlecenia ---------- */
.task-footer { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.task-footer > .card { margin-bottom: 0; }
.summary-text { white-space: pre-wrap; }
.summary-block ul { margin: 0; padding-left: 18px; }
.summary-block li { margin-bottom: 4px; }
.cost-value { margin: 0 0 4px; font-size: 1.75rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.decision { display: grid; gap: 12px; }
.decision p { margin: 0; }
.decision-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Nowe zlecenie, konto ---------- */
.new-task textarea { min-height: 88px; }
.session-list { margin: 0; padding: 0; list-style: none; }
.session-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.session-list li:last-child { border-bottom: 0; }
.session-list li > div { display: grid; gap: 2px; min-width: 0; }
.ua { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* ---------- htmx ---------- */
.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request button[type="submit"] { opacity: 0.6; pointer-events: none; }

/* ---------- Responsywność ---------- */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .chat { max-height: 560px; }
  .task-footer { grid-template-columns: 1fr 1fr; }
  .task-footer > .card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .nav-user { display: none; }
  .nav > a { padding: 6px 8px; }
  .page, .container { padding: 20px 16px 48px; }
  .grid-2, .task-footer { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .steps .step-label { font-size: 0.6875rem; }
  .table th, .table td { padding: 10px 12px; }
  .auth-card { padding: 24px 20px; }
  .codes { grid-template-columns: 1fr; }
  .msg { max-width: 100%; }
}
@media (max-width: 460px) {
  .brand span { display: none; }
  .step-label { display: none; }
  .step-current .step-label { display: block; position: absolute; top: 22px; white-space: nowrap; }
  .steps { padding-bottom: 20px; }
}

/* Bieżąca czynność agenta (SSE „activity”) */
.activity-box:empty { display: none; }
.activity { display: flex; align-items: center; gap: 0.5rem; margin: 0; padding: 0.5rem 1rem; font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--line); }
.activity-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); animation: activity-pulse 1.2s ease-in-out infinite; }
@keyframes activity-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .activity-dot { animation: none; } }

/* Dostęp do podglądu: adres, login, hasło */
.preview-access { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.5rem 1rem; margin: 0.75rem 0 0.25rem; }
.preview-access dt { font-size: 0.8rem; color: var(--muted); }
.preview-access dd { margin: 0; overflow-wrap: anywhere; }
.build-log { max-height: 20rem; overflow: auto; padding: 0.75rem; background: var(--accent-soft); border-radius: 0.5rem; font-size: 0.8rem; white-space: pre-wrap; }

/* Wybór języka (przełącznik w nagłówku i na ekranach logowania, lista w koncie) */
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.lang-switch button { font: inherit; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; min-width: 34px; padding: 4px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.lang-switch button:hover { color: var(--accent-ink); }
.lang-switch button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.auth .lang-switch { margin-top: 12px; }
.topbar .lang-switch { margin-left: auto; }
.topbar .nav + .lang-switch { margin-left: 12px; }
.form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-inline .field { margin: 0; min-width: 220px; }
.form-inline select { min-height: 38px; }

/* Dyktowanie w czacie (mikrofon) */
.dictation { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.dictation[hidden] { display: none; }
.dictation-toggle { display: inline-flex; align-items: center; gap: 6px; }
.dictation-toggle .mic-icon { fill: currentColor; flex: none; }
.dictation-toggle.is-listening { color: var(--danger, #c0362c); border-color: currentColor; background: color-mix(in srgb, var(--danger, #c0362c) 10%, transparent); }
.dictation-toggle.is-listening .mic-icon { animation: mic-pulse 1.2s ease-in-out infinite; }
.dictation-interim { color: var(--muted); font-style: italic; font-size: 0.875rem; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dictation-interim:empty, .dictation-status:empty { display: none; }
.dictation-status { flex-basis: 100%; }
@keyframes mic-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dictation-toggle.is-listening .mic-icon { animation: none; } }
