:root {
  --orange: #f1a82c;
  --orange-dark: #b8612b;
  --text: #1a1a1a;
  --text-soft: #555;
  --border: #d6d6d6;
  --bg: #fafafa;
  --bg-card: #ffffff;
  --pour: #2e7d32;
  --contre: #c62828;
  --abst: #757575;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

#app { max-width: 900px; margin: 0 auto; padding: 24px 16px 64px; }

.screen.hidden { display: none; }

header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--bg-card);
  border: 2px solid var(--orange);
  border-radius: 12px;
  margin-bottom: 24px;
}
.brand-title { font-size: 24px; font-weight: 800; color: var(--orange-dark); }
.brand-sub { font-size: 14px; color: var(--text-soft); }
.identity { padding-top: 12px; border-top: 1px solid var(--border); }
.copro-name { font-size: 18px; font-weight: 700; }
.copro-tantiemes { font-size: 13px; color: var(--text-soft); margin-top: 4px; }

.docs-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange-dark);
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
}
.docs-banner-title { font-weight: 600; color: var(--orange-dark); }
.docs-banner-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.docs-banner-links a {
  color: var(--orange-dark);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(184, 97, 43, 0.4);
  text-underline-offset: 3px;
}
.docs-banner-links a:hover { text-decoration-color: var(--orange-dark); }
.docs-sep { color: var(--text-soft); }
.docs-banner-hint { font-size: 12px; color: var(--text-soft); }

.info-box {
  background: #fef6e9;
  border-left: 4px solid var(--orange);
  padding: 16px 20px;
  border-radius: 4px;
  margin-bottom: 24px;
  font-size: 14px;
}
.info-box ul { margin: 8px 0 0; padding-left: 20px; }
.info-box li { margin: 4px 0; }

.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.section h2 { margin: 0 0 12px; font-size: 18px; color: var(--orange-dark); }
.hint { font-size: 13px; color: var(--text-soft); margin: 4px 0 12px; }

.presence-options { display: flex; flex-direction: column; gap: 10px; }
.presence-option {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; transition: background .15s;
}
.presence-option:hover { background: #f5f5f5; }
.presence-option input[type=radio] { width: 18px; height: 18px; }
.proxy-detail {
  margin-left: 32px; margin-top: -4px; margin-bottom: 4px;
  padding-bottom: 8px;
}
.proxy-detail select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 14px; width: 100%; max-width: 400px;
}

.bulk-actions { display: flex; gap: 8px; margin-bottom: 12px; }

button {
  font-family: inherit;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  cursor: pointer;
  transition: opacity .15s;
}
button:hover { opacity: 0.85; }
button.primary {
  background: var(--orange);
  color: white;
  font-weight: 600;
  font-size: 16px;
  padding: 12px 24px;
}
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.vote-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.vote-table th, .vote-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.vote-table th {
  background: #f8f8f8;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-soft);
}
.col-res { width: auto; }
.col-art { width: 50px; text-align: center; }
.col-vote { width: 70px; text-align: center; }
.vote-table td.col-vote { text-align: center; }
.vote-table tr td:first-child { font-weight: 500; }
.res-id { display: inline-block; min-width: 36px; font-weight: 700; color: var(--orange-dark); }
.res-title { font-weight: 500; }
.vote-table input[type=radio] { width: 18px; height: 18px; cursor: pointer; }
.vote-table tbody tr:hover { background: #fafafa; }

.cell-title { vertical-align: top; padding-top: 10px !important; }
.title-line { display: flex; align-items: center; gap: 6px; }
.expand-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 22px; height: 22px;
  padding: 0;
  border-radius: 4px;
  font-size: 14px; line-height: 1;
  cursor: pointer;
  transition: transform .15s;
  flex-shrink: 0;
}
.expand-btn.open { transform: rotate(90deg); background: var(--orange); color: white; border-color: var(--orange); }
.res-context {
  margin-top: 8px;
  padding: 10px 12px;
  background: #fef6e9;
  border-left: 3px solid var(--orange);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.55;
}
.res-context .ctx-paragraph { margin: 0 0 8px; }
.res-context .ctx-paragraph:last-child { margin-bottom: 0; }
.res-context .ctx-vote-text { padding: 8px 10px; background: rgba(255,255,255,0.6); border-radius: 3px; color: var(--text); margin-top: 10px; }
.res-context .ctx-meta { font-size: 11px; color: #888; margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--border); }
.res-context strong { color: var(--text); }
.res-context em { color: var(--text); }
.res-context .ctx-table {
  width: 100%; border-collapse: collapse; margin: 4px 0;
  font-size: 12px; background: white; border-radius: 3px; overflow: hidden;
}
.res-context .ctx-table th, .res-context .ctx-table td {
  padding: 4px 8px; border: 1px solid var(--border); text-align: left;
}
.res-context .ctx-table th { background: #f4e5c4; color: var(--orange-dark); font-weight: 700; }
.res-context .ctx-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.res-context .ctx-docs { margin-top: 10px; padding: 8px 10px; background: rgba(255,255,255,0.6); border-radius: 3px; font-size: 12px; }
.res-context .ctx-docs-label { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.res-context .ctx-docs ul { margin: 0; padding-left: 18px; }
.res-context .ctx-docs li { margin: 2px 0; color: var(--text); }
.res-context .ctx-docs a { color: var(--orange-dark); }

.save-status {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-soft);
}
.save-status.ok { color: var(--pour); }
.save-status.err { color: var(--contre); }

/* Print-only area */
.print-only { display: none; }
@media print {
  body > #app { display: none !important; }
  .print-only { display: block !important; padding: 2cm; font-family: "Times New Roman", serif; }
  .print-only h1 { text-align: center; }
  .print-only table { width: 100%; border-collapse: collapse; }
  .print-only td, .print-only th { padding: 4px 8px; border: 1px solid #888; }
  .print-only .sig-block { margin-top: 2cm; text-align: right; }
}

@media (max-width: 600px) {
  .vote-table th, .vote-table td { padding: 6px 4px; font-size: 13px; }
  .col-vote { width: 50px; }
  header { padding: 16px; }
  .brand-title { font-size: 20px; }
}
