:root {
  --bg: #f4fef6; --card: #ffffff; --muted: #5b705e; --text: #033a1c;
  --accent: #009b5a; --accent2: #00c46c; --danger: #e63946;
}
* { box-sizing: border-box }
html, body { height: 100% }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial,"Apple Color Emoji","Segoe UI Emoji" }
a { color: inherit }

.wrap { max-width: 1100px; margin: 32px auto; padding: 0 16px }

header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px }
header h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: .2px; color: var(--accent) }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center }
.lang-toggle { display: flex; border: 1px solid #cce6cc; border-radius: 10px; overflow: hidden }
.lang-btn { appearance: none; border: 0; background: #f4fef6; color: var(--muted); padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s }
.lang-btn:hover { background: #e0f4e7 }
.lang-btn.active { background: var(--accent); color: #fff }

.bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0 22px }
.btn { appearance: none; border: 0; background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 12px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: .15s transform ease }
.btn:hover { transform: translateY(-1px); background: var(--accent2) }
.btn:active { transform: translateY(0) }
.btn[disabled] { opacity: .5; cursor: not-allowed }
.btn.secondary { background: #e9f6eb; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1) }
.btn.secondary:hover { background: #d4f0d9; transform: translateY(-1px) }

/* Hero section — playing card */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 240px; width: 100%; margin: 14px auto 24px; padding: 26px 22px 20px; background: #fff; border: 1px solid #cde3cd; border-radius: 22px; box-shadow: 0 8px 32px rgba(0,40,15,.09), 0 2px 6px rgba(0,0,0,.06); color: var(--text); position: relative; overflow: hidden; gap: 6px }
.hero-deco { font-size: 80px; line-height: 1; opacity: .06; position: absolute; right: 8px; bottom: 6px; user-select: none; pointer-events: none }
.hero .avatar { width: 80px; height: 80px; box-shadow: 0 0 0 3px #e4f2e6, 0 4px 16px rgba(0,0,0,.1); flex-shrink: 0; margin: 8px 0 4px }
.hero-body { width: 100%; z-index: 1 }
.hero-label { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 600; margin-bottom: 4px }
.hero-name { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.hero-meta { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap }
.hero-sep { opacity: .5 }
.hero-countdown { font-weight: 700; background: rgba(0,155,90,.1); border-radius: 99px; padding: 2px 10px; font-size: 11px; color: var(--accent) }
@media (max-width: 640px) {
  .hero { max-width: min(280px,88vw); padding: 22px 18px 18px }
  .hero-name { font-size: 26px; white-space: normal; word-break: break-word }
}

.avatar { position: relative; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px #cdeccd,0 4px 10px rgba(0,0,0,.15); flex-shrink: 0 }
.av-initials { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #033a1c; letter-spacing: -.5px; line-height: 1 }

.grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 14px; touch-action: pan-y }
@media (max-width: 960px) { .grid { grid-template-columns: repeat(2,1fr) } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr } }

.day-card { background: var(--card); border-radius: 16px; padding: 14px; min-height: 130px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.07); cursor: pointer; border: 1px solid #cce6cc; transition: .15s background, .15s border-color }
.day-card:hover { background: #e8f5ed; border-color: #a8d8b8 }
.day-card.current { border-color: #a8d8b8; background: rgba(0,196,108,.06); box-shadow: 0 4px 12px rgba(0,196,108,.1) }
.day-card.current:hover { background: rgba(0,196,108,.1); border-color: var(--accent2) }
.day-card.past { opacity: .8 }
.day-card.cancelled { opacity: .72; background: #f8f8f8; border-color: #e0e0e0 }
.day-card .top { display: flex; justify-content: space-between; align-items: center }
.day-card .d { font-weight: 700; color: var(--accent) }
.day-card .status { font-size: 12px; color: var(--muted) }
.day-card .status.to-assign { color: #c47a00; font-weight: 600 }
.cal-badge.to-assign { color: #c47a00; font-weight: 600 }
.assignee { display: flex; align-items: center; gap: 10px; margin-top: auto }
.assignee .name { font-weight: 600 }
.assignee .count { font-size: 12px; color: var(--muted) }
.assignee .unassigned { font-size: 12px; color: #966; background: #ffe; padding: 2px 6px; border-radius: 8px; border: 1px dashed #cc9 }

.cancel-icon-big { font-size: 28px; line-height: 1; flex-shrink: 0 }
.cancel-comment { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 2px }
.cal-comment { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100% }
.cancel-date-btn { appearance: none; border: 1px solid #e0e0e0; background: #f8f8f8; border-radius: 10px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); transition: .15s; flex-shrink: 0 }
.cancel-date-btn:hover { background: #fff3cd; color: #856404; border-color: #ffc107 }
.cancel-date-btn.is-cancelled { background: #fff3cd; color: #856404; border-color: #ffc107 }

.legend { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 13px }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block }
.dot.done { background: var(--accent) }
.dot.cancelled { background: #ffc107 }

.swipe-hint { display: none; text-align: center; color: var(--muted); font-size: 12px; margin: -12px 0 14px }
@media (max-width: 640px) { .swipe-hint { display: block } }

.footer { margin-top: 18px; color: var(--muted); font-size: 12px }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; padding: 20px }
.modal.open { display: flex }
.modal .sheet { width: min(860px,95vw); max-height: 90vh; overflow: auto; background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 30px 60px rgba(0,0,0,.2) }
.modal .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--accent) }
.modal h3 { margin: 0; font-size: 18px }
.table { width: 100%; border-collapse: collapse; color: var(--text) }
.table th, .table td { padding: 10px; border-bottom: 1px solid #d3e8d6; text-align: left }
.table tr.highlight { background: rgba(0,196,108,.1) }
.pill { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 12px }
.pill.low { background: rgba(0,196,108,.1); color: var(--accent) }
.pill.mid { background: rgba(0,196,108,.2); color: var(--accent) }
.pill.high { background: rgba(230,57,70,.15); color: var(--danger) }
.close-x { background: var(--accent); border: 0; color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; align-items: center; flex-wrap: wrap }

.kbd { font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace; background: #e9f6eb; color: var(--text); border-radius: 6px; padding: 2px 6px; font-size: 12px }

/* Self-tests */
details.testlog { margin-top: 18px; background: #e9f6eb; border-radius: 12px; padding: 10px 12px; box-shadow: 0 0 0 1px #d3e8d6 inset }
details.testlog summary { cursor: pointer; color: var(--muted) }
ul.tests { margin: 8px 0 0 18px; padding: 0 }
ul.tests li { margin: 4px 0 }

/* Assign picker */
.picker { display: grid; grid-template-columns: repeat(auto-fill,minmax(88px,1fr)); gap: 10px; margin-top: 10px }
.pick-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 2px solid #e0f0e5; border-radius: 14px; padding: 12px 6px 10px; background: #fff; cursor: pointer; transition: .15s; user-select: none }
.pick-tile:hover { border-color: var(--accent2); background: #f0faf4 }
.pick-tile.selected { border-color: var(--accent); background: rgba(0,155,90,.1) }
.pick-tile.selected::after { content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(230,57,70,.08); border-radius: 12px; color: var(--danger); font-size: 22px; font-weight: 700; pointer-events: none; opacity: 0; transition: opacity .15s }
.pick-tile.selected:hover::after { opacity: 1 }
.pick-name { font-weight: 600; font-size: 12px; text-align: center; line-height: 1.2; color: var(--text) }
.pick-count { font-size: 10px; color: var(--muted); text-align: center }

/* Password modal */
#passwordModal .sheet { max-width: 380px }
.pw-field { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 }
.pw-field label { font-weight: 600; color: var(--text) }
.pw-field input { border: 1px solid #cce6cc; border-radius: 10px; padding: 10px 12px; font-size: 16px; outline: none; width: 100% }
.pw-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,155,90,.15) }
.pw-error { color: var(--danger); font-size: 13px; min-height: 20px }

/* Team modal */
.team-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 8px }
.team-item { display: flex; align-items: center; gap: 10px; border: 1px solid #cce6cc; border-radius: 12px; padding: 10px 12px; background: #fff }
.team-item.inactive { opacity: .5 }
.item-name-wrap { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0 }
.item-name-input { border: 1px solid transparent; background: transparent; font-weight: 600; font-size: 14px; padding: 2px 6px; border-radius: 6px; outline: none; color: var(--text); width: 100%; font-family: inherit }
.item-name-input:hover { border-color: #cce6cc; background: #f8fbf8 }
.item-name-input:focus { border-color: var(--accent); background: #fff }
.item-id { color: var(--muted); font-size: 11px; padding-left: 7px }
.toggle-btn { appearance: none; border: 1px solid #cce6cc; background: #f4fef6; padding: 4px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; color: var(--muted); transition: .15s; white-space: nowrap }
.toggle-btn.active { background: var(--accent); color: #fff; border-color: var(--accent) }
.item-lastname { width: 80px; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; font-size: 12px; outline: none; color: var(--muted); background: transparent; font-family: inherit }
.item-lastname:hover { border-color: #cce6cc; background: #f8fbf8 }
.item-lastname:focus { border-color: var(--accent); background: #fff; color: var(--text) }
.add-member-form { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap }
.add-member-form input { flex: 1; min-width: 100px; border: 1px solid #cce6cc; border-radius: 10px; padding: 8px 12px; font-size: 14px; outline: none }
.add-member-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,155,90,.1) }

/* View toggle */
.view-toggle { display: flex; border: 1px solid #cce6cc; border-radius: 10px; overflow: hidden }
.view-btn { appearance: none; border: 0; background: #f4fef6; color: var(--muted); padding: 7px 12px; font-size: 13px; cursor: pointer; transition: .15s }
.view-btn:hover { background: #e0f4e7 }
.view-btn.active { background: var(--accent); color: #fff }

/* Nav arrows in bar */
.cal-month-label { font-weight: 700; color: var(--accent); font-size: 14px; text-transform: capitalize; white-space: nowrap; min-width: 90px; text-align: center }
.nav-arrow { width: 32px; height: 32px; padding: 0; font-size: 14px; font-weight: 700; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center }

/* Calendar view */
.cal-day-headers { display: grid; grid-template-columns: repeat(5,1fr) repeat(2,.28fr); gap: 2px; margin-bottom: 3px }
.cal-day-headers > div { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px; text-transform: capitalize }
.cal-grid { display: grid; grid-template-columns: repeat(5,1fr) repeat(2,.28fr); gap: 3px }
.cal-cell { border-radius: 8px; padding: 4px 5px; min-height: 36px; background: #fff; border: 1px solid #e4f0e6 }
.cal-cell.cal-thu { background: var(--card); border: 1px solid #cce6cc; min-height: 110px; padding: 6px 8px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: .15s background, .15s border-color; box-shadow: 0 4px 12px rgba(0,0,0,.07) }
.cal-cell.cal-thu:hover { background: #e8f5ed; border-color: #a8d8b8 }
.cal-cell.cal-thu.current { border: 1px solid #a8d8b8; background: rgba(0,196,108,.06); box-shadow: 0 4px 12px rgba(0,196,108,.1) }
.cal-cell.cal-other-month { opacity: .18 }
.cal-cell.cancelled { background: #f4f4f4; opacity: .72 }
.cal-cell.cal-weekend { padding: 3px; min-height: 26px; opacity: .28; background: transparent; border-color: transparent; box-shadow: none }
.cal-date { font-size: 12px; font-weight: 700; color: var(--accent) }
.cal-cell:not(.cal-thu) .cal-date { color: var(--muted); font-weight: 400; font-size: 11px }
.cal-cell.cal-weekend .cal-date { font-size: 10px }
.cal-badge { font-size: 10px; color: var(--muted) }
.cal-header-row { display: flex; justify-content: space-between; align-items: center; gap: 4px }
.cal-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2px 0 }
.cal-name-chip { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; color: var(--text) }
.cal-cancel-flag { font-size: 13px; line-height: 1 }
.cal-cancelled-info { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.4 }

/* Excuse link */
.excuse-link { margin-top: 6px; color: var(--muted); font-size: 13px; font-style: italic }
.excuse-link a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px }
.excuse-link a:hover { color: var(--accent2) }

@media (max-width: 640px) {
  .cal-cell.cal-thu { min-height: 68px; padding: 4px 5px }
}

@media print {
  .bar, .footer, .excuse-link, details.testlog, .modal, .header-actions { display: none !important }
}
