/* Schichtplan – Apple-Stil */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: rgba(60, 60, 67, .13);
  --fill: #e8e8ed;          /* Sekundär-Buttons, Chips */
  --fill-2: #f2f2f7;
  --accent: #b8892e;        /* Gold */
  --accent-hover: #a67a24;
  --accent-text: #8a6516;   /* dunkleres Gold für Schrift */
  --accent-soft: rgba(201, 162, 74, .18);
  --gold-grad: linear-gradient(180deg, #d9b766 0%, #b8892e 100%);
  --gold-grad-hover: linear-gradient(180deg, #cfab55 0%, #a67a24 100%);
  --red: #ff3b30;
  --green: #248a3d;
  --green-soft: rgba(52, 199, 89, .14);
  --orange: #c93400;
  --orange-soft: rgba(255, 159, 10, .16);
  --mine: rgba(201, 162, 74, .09);
  --radius: 18px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 2rem; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; margin: 0 0 .5rem; }
h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 .7rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 1.6rem 0 .6rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; background: var(--fill-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Kopfzeile – Milchglas */
.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px max(16px, calc((100vw - 1100px) / 2 + 16px));
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); margin-right: auto; }
.brand:hover { text-decoration: none; }
.logo { height: 38px; width: auto; display: block; }
.logo-text { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 1.05rem; }
.app { font-size: .95rem; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
/* Navigation als Segment-Control */
.top nav { display: flex; gap: 2px; padding: 3px; background: var(--fill); border-radius: 10px; }
.top nav a { color: var(--ink); padding: 5px 14px; border-radius: 8px; font-size: .88rem; font-weight: 500; }
.top nav a:hover { text-decoration: none; background: rgba(255,255,255,.5); }
.top nav a.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }

main { max-width: 1100px; margin: 0 auto; padding: 32px 16px 80px; }

/* Bausteine */
.card { background: var(--card); border-radius: var(--radius); padding: 24px; margin-bottom: 22px; box-shadow: var(--shadow); }
.card.narrow { max-width: 400px; margin: 48px auto; padding: 32px 28px; }
.card.narrow h1 { font-size: 1.75rem; text-align: center; margin-bottom: 1.2rem; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 500; font-size: .88rem; color: var(--ink); }
input, select {
  font: inherit; font-size: .95rem; padding: 10px 12px; width: 100%;
  border: 1px solid rgba(0,0,0,.12); border-radius: var(--radius-s);
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 13px center;
}
input::placeholder { color: #a1a1a6; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(201,162,74,.25); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font: inherit; font-size: .92rem; font-weight: 500; padding: 9px 18px;
  border-radius: 980px; border: 0; background: var(--fill); color: var(--ink);
  cursor: pointer; white-space: nowrap; transition: background-color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; background: #dcdce1; }
.btn:active { box-shadow: inset 0 0 0 999px rgba(0,0,0,.06); }
.btn.primary { background: var(--gold-grad); color: #fff; text-shadow: 0 1px 1px rgba(90,60,0,.25); box-shadow: 0 1px 2px rgba(140,100,20,.25); }
.btn.primary:hover { background: var(--gold-grad-hover); }
.btn.ghost { background: var(--fill-2); }
.btn.ghost:hover { background: var(--fill); }
.btn.small { padding: 6px 14px; font-size: .84rem; }
.btn.on { background: var(--green-soft); color: var(--green); }
.stack .btn.primary { padding: 12px 18px; font-size: 1rem; }

.mini {
  font: inherit; font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: 980px;
  border: 0; background: var(--gold-grad); color: #fff; cursor: pointer;
}
.mini:hover { background: var(--gold-grad-hover); }
.rename .mini { background: var(--fill); color: var(--ink); padding: 4px 9px; }
form.inline { display: inline; }

.flash { padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 18px; background: var(--green-soft); color: var(--green); font-weight: 500; }
.flash-err { background: rgba(255,59,48,.1); color: #d70015; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 11px; margin: 2px 4px 2px 0;
  border-radius: 980px; background: var(--fill-2); font-size: .84rem; font-weight: 500; color: var(--ink);
}
a.chip { padding-right: 11px; }
a.chip:hover { text-decoration: none; background: var(--fill); }
.chip.mine { background: var(--accent-soft); color: var(--accent-text); }
.chip.assigned { background: var(--green-soft); color: var(--green); }
.chip:not(:has(form)) { padding-right: 11px; }

.x {
  font: inherit; font-size: .62rem; line-height: 1; width: 18px; height: 18px; margin-left: 6px; padding: 0;
  border-radius: 50%; border: 0; background: rgba(120,120,128,.16); color: var(--muted);
  cursor: pointer; vertical-align: 1px; transition: background-color .15s, color .15s;
}
.chip .x { margin-left: 0; }
.x:hover { background: var(--red); color: #fff; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 980px; background: var(--fill-2); font-size: .78rem; font-weight: 500; color: var(--muted); }
.tag.admin { background: var(--ink); color: #fff; }
.tag.warn { background: var(--orange-soft); color: var(--orange); }

/* Begrüßung */
.hello { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 22px; }
.hello > div { flex: 1 1 420px; }
.hello p { margin: .3rem 0; color: var(--muted); }
.hello-side { flex: 0 1 360px; display: grid; gap: 10px; justify-items: start; }
.hello-side .hint { flex: none; width: 100%; }
details.cal .editform { justify-items: stretch; }
details.cal .editform p { margin: 0; }
details.cal .editform .btn { width: 100%; }
.calbtn { padding: 5px 10px; }
.hint { flex: 0 1 360px; margin: 0; font-size: .86rem; color: var(--muted); background: var(--card); padding: 14px 16px; border-radius: var(--radius-s); box-shadow: var(--shadow); }
.hint strong { color: var(--ink); }

/* Monatsleiste */
.monthbar {
  display: flex; align-items: center; gap: 8px; margin: 0 -16px 14px; padding: 10px 16px;
  position: sticky; top: 0; z-index: 5;
  background: rgba(245,245,247,.8);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.monthbar h2 { margin: 0; min-width: 190px; text-align: center; font-size: 1.45rem; }
.monthbar > a.btn:not(.small) { width: 36px; height: 36px; padding: 0; font-size: 1.3rem; line-height: 1; background: var(--card); box-shadow: var(--shadow); color: var(--accent-text); }
.spacer { flex: 1; }

/* Plan */
.plan { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 96px 1fr 1fr 1.5fr 220px; gap: 12px; align-items: center;
  padding: 11px 20px; position: relative;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 20px; right: 0; height: 1px; background: var(--line); }
.row.head { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding-top: 14px; padding-bottom: 10px; }
.row .date { font-variant-numeric: tabular-nums; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.row .wd { display: inline-block; width: 28px; color: var(--faint); font-weight: 600; font-size: .9rem; }
.row.weekend .wd { color: var(--accent-text); }
.row .slot { font-weight: 500; }
.row .slot.span { grid-column: 2 / 5; font-weight: 400; color: var(--faint); }
.row .lbl { display: none; }
.row .open { color: var(--orange); font-weight: 600; font-size: .8rem; background: var(--orange-soft); padding: 2px 10px; border-radius: 980px; }
.row.closed { background: #fafafa; }
.row.mine { background: var(--mine); }
.row.mine .date::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
/* Heute wie im Kalender: rote Markierung */
.row.today .wd { color: var(--red); }
.row.today .date { color: var(--red); }
.row.past { color: var(--faint); }
.row.past .slot { color: var(--faint); }
/* Feiertage & Fasnet */
.sday { display: inline-flex; align-items: center; padding: 2px 10px; margin: 2px 6px 2px 0; border-radius: 980px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.sday-feiertag { background: rgba(255,59,48,.1); color: #d70015; }
.sday-fasnet { background: rgba(175,82,222,.12); color: #8944ab; }
.row.feiertag .date { color: #d70015; }
.row.feiertag .wd { color: #d70015; }
.row.fasnet { box-shadow: inset 3px 0 0 #bf5af2; }
.row.feiertag { box-shadow: inset 3px 0 0 #ff3b30; }
.note { color: var(--red); font-weight: 600; font-size: .84rem; }
.actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* Bearbeiten – Sheet in der Mitte */
details.edit { position: relative; }
details.edit > summary { list-style: none; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] > summary::before {
  content: ""; position: fixed; inset: 0; z-index: 40; cursor: default;
  background: rgba(0,0,0,.28);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.editform {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 50;
  width: min(400px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow: auto;
  display: grid; gap: 14px; padding: 22px; background: #fff; border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22), 0 0 0 .5px rgba(0,0,0,.06);
  animation: sheet .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheet { from { opacity: 0; transform: translate(-50%, -47%) scale(.97); } }
.editform > strong { font-size: 1.15rem; letter-spacing: -.02em; }
.editform label { font-size: .82rem; color: var(--muted); }
.editform input[name$="_txt"] { margin-top: 6px; font-size: .88rem; }
.editform .formbtns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* Verwaltung */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
thead th { border-top: 0; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
tbody th { font-weight: 600; }
tr.inactive td { color: var(--faint); }
td.btns { white-space: nowrap; }
td.btns form { margin-right: 4px; }
.rename { display: flex !important; gap: 6px; align-items: center; }
.rename input { width: 150px; padding: 7px 10px; }
table.defaults td { min-width: 230px; }
table.defaults td select, table.defaults td input { margin: 3px 0; }
table.defaults tr.closed { background: #fafafa; }
.row-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row-form label { flex: 1 1 180px; }
label.check { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; padding-bottom: 10px; }
label.check input { width: auto; accent-color: var(--accent); }
.printonly { display: none; }
.greetings { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card > form > .btn.primary, .card > form > .tablewrap + .btn { margin-top: 10px; }

/* Handy */
@media (max-width: 760px) {
  main { padding-top: 20px; }
  h1 { font-size: 1.6rem; }
  .row.head { display: none; }
  .row { grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px 16px; }
  .row + .row::before { left: 16px; }
  .row .date { grid-column: 1 / 3; font-size: 1.02rem; }
  .row .lbl { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 500; margin-bottom: 1px; }
  .row .slot.span { grid-column: 1 / 3; }
  .row .wishes { grid-column: 1 / 3; }
  .row .wishes:empty { display: none; }
  .row .actions { grid-column: 1 / 3; justify-content: flex-start; margin-top: 4px; }
  .monthbar { gap: 6px; }
  .monthbar h2 { min-width: 0; font-size: 1.1rem; white-space: nowrap; }
  .monthbar > a.btn:not(.small) { width: 32px; height: 32px; flex: 0 0 32px; }
  .monthbar button.btn { display: none; } /* Drucken nur am PC */
  .app { display: none; }
  .top nav { width: 100%; }
  .top nav a { flex: 1; text-align: center; padding: 6px 4px; }
  .card { padding: 18px; }
}

/* Drucken */
@media print {
  body { background: #fff; font-size: 11pt; }
  .top nav, .noprint, .hello, .monthbar .btn, .flash { display: none !important; }
  .top { background: #fff; border-bottom: 1px solid #000; padding: 6px 0; }
  .monthbar { position: static; background: none; margin: 8px 0; padding: 0; }
  .plan { box-shadow: none; border-radius: 0; }
  .row { grid-template-columns: 80px 1fr 1fr 1.5fr; padding: 4px 6px; break-inside: avoid; }
  .row.past, .row.past .slot { color: #000; }
  .row.mine { background: none; }
  .row.mine .date::after { display: none; }
  .printonly { display: block; }
}
