/* Köhler Transfer – colours taken from the logo */
:root {
  --red: #cc1034;
  --red-dark: #a30c29;
  --red-soft: #fbe9ec;
  --ink: #111111;
  --ink-2: #4a4a4a;
  --line: #e3e3e3;
  --bg: #f6f6f4;
  --white: #ffffff;
  --green: #1d7a46;
  --green-soft: #e6f4ec;
  --amber: #8a5a00;
  --amber-soft: #fff4dc;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--red); }
a:hover { color: var(--red-dark); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 20px; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; margin: 0.4em 0; }
h2 { font-size: 1.15rem; margin: 0 0 0.4em; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.error-text { color: var(--red-dark); }

/* Header: white with the red line from the logo */
.topbar { background: var(--white); border-bottom: 4px solid var(--red); }
.topbar-inner { display: flex; align-items: center; gap: 28px; min-height: 72px; }
.brand img { height: 52px; display: block; }
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a, .subnav a { text-decoration: none; color: var(--ink); font-weight: 600; padding: 8px 14px; border-radius: var(--radius); }
.mainnav a:hover, .subnav a:hover { background: var(--red-soft); }
.mainnav a.active, .subnav a.active { background: var(--red); color: var(--white); }
.langswitch { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.langswitch a { padding: 5px 10px; text-decoration: none; color: var(--ink); font-size: 0.85rem; font-weight: 600; }
.langswitch a.active { background: var(--ink); color: var(--white); }

main.wrap { padding-top: 20px; padding-bottom: 40px; min-height: 70vh; }
.footer { display: flex; gap: 18px; padding: 18px 20px 30px; color: var(--ink-2); font-size: 0.85rem; border-top: 1px solid var(--line); }
.footer a { color: var(--ink-2); }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
.narrow-left { max-width: 640px; }
.section { margin-top: 32px; }
.count { display: inline-block; background: var(--ink); color: var(--white); border-radius: 999px; font-size: 0.75rem; padding: 1px 9px; vertical-align: middle; font-weight: 600; }

.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.actions { display: flex; gap: 8px; align-items: center; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius);
  border: 1px solid var(--ink); background: var(--white); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--ink); color: var(--white); }
.btn-primary { background: var(--red); border-color: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--red-soft); color: var(--ink); }
.btn-small { padding: 4px 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 8px; }
.form label, .filters label { font-weight: 600; font-size: 0.9rem; }
.form .btn { margin-top: 8px; align-self: flex-start; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #bdbdbd; border-radius: var(--radius); background: var(--white); color: var(--ink); width: 100%; }
input:focus, select:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px var(--red-soft); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.grid-form > div { display: flex; flex-direction: column; gap: 4px; }
.grid-form .span-2 { grid-column: span 2; }
.inline { display: flex; gap: 8px; }
.inline .btn { margin-top: 0; white-space: nowrap; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; min-width: 160px; }
.filters .table-search { margin-left: auto; }

/* Messages */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border-left: 4px solid; }
.flash-ok { background: var(--green-soft); border-color: var(--green); }
.flash-error { background: var(--red-soft); border-color: var(--red); }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: var(--radius);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); }

/* Tiles on home */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 18px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 24px; background: var(--white); border: 1px solid var(--line);
  border-top: 6px solid var(--red); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--red); color: var(--ink); }
.tile-dark { border-top-color: var(--ink); }
.tile-title { font-size: 1.2rem; font-weight: 700; }
.tile-desc { color: var(--ink-2); }

/* Progress */
.progress-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; }
.progress-label { margin-bottom: 8px; }
.bar { height: 10px; background: #ececec; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--red); border-radius: 999px; transition: width .4s ease; }
.bar-fill.bar-complete { background: var(--green); }
.bar-inline { display: inline-block; width: 120px; vertical-align: middle; margin-right: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.stat-num { font-size: 1.7rem; font-weight: 700; }
.stat-warn .stat-num { color: var(--red); }
.refresh-card { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.refresh-card > div { flex: 1; }
.refresh-card .bar { margin-top: 10px; max-width: 480px; }

/* Tables */
.tablebar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.table-search { max-width: 280px; }
.tablewrap { overflow: auto; max-height: 70vh; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.tablewrap.short { max-height: 420px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { position: sticky; top: 0; z-index: 1; background: var(--red); color: var(--white); text-align: left; padding: 9px 10px; font-size: 0.85rem; white-space: nowrap; }
table.data td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: #fafafa; }
table.data tr.row-done { background: var(--green-soft); }
.th-select { min-width: 190px; }
.th-progress { min-width: 170px; }
.cell-select { padding: 5px 8px; font-size: 0.9rem; }
.cell-select.empty { border-color: var(--red); background: #fff8f9; }
.cell-select.saving { opacity: 0.6; }
.empty-row { text-align: center; color: var(--ink-2); padding: 24px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.badge-done { background: var(--green); color: var(--white); }
.badge-open { background: #ececec; color: var(--ink-2); }
.tag { display: inline-block; font-size: 0.72rem; padding: 0 6px; border-radius: 4px; background: var(--ink); color: var(--white); font-weight: 600; }
.tag-warn { background: var(--amber-soft); color: var(--amber); }
code.pw { background: var(--red-soft); padding: 2px 8px; border-radius: 4px; font-size: 0.95rem; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .brand img { height: 40px; }
  .refresh-card { flex-direction: column; }
  .grid-form .span-2 { grid-column: auto; }
  .filters .table-search { margin-left: 0; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
