:root {
  --red: #dc052d;
  --red-dark: #b0041f;
  --blue: #0066b2;
  --blue-dark: #00457a;
  --bg: #f3f3f6;
  --card: #ffffff;
  --ink: #1b1b1f;
  --muted: #6b6b76;
  --line: #e3e3e8;
  --green: #1f8a4c;
  --amber: #c77700;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* top bar */
.topbar {
  background: linear-gradient(90deg, var(--red) 0 72%, var(--blue) 72% 100%);
  color: #fff; padding: 0 16px; height: 56px;
  display: flex; align-items: center; gap: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.18);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; letter-spacing: .02em; font-size: 17px; white-space: nowrap; }
.brand small { display: block; font-weight: 500; font-size: 11px; opacity: .9; letter-spacing: .08em; text-transform: uppercase; }
nav.tabs { display: flex; gap: 4px; margin-left: 6px; }
nav.tabs button {
  background: transparent; border: 0; color: #fff; opacity: .78; padding: 8px 12px; border-radius: 8px; font-weight: 600;
}
nav.tabs button.active { opacity: 1; background: rgba(255,255,255,.18); }
.spacer { flex: 1; }
.who { font-size: 13px; opacity: .95; white-space: nowrap; }
.topbar .ghost { background: rgba(255,255,255,.16); border: 0; color: #fff; padding: 6px 10px; border-radius: 8px; }

main { max-width: 1080px; margin: 0 auto; padding: 18px 14px 60px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .side { order: 2; } }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar select, .toolbar input[type=text] {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 10px;
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 12px; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--ink); color: #fff; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; user-select: none; }

/* month headings */
h2.month { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 22px 0 8px; font-weight: 700; }
h2.month:first-child { margin-top: 0; }

/* match rows */
.match {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 0 14px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; border-left: 5px solid transparent; transition: transform .12s ease, box-shadow .12s ease;
}
.match:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 8px 22px rgba(0,0,0,.08); }
.match.home { border-left-color: var(--red); }
.match.away { border-left-color: #c9c9d1; background: #fafafc; box-shadow: none; padding: 9px 14px; }
.match.past { opacity: .62; }
.match.past:hover { opacity: 1; }
.when { text-align: center; line-height: 1.15; align-self: start; padding-top: 2px; }
.when .dow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.when .day { font-size: 22px; font-weight: 800; }
.match.away .when .day { font-size: 18px; font-weight: 700; }
.when .time { font-size: 12px; color: var(--muted); }
.when .time.tent { color: var(--amber); font-weight: 600; }
.teams { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
.teams .opp { font-size: 17px; font-weight: 700; }
.match.away .teams .opp { font-size: 15px; font-weight: 600; color: #3c3c46; }
.teams .res { font-weight: 700; color: var(--muted); font-size: 14px; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px; border-radius: 999px;
  background: #ececf1; color: #4b4b57; white-space: nowrap;
}
.badge.cl { background: #e6effa; color: var(--blue-dark); }
.badge.pokal { background: #eef5ea; color: #2f6b31; }
.badge.bl { background: #fdeaee; color: var(--red-dark); }
.badge.tent { background: #fff3df; color: var(--amber); }
.sub { color: var(--muted); font-size: 13px; margin-top: 1px; }

.slots { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.slot { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.slot .owner { color: var(--muted); }
.slot .dot { width: 9px; height: 9px; border-radius: 50%; background: #d5d5dc; border: 1px solid #bcbcc6; flex: none; }
.slot.assigned .dot { background: var(--blue); border-color: var(--blue); }
.slot.sent .dot { background: var(--green); border-color: var(--green); }
.slot .name { font-weight: 600; }
.slot.free .name { color: var(--muted); font-weight: 500; }
.slot .ok { color: var(--green); font-size: 12px; }
.reqs { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 13px; }
.reqs .lbl { color: var(--amber); font-weight: 700; }
.chip { background: #fff5e6; border: 1px solid #f3dcb3; color: #7a4b00; border-radius: 999px; padding: 1px 9px; font-size: 12.5px; }
.chip.note { background: #f0f0f4; border-color: #dedee6; color: #4b4b57; }

/* side panel */
.side .panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; }
.side h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ev { font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev .t { color: var(--muted); font-size: 11.5px; }
.ev b { font-weight: 600; }
.next { cursor: pointer; }
.next .big { font-size: 18px; font-weight: 800; }
.next .sub { margin-top: 2px; }

/* month grid */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { margin: 0; font-size: 18px; }
.cal-head button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 12px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.grid .dow { text-align: center; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; padding: 4px 0; }
.cell { background: var(--card); min-height: 78px; border-radius: 8px; padding: 4px 5px; font-size: 12px; box-shadow: var(--shadow); }
.cell.off { background: transparent; box-shadow: none; }
.cell.today .n { background: var(--ink); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: inline-grid; place-items: center; }
.cell .n { color: var(--muted); font-weight: 600; }
.pill {
  display: block; margin-top: 3px; padding: 3px 6px; border-radius: 6px; font-size: 11.5px; line-height: 1.25; cursor: pointer;
  background: #ececf1; color: #3c3c46; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill.home { background: var(--red); color: #fff; font-weight: 700; }
.pill.tent { border: 1.5px dashed currentColor; background: transparent; color: var(--red); }
.pill.tent.away { color: #6b6b76; }
.pill .st { float: right; margin-left: 4px; }
@media (max-width: 600px) { .cell { min-height: 60px; } .pill { font-size: 10px; padding: 2px 4px; } }

/* dialog */
dialog {
  border: 0; border-radius: 16px; padding: 0; max-width: 620px; width: calc(100% - 24px);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink);
}
dialog::backdrop { background: rgba(20,20,30,.55); backdrop-filter: blur(2px); }
.dlg-head { background: linear-gradient(90deg, var(--red), var(--red-dark)); color: #fff; padding: 16px 20px; border-radius: 16px 16px 0 0; }
.dlg-head.away { background: linear-gradient(90deg, #4b4b57, #2f2f38); }
.dlg-head .close {
  position: absolute; right: 10px; top: 10px; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; margin: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.18); color: #fff; font-size: 22px; line-height: 1;
  -webkit-appearance: none; appearance: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.dlg-head .close:hover, .dlg-head .close:focus-visible { background: rgba(255,255,255,.32); outline: none; }
.dlg-head .close:active { background: rgba(255,255,255,.45); }
.dlg-head .kicker, .dlg-head h2, .dlg-head .meta { padding-right: 40px; }
.dlg-head .kicker { font-size: 12px; opacity: .9; text-transform: uppercase; letter-spacing: .08em; }
.dlg-head h2 { margin: 2px 0 4px; font-size: 22px; }
.dlg-head .meta { font-size: 13.5px; opacity: .95; }
.dlg-head a { color: #fff; }
.dlg-body { padding: 16px 20px 20px; max-height: 72vh; overflow: auto; }
.sec { margin-bottom: 20px; }
.sec h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.card-row {
  display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 8px 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fafafc;
}
.card-row.sent { border-color: #bfe3cc; background: #f2faf5; }
.card-row.assigned { border-color: #bcd6ee; background: #f3f8fd; }
.card-row .owner { font-weight: 700; }
.card-row .owner small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.card-row .ctl { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.card-row select { flex: 1 1 150px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; }
.card-row .mail { grid-column: 2; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.card-row .mail code { font: 13px ui-monospace, Menlo, Consolas, monospace; color: var(--ink); background: #fff; border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; }
.card-row label.sentchk { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.card-row label.sentchk input { width: 18px; height: 18px; accent-color: var(--green); }
.newperson { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.newperson input { flex: 1 1 120px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 11px; font-weight: 600; font-size: 13.5px; }
.btn:hover { background: #f3f3f6; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.small { padding: 3px 8px; font-size: 12.5px; }
.btn.danger { color: var(--red-dark); }
.btn:disabled { opacity: .5; cursor: default; }

.reqlist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.reqitem { display: inline-flex; align-items: center; gap: 6px; background: #fff5e6; border: 1px solid #f3dcb3; border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 13.5px; }
.reqitem .x { background: transparent; border: 0; color: #a06a00; font-size: 15px; line-height: 1; padding: 0 4px; }
.reqitem .cnt { color: #a06a00; font-size: 12px; }
.addreq { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.addreq input { flex: 1 1 130px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.addreq .seg button { padding: 5px 10px; }
.empty { color: var(--muted); font-size: 13.5px; }

.note { border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px; white-space: pre-wrap; }
.note:first-of-type { border-top: 0; }
.note .t { color: var(--muted); font-size: 11.5px; margin-top: 2px; display: flex; gap: 8px; }
.note .t button { background: transparent; border: 0; color: var(--muted); padding: 0; font-size: 11.5px; text-decoration: underline; }
.addnote { display: flex; gap: 6px; margin-top: 6px; }
.addnote textarea { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 38px; resize: vertical; }

/* people */
table.people { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.people th, table.people td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.people th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
table.people tr:last-child td { border-bottom: 0; }
table.people input { width: 100%; border: 1px solid transparent; background: transparent; padding: 5px 6px; border-radius: 6px; }
table.people input:hover, table.people input:focus { border-color: var(--line); background: #fff; outline: none; }
table.people td.num { text-align: right; color: var(--muted); width: 70px; }
table.people td.act { white-space: nowrap; width: 130px; text-align: right; }
.addperson { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.addperson input { flex: 1 1 160px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
@media (max-width: 600px) { table.people th:nth-child(3), table.people td.num { display: none; } }

/* settings */
.settings { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.panel p.help { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status { font-size: 13px; color: var(--muted); }
.status.err { color: var(--red-dark); }
.status.ok { color: var(--green); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; pointer-events: none;
  transition: all .2s ease; z-index: 100; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red-dark); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at top, #fff 0%, var(--bg) 60%); }
.login { width: 100%; max-width: 360px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.login .head { background: linear-gradient(90deg, var(--red) 0 72%, var(--blue) 72% 100%); color: #fff; padding: 22px 22px 18px; }
.login .head h1 { margin: 0; font-size: 22px; }
.login .head p { margin: 4px 0 0; font-size: 13px; opacity: .92; }
.login form { padding: 20px 22px 22px; }
.login .btn.primary { width: 100%; padding: 10px; font-size: 15px; margin-top: 4px; }

/* password show/hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 40px !important; }
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 6px; display: grid; place-items: center;
}
.pw-eye:hover { color: var(--ink); background: #f0f0f4; }
