/* Gralis-Anketarium – an das Erscheinungsbild von gralis2.at angelehnt */

:root {
  --gralis-blue: #4c6c8f;      /* Menü */
  --gralis-blue-dark: #34506e;
  --gralis-light: #cfdced;     /* Banner, Hervorhebungen */
  --gralis-beige: #e5e4d9;     /* Zwischenüberschriften */
  --gralis-navy: #071144;      /* Überschriften */
  --grey-bg: #f0f0f0;
  --border: #c5cbd3;
  --text: #1a1a1a;
  --muted: #5d6670;
  --ok: #2f6b3a;
  --ok-bg: #e3f1e5;
  --warn: #7a5a00;
  --warn-bg: #fff4d6;
  --err: #8b1e1e;
  --err-bg: #fbe5e5;
  --font: Verdana, Helvetica, sans-serif;
  --font-head: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  line-height: 1.55;
}

a { color: var(--gralis-blue-dark); }
a:hover, a:focus { color: var(--gralis-navy); }
:focus-visible { outline: 2px solid var(--gralis-navy); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--gralis-navy); color: #fff; padding: .5rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0; }

/* Kopf */
.breadcrumbs {
  padding: .3rem 1rem;
  font-size: .75rem;
  border-bottom: 1px solid var(--border);
}
.breadcrumbs a { color: var(--text); }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1rem;
  background: linear-gradient(90deg, var(--gralis-light), #fff);
  border-bottom: 3px solid var(--gralis-blue);
}
.brand { text-decoration: none; color: var(--gralis-navy); display: flex; align-items: baseline; gap: .6rem; }
.brand-name { font-family: Georgia, serif; font-size: 2rem; letter-spacing: .12em; font-weight: bold; }
.brand-sub { font-family: var(--font-head); font-size: .95rem; color: var(--gralis-blue-dark); }

.lang-switch { display: flex; align-items: center; gap: .4rem; font-size: .8rem; }
.lang-switch select { font: inherit; padding: .15rem .3rem; }

/* Seitenaufbau */
.page { display: flex; align-items: flex-start; min-height: 60vh; }

.sidebar {
  flex: 0 0 12.5rem;
  background: var(--gralis-blue);
  color: #fff;
  font-size: .75rem;
  padding-bottom: 1rem;
  align-self: stretch;
}
.sidebar .menutitle {
  font-weight: bold;
  padding: .55rem .8rem .3rem;
  border-bottom: 1px solid rgba(255, 255, 255, .25);
}
.sidebar ul { list-style: none; margin: 0 0 .4rem; padding: 0; }
.sidebar a {
  display: block; color: #fff; text-decoration: none;
  padding: .3rem .8rem .3rem 1.2rem;
}
.sidebar a:hover, .sidebar a:focus { background: var(--gralis-blue-dark); color: #fff; }
.sidebar a[aria-current="page"] { background: var(--gralis-light); color: var(--gralis-navy); font-weight: bold; }

.content { flex: 1; min-width: 0; padding: 1rem 1.5rem 2rem; max-width: 70rem; }

h1 { font-family: var(--font-head); font-size: 1.3rem; color: var(--gralis-navy); margin: .2rem 0 .8rem; }
h2 {
  font-family: var(--font-head); font-size: 1.05rem; font-weight: bold;
  background: var(--gralis-beige); padding: .3rem .6rem; margin: 1.5rem 0 .7rem;
}
h3 { font-family: Georgia, serif; font-size: 1rem; color: var(--gralis-navy); margin: 1.2rem 0 .5rem; }

.lead { font-size: .95rem; max-width: 50rem; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; }

/* Hinweise */
.notice { border-left: 4px solid; padding: .5rem .9rem; margin: 0 0 1rem; }
.notice p { margin: .2rem 0; }
.notice-success { border-color: var(--ok); background: var(--ok-bg); }
.notice-warning { border-color: var(--warn); background: var(--warn-bg); }
.notice-error   { border-color: var(--err); background: var(--err-bg); }
.notice-info    { border-color: var(--gralis-blue); background: var(--gralis-light); }

/* Listen */
.survey-list { list-style: none; padding: 0; margin: 0; }
.survey-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem;
  padding: .5rem .2rem; border-bottom: 1px solid var(--grey-bg);
}
.lang-tag {
  display: inline-block; font-size: .7rem; padding: 0 .4rem; margin-left: .2rem;
  border: 1px solid var(--border); border-radius: 3px; background: var(--grey-bg);
}

/* Fuß */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 1.2rem;
  padding: .7rem 1rem; font-size: .75rem;
  border-top: 3px solid var(--gralis-blue); background: var(--grey-bg);
}

/* Schmale Bildschirme */
@media (max-width: 760px) {
  .page { flex-direction: column; }
  .sidebar { flex: none; width: 100%; }
  .sidebar ul { display: flex; flex-wrap: wrap; }
  .sidebar a { padding: .4rem .8rem; }
  .content { padding: 1rem; }
  .brand-name { font-size: 1.5rem; }
}

@media print {
  .sidebar, .lang-switch, .breadcrumbs, .skip-link { display: none; }
  .content { padding: 0; }
}

/* Formulare und Schaltflächen */
.form { max-width: 34rem; }
.form.narrow { max-width: 22rem; }
.field { margin: 0 0 .9rem; display: flex; flex-direction: column; gap: .2rem; }
.field label { font-weight: bold; }
.field small { color: var(--muted); font-size: .75rem; }
input[type=text], input[type=email], input[type=password], input:not([type]), select, textarea {
  font: inherit; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 3px; background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--gralis-blue); }
.button {
  font: inherit; cursor: pointer; padding: .4rem 1rem; border-radius: 3px;
  border: 1px solid var(--gralis-blue); background: #fff; color: var(--gralis-blue-dark);
}
.button.primary { background: var(--gralis-blue); color: #fff; }
.button.primary:hover, .button.primary:focus { background: var(--gralis-blue-dark); }
.link-button {
  font: inherit; cursor: pointer; background: none; border: 0; padding: 0;
  color: inherit; text-decoration: underline;
}

/* Tabellen */
.table { border-collapse: collapse; width: 100%; max-width: 50rem; margin: 0 0 1rem; }
.table th, .table td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--grey-bg); vertical-align: top; }
.checks .status { width: 2rem; font-weight: bold; text-align: center; }
.checks .ok { color: var(--ok); }
.checks .fail { color: var(--err); }
.checks .warn { color: var(--warn); }
.checks .detail { color: var(--muted); font-size: .8rem; word-break: break-word; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.facts dt { font-weight: bold; }
.facts dd { margin: 0; }

/* Benutzer im Menü */
.user-box { padding: .5rem .8rem; border-top: 1px solid rgba(255, 255, 255, .25); }
.user-name { display: block; font-weight: bold; margin-bottom: .2rem; }
.user-box .link-button { color: #fff; }

.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;
}

/* Umfrageverwaltung */
.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.title-row h1 { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.back { margin: 0 0 .3rem; font-size: .8rem; }
a.button { display: inline-block; text-decoration: none; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .2rem 1rem; margin: .5rem 0 .3rem; }
.filters .field { margin-bottom: .4rem; }
.filters .actions { flex-direction: row; align-items: center; gap: .8rem; }
input[type=search] { font: inherit; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 3px; min-width: 14rem; }

.table-wrap { overflow-x: auto; }
.survey-table { max-width: none; font-size: .8rem; }
.survey-table thead th { background: var(--gralis-light); white-space: nowrap; }
.survey-table thead a { color: var(--gralis-navy); }
.survey-table tbody tr:hover { background: #f7f9fc; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.code { font-family: Consolas, "Courier New", monospace; overflow-wrap: anywhere; }
.survey-table td.code { white-space: nowrap; overflow-wrap: normal; }
.survey-table td:nth-child(2) { min-width: 14rem; }

.badge {
  display: inline-block; font-size: .7rem; font-weight: normal; line-height: 1.4; white-space: nowrap;
  padding: .05rem .45rem; border-radius: 3px; border: 1px solid var(--border); background: var(--grey-bg); color: var(--text);
  font-family: var(--font);
}
.status-draft    { background: #eef0f3; }
.status-open     { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.status-closed   { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.status-archived { background: #e8e8e8; color: var(--muted); }
.badge.required  { border-color: var(--err); color: var(--err); background: #fff; }

.pager { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0; }
.pager a, .pager span { padding: .2rem .55rem; border: 1px solid var(--border); border-radius: 3px; text-decoration: none; }
.pager span[aria-current] { background: var(--gralis-blue); color: #fff; border-color: var(--gralis-blue); }

.button-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.button.danger { background: var(--err); border-color: var(--err); color: #fff; }
.danger-zone { border: 1px solid var(--err); background: #fff8f8; padding: .5rem 1rem 1rem; max-width: 40rem; }

.lang-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .8rem; }
.lang-tabs a, .lang-tabs span { padding: .2rem .7rem; border: 1px solid var(--border); border-radius: 3px 3px 0 0; text-decoration: none; }
.lang-tabs span[aria-current] { background: var(--gralis-light); font-weight: bold; }

.structure .group { margin-bottom: 1rem; }
.structure .group h3 { border-bottom: 1px solid var(--gralis-light); padding-bottom: .2rem; }
.questions { padding-left: 1.6rem; }
.questions > li { margin: 0 0 .9rem; }
.q-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; }
.q-text { font-weight: bold; white-space: pre-wrap; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.options { margin: .3rem 0 0; padding-left: 1.2rem; list-style: circle; }
.var { font-family: Consolas, "Courier New", monospace; font-size: .72rem; color: var(--muted); font-weight: normal; }
.media-text { background: var(--grey-bg); padding: .4rem .6rem; margin: .3rem 0; font-size: .8rem; }
.survey-text { background: #fafaf6; border-left: 3px solid var(--gralis-beige); padding: .1rem .8rem; margin: 0 0 1rem; }
.survey-text h3 { font-size: .85rem; margin: .5rem 0 .2rem; }

fieldset.field { border: 0; padding: 0; }
fieldset.field legend { font-weight: bold; padding: 0; margin-bottom: .2rem; }
.checks-inline { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.checks-inline label { font-weight: normal; }

/* Ergebnisse */
.small { font-size: .75rem; }
.results-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; margin-bottom: .3rem; }
.results-summary .muted.small { flex-basis: 100%; margin: 0; }
.big-number { margin: 0; }
.big-number strong { font-size: 1.6rem; color: var(--gralis-navy); margin-right: .3rem; }
.export { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.export .button { padding: .25rem .7rem; font-size: .78rem; }
.filter-box ul { margin: .2rem 0; padding-left: 1.2rem; }
.filter-box a { margin-left: .5rem; }

.result-q { margin: 0 0 1.6rem; }
.result-q h3 { font-family: var(--font); font-size: .9rem; color: var(--text); margin: 1rem 0 .2rem; }
.result-q .q-meta { margin: 0 0 .4rem; }
.freq { max-width: 52rem; font-size: .8rem; }
.freq thead th { font-weight: normal; color: var(--muted); border-bottom: 1px solid var(--border); }
.freq tbody th { font-weight: normal; }
.freq .bar-col { width: 32%; min-width: 6rem; }
.bar { display: block; height: .9rem; background: var(--gralis-blue); border-radius: 0 2px 2px 0; min-width: 1px; }
.bar.other { background: var(--muted); }
.filter-link { text-decoration: none; margin-left: .3rem; color: var(--gralis-blue); font-size: .8rem; }
.comments-row td { padding-top: 0; border-bottom: 1px solid var(--grey-bg); }
details summary { cursor: pointer; color: var(--gralis-blue-dark); font-size: .8rem; }
.text-answers { margin: .3rem 0 .5rem; padding-left: 1.2rem; max-height: 22rem; overflow-y: auto; font-size: .8rem; }
.text-answers li { margin-bottom: .15rem; white-space: pre-wrap; }

@media print {
  .export, .filter-link, .lang-tabs { display: none; }
  details { display: block; }
  .text-answers { max-height: none; overflow: visible; }
  .bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Editor */
.main-actions { margin: .2rem 0 1rem; }
.form.wide { max-width: 50rem; }
textarea { width: 100%; resize: vertical; }
.field-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .2rem 1rem; }
.field-row .field { margin-bottom: .7rem; }
.grow { flex: 1 1 14rem; min-width: 0; }
.grow input { width: 100%; }
.code-input { font-family: Consolas, "Courier New", monospace; width: 12rem; }
.value-input { width: 8rem; }
.num-input { width: 7rem; }
label.check { display: inline-flex; align-items: center; gap: .3rem; font-weight: normal; margin-bottom: .9rem; }
label.check.small { margin: 0; font-size: .75rem; white-space: nowrap; }
.ref { display: block; color: var(--muted); font-size: .72rem; font-style: italic; white-space: pre-wrap; }

.ed-group { border: 1px solid var(--border); border-radius: 4px; padding: .3rem .9rem .6rem; margin: 0 0 1.2rem; }
.ed-group > .ed-head h3 { margin: .5rem 0; }
.ed-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem 1rem; }
.ed-actions { display: flex; gap: .2rem; flex-shrink: 0; }
form.mini { display: inline; margin: 0; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.9rem; height: 1.9rem; padding: 0 .4rem;
  font: inherit; font-size: .85rem; line-height: 1; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border); border-radius: 3px; background: #fff; color: var(--gralis-blue-dark);
}
.icon-button:hover, .icon-button:focus { border-color: var(--gralis-blue); background: var(--gralis-light); }
.icon-button.danger { color: var(--err); }
.icon-button.danger:hover, .icon-button.danger:focus { background: var(--err-bg); border-color: var(--err); }

.ed-questions { padding-left: 1.4rem; margin: .3rem 0; }
.ed-question { padding: .45rem 0; border-top: 1px dotted var(--border); }
.ed-question.is-editing { background: #f7f9fc; padding: .6rem .7rem; border: 1px solid var(--gralis-blue); border-radius: 4px; margin: .4rem 0; }
.ed-question .q-meta { display: inline-flex; margin-left: .4rem; }
.missing { color: var(--muted); font-style: italic; }
.ed-form { max-width: none; margin: .3rem 0; }
.ed-options { margin-top: .8rem; border-top: 1px solid var(--border); padding-top: .4rem; }
.ed-options h4 { margin: .2rem 0 .4rem; font-size: .85rem; }
.ed-option { display: flex; align-items: flex-start; gap: .25rem; margin-bottom: .35rem; }
.option-form { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; flex: 1; min-width: 0; margin: 0; }
.add-option { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--border); }
.ed-add { margin: .5rem 0 0; }
.ed-add > summary { font-weight: bold; }
.ed-add-group { border: 1px dashed var(--gralis-blue); border-radius: 4px; padding: .5rem .9rem; }

/* Teilnahme */
.public-link { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; max-width: 50rem; }
.public-link label { font-weight: bold; }
.public-link input { flex: 1 1 20rem; font-family: Consolas, "Courier New", monospace; font-size: .8rem; }
.preview-banner { position: sticky; top: 0; z-index: 5; }
.take { max-width: 46rem; }
.take .intro { font-size: .95rem; margin: 0 0 .8rem; }
.privacy-note { max-width: 46rem; }
.take-form { max-width: 46rem; }
.take-group { margin: 0 0 1.2rem; }
.take-q { margin: 0 0 1.4rem; padding: .2rem 0 .2rem .8rem; border-left: 3px solid transparent; }
.take-q.has-error { border-left-color: var(--err); background: #fffafa; }
.take-q fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q-label { display: block; font-weight: bold; margin: 0 0 .4rem; padding: 0; font-size: .9rem; }
.q-label-text { white-space: pre-wrap; }
.q-num { color: var(--muted); font-weight: normal; margin-right: .2rem; }
.req { color: var(--err); font-weight: bold; margin-left: .15rem; }
.q-help { color: var(--muted); font-size: .8rem; margin: -.2rem 0 .5rem; }
.q-error { color: var(--err); font-weight: bold; font-size: .8rem; margin: 0 0 .4rem; }
.choices { display: flex; flex-direction: column; gap: .35rem; }
.choices.scale { flex-direction: row; flex-wrap: wrap; gap: .4rem 1.2rem; }
.choice { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; }
.choice input[type=radio], .choice input[type=checkbox] { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--gralis-blue); }
.choice label { cursor: pointer; }
.choice .comment { flex: 1 1 12rem; max-width: 22rem; padding: .2rem .4rem; }
.text-answer { width: 100%; max-width: 34rem; }
.take-form textarea { max-width: 40rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.button.big { font-size: 1rem; padding: .55rem 1.6rem; }

/* Benutzer und Freigaben */
tr.inactive td, tr.inactive th { color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: .5rem 0 1rem; }
.inline-form label:not(.check) { font-weight: bold; }
.access-table { max-width: 44rem; }
.access-table td { text-align: center; }
.access-table th, .access-table td:last-child { text-align: left; }
.grant-form { padding: .6rem .8rem; border: 1px dashed var(--gralis-blue); border-radius: 4px; max-width: 50rem; }
