:root {
  --bg: #ebe6dc;
  --ink: #15202b;
  --muted: #5c6b7a;
  --card: #f7f4ee;
  --offwhite: #f7f4ee;
  --line: #d9d2c4;
  --accent: #0b6e4f;
  --accent-dark: #085640;
  --brand: #b4e600;
  --warn: #9a5b00;
  --warn-bg: #fff3dc;
  --ok: #1b7a4a;
  --ok-bg: #e5f6ec;
  --change-bg: #fff4e5;
  --side-w: 320px;
  --guide-w: 340px;
  --top-h: 58px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 1px 2px rgba(21, 32, 43, 0.06), 0 8px 24px rgba(21, 32, 43, 0.06);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); height: 100%;
}
body.page-workspace { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top {
  position: relative; z-index: 30; height: var(--top-h);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 0 14px; background: var(--offwhite); color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; }
.brand-logo {
  height: 36px; width: auto; max-width: 120px; object-fit: contain;
  background: transparent; border-radius: 4px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { color: var(--accent); font-weight: 700; font-size: 0.95rem; line-height: 1.1; }
.brand .sub { font-size: 0.68rem; opacity: 0.75; color: var(--muted); }
.who { display: flex; gap: 12px; align-items: center; font-size: 0.8rem; flex-wrap: wrap; justify-content: flex-end; }
.who a { color: var(--accent); font-weight: 600; }
.who .email { opacity: 0.85; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wrap { max-width: 960px; margin: 0 auto; padding: 16px 14px 48px; }
.wrap.narrow { max-width: 440px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card.compact { padding: 12px; }
.login-card { margin-top: 48px; }
h1 { font-size: 1.35rem; margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 0.9rem; }
.err { color: #a11; font-weight: 600; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 0.88rem; font-weight: 600; }
input, select, textarea, button {
  font: inherit; border-radius: 10px; border: 1px solid var(--line); padding: 11px 12px; width: 100%;
  background: var(--offwhite); color: var(--ink);
}
textarea { resize: vertical; }
.btn {
  display: inline-flex; justify-content: center; align-items: center;
  background: #e4ddd0; color: var(--ink); border: 1px solid var(--line);
  font-weight: 700; cursor: pointer; text-align: center; width: 100%;
}
.btn.primary { background: var(--accent); color: #f7f4ee; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; }

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  height: calc(100dvh - var(--top-h));
  height: calc(100vh - var(--top-h));
  overflow: hidden;
}
.side {
  background: var(--offwhite);
  padding: 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
.detail-host {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.panels-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: auto;
}
.pane {
  padding: 14px;
  min-height: 0;
}
.pane-guide { padding-top: 0; }
.mobile-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 12px; font-weight: 700; color: var(--accent);
}
.pane-empty {
  display: grid; place-items: center; flex: 1;
  color: var(--muted); text-align: center; padding: 24px;
}
.mobile-hint { display: block; }
.desktop-only-empty { display: none; }

/* Mobile: list OR detail */
@media (max-width: 1099px) {
  .workspace.show-list .detail-host { display: none; }
  .workspace.show-detail .side { display: none; }
  .workspace.show-detail .detail-host { display: flex; }
}

/* Desktop 3 columns: liste | revue | guide OC */
@media (min-width: 1100px) {
  .workspace {
    grid-template-columns: var(--side-w) minmax(0, 1fr) !important;
  }
  .workspace .side {
    display: block !important;
    border-right: 1px solid var(--line);
    height: 100%;
  }
  .workspace .detail-host {
    display: block !important;
    height: 100%;
    overflow: hidden;
  }
  .panels-inner {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) var(--guide-w);
    height: 100%;
    overflow: hidden;
  }
  .pane-review {
    overflow: auto;
    height: 100%;
    padding: 18px 18px 32px;
    border-right: 1px solid var(--line);
  }
  .pane-guide {
    overflow: auto;
    height: 100%;
    padding: 18px 16px 32px;
    background: var(--offwhite);
  }
  .mobile-back { display: none !important; }
  .mobile-hint { display: none; }
  .desktop-only-empty { display: block; }
  .name-diff {
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
  }
  .name-diff .name-note { grid-column: 1 / -1; }
  .name-diff .arrow { padding-top: 18px; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .actions { max-width: 360px; }
  .guide.card { position: sticky; top: 0; }
}

.dept-bar { margin-bottom: 10px; }
.dept-bar select { font-weight: 700; background: var(--offwhite); border-color: #9bbfb3; }

.progress .prog-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.9rem; }
.bar { height: 8px; background: #ddd5c6; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #2a9b74); }
.mini { margin: 8px 0 0; font-size: 0.75rem; color: var(--muted); }

.filters { display: grid; gap: 8px; margin-bottom: 10px; }
.filters.inline { grid-template-columns: 220px; }

.list { list-style: none; margin: 0; padding: 0 0 24px; display: grid; gap: 6px; }
.item-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; color: inherit; cursor: pointer;
}
.item-row:hover { border-color: #9bbfb3; }
.item-row.is-active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); background: #efebe3; }
.item-row.is-done { opacity: 0.88; }
.item-main { display: grid; gap: 2px; min-width: 0; }
.item-main strong { font-size: 0.92rem; }
.diff-line { font-size: 0.75rem; color: var(--warn); }
.item-meta { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; flex-shrink: 0; }
.pill {
  font-size: 0.68rem; font-weight: 700; padding: 3px 7px; border-radius: 999px;
  background: #e4ddd0; color: var(--ink); white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.todo { background: #ffe9c7; color: var(--warn); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.empty-li { color: var(--muted); padding: 16px; text-align: center; font-size: 0.9rem; }

.detail h1 { font-size: 1.4rem; }
.cat { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.7rem; color: var(--muted); margin: 0 0 4px; }

.name-diff {
  display: grid; gap: 8px; background: var(--warn-bg); border: 1px solid #f0d9a8;
  border-radius: 12px; padding: 12px; margin: 12px 0;
}
.name-diff.name-same {
  background: #efebe3; border-color: var(--line);
}
.name-diff .lbl { display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--warn); margin-bottom: 2px; }
.name-same .lbl { color: var(--muted); }
.name-diff .arrow { text-align: center; color: var(--warn); font-weight: 700; }
.name-note { margin: 4px 0 0; font-size: 0.82rem; color: #6d4a10; }
.ok-note { color: var(--ok); }

.facts { display: grid; gap: 8px; margin: 14px 0; }
.facts div { background: #efebe3; border-radius: 10px; padding: 10px; }
.facts dt { font-size: 0.68rem; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-size: 0.92rem; }

.hint { background: #efebe3; border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 8px; font-size: 0.88rem; }

.guide {
  border-radius: 12px; padding: 14px 16px; border: 1px solid var(--line);
  background: var(--offwhite);
}
.guide[data-tone="change"] { background: var(--change-bg); border-color: #f0c98a; }
.guide[data-tone="ok"] { background: var(--ok-bg); border-color: #b7dfc6; }
.guide h2 { font-size: 1rem; margin-bottom: 10px; }
.guide-steps { margin: 0; padding-left: 1.15rem; line-height: 1.5; font-size: 0.9rem; }
.guide-steps li { margin-bottom: 8px; }
.step-items { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.oc-ico {
  width: 16px; height: 16px; image-rendering: pixelated;
  vertical-align: middle; flex-shrink: 0;
}
.guide-tip {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 10px;
  background: #efebe3; font-size: 0.84rem; color: #3d4a56;
  border: 1px dashed #c5d0d8;
}

.actions { display: grid; gap: 8px; }
.ok-msg { color: var(--ok); font-weight: 700; font-size: 0.9rem; }
.toast {
  background: var(--ok-bg); color: var(--ok); border: 1px solid #b7dfc6;
  padding: 10px 12px; border-radius: 10px; font-weight: 600; margin: 0 12px 12px;
}
.help { padding-left: 1.2rem; line-height: 1.55; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
th { font-size: 0.72rem; color: var(--muted); }
code { background: #e4ddd0; padding: 2px 6px; border-radius: 6px; font-size: 0.8rem; }
.back { margin: 0 0 10px; }
.soon { text-align: center; padding: 24px 16px; }
.detail-host.loading { opacity: 0.55; pointer-events: none; }

@media (max-width: 520px) {
  .brand-text { display: none; }
  .who .email { display: none; }
  .who { gap: 10px; }
}
