:root {
  --ink: #43524c;
  --forest: #263c35;
  --forest-2: #324b42;
  --paper: #f4f2ec;
  --white: #fffef9;
  --gold: #b3914e;
  --line: #d6d8d2;
  --soft: #e8e9e4;
  --danger: #9d3f42;
  --person-w: 184px;
  --slot-w: clamp(41px, calc((100vw - var(--person-w) - 24px) / 28), 64px);
  --row-h: clamp(70px, 7.35vh, 90px);
  font-family: "DM Sans", "Avenir Next", Avenir, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }

h1, h2, .day-name, .person-name, .event-title, .button, .eyebrow {
  font-family: Rockwell, "Roboto Slab", "Courier New", serif;
}

.login-view {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(112deg, rgba(28,48,41,.93), rgba(28,48,41,.72)),
    radial-gradient(circle at 78% 22%, #9a875a 0 2%, transparent 20%), #263c35;
  position: relative; overflow: hidden;
}
.login-view::after { content: ""; position: absolute; inset: auto -8% -22% 36%; height: 58%; background: rgba(255,255,255,.05); transform: rotate(-7deg); border-radius: 50%; }
.login-card { width: min(560px, 100%); background: var(--white); padding: clamp(28px, 6vw, 56px); position: relative; z-index: 1; box-shadow: 0 24px 70px rgba(0,0,0,.22); border-top: 5px solid var(--gold); }
.brand img { width: 152px; height: auto; display: block; }
.brand-dark { filter: none; margin-bottom: 46px; }
.brand-dark img { filter: none; }
.login-card h1 { margin: 5px 0 12px; color: var(--forest); font-size: clamp(38px, 7vw, 64px); line-height: .95; text-transform: uppercase; }
.login-card > .eyebrow { margin-bottom: 18px; }
.login-copy { margin: 0 0 30px; font-size: 17px; }
.eyebrow { margin: 0; color: var(--gold); text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: .11em; }
label { display: grid; gap: 7px; font-weight: 700; font-size: 14px; }
input, select, textarea { width: 100%; min-height: 48px; border: 1px solid #bdc3bd; background: white; padding: 11px 13px; border-radius: 2px; color: var(--forest); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(179,145,78,.16); }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 7px; }
.button { min-height: 46px; border: 0; padding: 10px 18px; text-transform: uppercase; font-weight: 800; font-size: 13px; letter-spacing: .03em; cursor: pointer; }
.button-primary { color: white; background: var(--forest); }
.button-primary:hover { background: var(--forest-2); }
.button-quiet { color: var(--forest); background: #e8e9e4; }
.button-danger { color: var(--danger); background: #f4e6e4; }
.form-error { min-height: 20px; color: var(--danger); margin: 8px 0 0; }
.demo-hint { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: #6e7773; font-size: 13px; }

.app { min-height: 100vh; background: var(--paper); }
.topbar { min-height: 92px; background: var(--forest); color: white; display: grid; grid-template-columns: var(--person-w) 1fr auto; grid-template-rows: auto auto; align-items: center; padding: 14px 18px; gap: 10px 20px; }
.topbar > .brand { grid-column: 1; grid-row: 1 / span 2; }.topbar > .week-title { grid-column: 2; grid-row: 1; }.topbar > .top-actions,.topbar > .display-clock { grid-column: 3; grid-row: 1; }
.topbar .brand img { filter: brightness(0) invert(1); width: 146px; }
.week-title h1 { margin: 3px 0 0; font-size: clamp(20px, 2.2vw, 32px); color: white; text-transform: uppercase; letter-spacing: .015em; }
.top-actions { display: flex; align-items: center; gap: 7px; }
.icon-button, .avatar-button { width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.28); background: transparent; color: white; font-size: 21px; cursor: pointer; }
.avatar-button { border-radius: 50%; background: var(--gold); border: 0; color: var(--forest); font-family: Rockwell, serif; font-size: 13px; font-weight: 800; }
.display-clock { justify-self: end; display: grid; text-align: right; }
.display-clock strong { color: var(--gold); font: 800 32px/1 Rockwell, serif; }
.display-clock span { font-size: 13px; margin-top: 6px; }
.team-message-editor { grid-column: 2 / 4; grid-row: 2; display: grid; grid-template-columns: auto minmax(220px,1fr); align-items: center; gap: 12px; color: #f2a15f; font: 800 11px Rockwell,serif; text-transform: uppercase; letter-spacing: .05em; }
.team-message-editor input { min-height: 38px; height: 38px; color: white; background: rgba(255,255,255,.05); border: 1px solid rgba(242,161,95,.7); }
.team-message-editor input::placeholder { color: rgba(255,255,255,.48); text-transform: none; }
.team-message-display { grid-column: 2 / 4; grid-row: 2; min-height: 40px; display: flex; align-items: center; padding: 8px 14px; color: white; background: #cf7039; border-left: 5px solid #f4bd73; font: 800 clamp(13px,1.15vw,20px)/1.15 Rockwell,serif; text-transform: uppercase; letter-spacing: .01em; }
.statusbar { min-height: 38px; padding: 6px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #f8f7f2; font-size: 12px; }
.status-left, .legend, .legend span { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 7px; height: 7px; background: #4e8e6c; border-radius: 50%; box-shadow: 0 0 0 3px rgba(78,142,108,.12); }
.legend { gap: 15px; }
.legend i { width: 9px; height: 9px; display: inline-block; border-radius: 2px; }
.legend-site { background: var(--forest-2); } .legend-internal { background: var(--gold); } .legend-absence { background: repeating-linear-gradient(135deg,#89918e 0 2px,#d6d8d2 2px 4px); }
.swipe-hint { color: #69736e; }

.desktop-board { overflow: auto; width: 100%; overscroll-behavior: contain; scrollbar-color: var(--gold) transparent; }
.board-grid { display: grid; grid-template-columns: var(--person-w) repeat(28, var(--slot-w)); width: max-content; min-width: 100%; position: relative; background: var(--white); }
.corner { grid-column: 1; grid-row: 1 / span 2; position: sticky; left: 0; z-index: 9; background: var(--forest-2); color: white; display: grid; align-content: center; padding: 12px 18px; border-right: 1px solid rgba(255,255,255,.18); }
.corner strong { font: 800 14px Rockwell, serif; text-transform: uppercase; }.corner span { font-size: 11px; opacity: .72; margin-top: 3px; }
.day-header { grid-row: 1; min-height: 54px; background: var(--forest-2); color: white; display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-right: 1px solid rgba(255,255,255,.16); }
.day-header.today { background: #466358; box-shadow: inset 0 4px var(--gold); }
.day-name { font-size: 13px; text-transform: uppercase; font-weight: 800; }
.day-date { color: #d3c49f; font-size: 12px; font-weight: 700; }
.time-header { grid-row: 2; height: 29px; background: #dde1dc; display: grid; place-items: center; font-size: 10px; font-weight: 800; border-right: 1px solid #c7ccc7; border-bottom: 1px solid #bbc2bc; }
.time-header.break-start { box-shadow: inset 2px 0 #b8a777; }
.person-cell { position: sticky; left: 0; z-index: 6; height: var(--row-h); background: #f5f3ed; border-right: 1px solid #c7cbc6; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 11px; padding: 8px 12px; overflow: hidden; }
.person-cell.inactive { background: #edede9; color: #86908b; }
.person-photo { flex: 0 0 auto; width: 46px; height: 46px; object-fit: cover; border-radius: 50%; border: 3px solid var(--person-color); background: #dfe2de; }
.person-placeholder { display: grid; place-items: center; font: 800 17px Rockwell,serif; color: var(--person-color); }
.person-meta { min-width: 0; display: grid; }.person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--forest); font-size: 13px; font-weight: 800; }.person-role { font-size: 10px; opacity: .72; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot { height: var(--row-h); border-right: 1px solid #e0e2dd; border-bottom: 1px solid var(--line); background: var(--white); position: relative; }
.slot.day-end { border-right: 2px solid #b9c0ba; }.slot.break-start { box-shadow: inset 2px 0 #eee6d3; }
.slot.drop-target { background: #efe6d3; box-shadow: inset 0 0 0 2px var(--gold); }
.slot-button { position: absolute; inset: 0; border: 0; background: transparent; opacity: 0; cursor: crosshair; }.slot:hover .slot-button,.slot-button:focus-visible { opacity: 1; }.slot-button::after { content: "+"; display: grid; place-items: center; margin: auto; width: 24px; height: 24px; border-radius: 50%; color: var(--gold); background: white; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.assignment { z-index: 4; align-self: center; height: calc(var(--row-h) - 13px); margin: 6px 3px; min-width: 0; color: var(--forest); background: color-mix(in srgb, var(--person-color) 18%, white); border-left: 5px solid var(--person-color); box-shadow: 0 2px 7px rgba(43,55,50,.12); padding: 8px 32px 7px 8px; position: relative; overflow: hidden; cursor: grab; touch-action: none; user-select: none; }
.assignment.kind-internal { background: #efe6d1; border-left-color: var(--gold); }.assignment.kind-absence { background: repeating-linear-gradient(135deg,#f0f0ec 0 7px,#e4e5e1 7px 14px); border-left-color: #87908c; }
.assignment:active { cursor: grabbing; }.assignment.dragging { opacity: .35; pointer-events: none; }
.assignment.resizing { cursor: ew-resize; box-shadow: inset 0 0 0 2px var(--gold), 0 2px 7px rgba(43,55,50,.12); }
.event-title { font-size: clamp(10px, .8vw, 13px); line-height: 1.1; font-weight: 800; text-transform: uppercase; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.event-note { font-size: 10px; line-height: 1.2; margin-top: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.resize-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 28px; display: grid; place-items: center; background: linear-gradient(90deg,transparent,rgba(255,255,255,.78)); border-left: 1px solid rgba(38,60,53,.12); cursor: ew-resize; touch-action: none; z-index: 5; }
.resize-handle::after { content: ""; width: 5px; height: 25px; border-left: 2px solid rgba(38,60,53,.58); border-right: 2px solid rgba(38,60,53,.58); }
.resize-handle:hover { background: rgba(179,145,78,.28); }
.drag-ghost { position: fixed !important; z-index: 999; pointer-events: none; width: 190px !important; height: 62px !important; transform: rotate(1deg); box-shadow: 0 16px 34px rgba(0,0,0,.28); opacity: .94; }
.drag-pill { position: fixed; z-index: 1000; pointer-events: none; background: var(--forest); color: white; padding: 7px 10px; font-size: 11px; transform: translate(12px,-38px); }.drag-pill.resize-pill { background: var(--gold); color: var(--forest); font-weight: 800; }
.inactive-row .slot { background: #f0f0ec; }.inactive-row .slot::after { content: "frei"; position: absolute; inset: 0; display: grid; place-items: center; color: #a9afab; font-size: 10px; }

.mobile-days, .mobile-board { display: none; }
.board-footer { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 8px 18px; border-top: 1px solid var(--line); font-size: 11px; color: #747e79; background: #f8f7f2; }
.text-button { border: 0; background: transparent; color: var(--forest); font-weight: 800; text-decoration: underline; cursor: pointer; }

.dialog { width: min(680px, calc(100% - 24px)); max-height: min(88vh, 820px); border: 0; padding: 0; color: var(--ink); box-shadow: 0 24px 80px rgba(22,35,30,.3); overflow: auto; }
.dialog::backdrop { background: rgba(29,44,38,.65); backdrop-filter: blur(2px); }
.dialog form { padding: clamp(20px,4vw,34px); display: grid; gap: 18px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 15px; }
.dialog-header h2 { margin: 3px 0 0; color: var(--forest); text-transform: uppercase; font-size: 25px; }.close-button { border: 0; background: #ecece7; width: 40px; height: 40px; font-size: 25px; color: var(--forest); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.suggestion-wrap { display: grid; gap: 7px; }.suggestion-wrap > span { font-size: 11px; color: #75807b; font-weight: 700; }.suggestions { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; }.suggestion-chip { flex: 0 0 auto; min-height: 34px; border: 1px solid #ccd0cc; background: #f5f4ef; color: var(--forest); padding: 5px 10px; font-size: 12px; cursor: pointer; }
.duration-fieldset { border: 1px solid var(--line); margin: 0; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 20px; }.duration-fieldset legend { font-weight: 800; font-size: 13px; }.duration-control { display: flex; align-items: center; gap: 12px; }.duration-control button { width: 40px; height: 40px; border: 0; background: var(--forest); color: white; font-size: 20px; }.duration-control output { min-width: 74px; text-align: center; font-weight: 800; }.duration-fieldset p { margin: 0; color: #747e79; font-size: 12px; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; margin-top: 2px; }.dialog-intro { margin: -4px 0 0; }.team-dialog { width: min(820px,calc(100% - 24px)); }.team-dialog-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.team-dialog-tools .dialog-intro { margin: 0; }.team-message-dialog-field textarea { border-color: #d88a51; background: #fff9f4; }.team-list { display: grid; gap: 8px; }.team-item { display: grid; grid-template-columns: 66px minmax(0,1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); padding: 10px; }.team-photo-button { width: 62px; border: 0; background: transparent; padding: 0; cursor: pointer; display: grid; gap: 3px; justify-items: center; color: var(--forest); font-size: 9px; }.team-photo-button img,.team-photo-button .team-initial { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; background: #e5e6e2; }.team-fields { display: grid; grid-template-columns: minmax(140px,1fr) minmax(130px,.8fr) 56px; gap: 8px; }.team-fields input { min-height: 40px; }.team-color { padding: 4px; }.team-actions { display: flex; gap: 6px; align-items: center; }.team-toggle,.team-remove { min-width: 92px; }.team-remove { color: var(--danger); }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: 24px; transform: translate(-50%,20px); background: var(--forest); color: white; padding: 11px 16px; opacity: 0; pointer-events: none; transition: .2s; box-shadow: 0 7px 22px rgba(0,0,0,.2); }.toast.show { opacity: 1; transform: translate(-50%,0); }

body.display-mode { overflow: hidden; }.display-mode .editor-only { display: none !important; }.display-mode .topbar { min-height: 86px; }.display-mode .statusbar { min-height: 32px; }.display-mode .desktop-board { overflow: hidden; }.display-mode .assignment { box-shadow: none; cursor: default; }.display-mode .resize-handle,.display-mode .slot-button { display: none; }.display-mode .board-footer { min-height: 36px; }

@media (min-width: 761px) {
  .display-mode .assignment { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 4px 6px 4px 7px; }
  .display-mode .event-title,.display-mode .event-note { flex: 0 0 auto; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; word-break: normal; }
  .display-mode .event-title { font-size: 12px; line-height: 1.05; letter-spacing: -.018em; }
  .display-mode .event-note { font-size: 9px; line-height: 1.08; margin-top: 0; }
  .display-mode .assignment.marquee-card { justify-content: flex-start; overflow: hidden; -webkit-mask-image: linear-gradient(180deg,transparent,#000 8%,#000 92%,transparent); mask-image: linear-gradient(180deg,transparent,#000 8%,#000 92%,transparent); }
  .display-mode .marquee-track { display: flex; flex-direction: column; align-items: stretch; width: 100%; gap: 8px; animation: assignment-marquee var(--marquee-duration,8s) linear infinite; }
  .display-mode .marquee-content { flex: 0 0 auto; width: 100%; display: flex; flex-direction: column; justify-content: center; gap: 2px; white-space: normal; overflow-wrap: anywhere; }
}

@keyframes assignment-marquee { 0%,10% { transform: translateY(0); } 90%,100% { transform: translateY(calc(-50% - 4px)); } }

@media (max-width: 760px) {
  :root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
  body { background: #f5f4ef; }
  .topbar { min-height: 76px; grid-template-columns: auto 1fr auto; padding: 10px 12px; gap: 10px; position: sticky; top: 0; z-index: 20; }
  .topbar > .brand { grid-row: 1; }.team-message-editor { display: none; }.team-message-display { grid-column: 1 / -1; grid-row: 2; font-size: 12px; min-height: 36px; }
  .topbar .brand img { width: 86px; }.week-title h1 { font-size: 15px; line-height: 1.1; }.week-title .eyebrow { font-size: 9px; }.top-actions .icon-button,.top-actions #today,.top-actions .avatar-button { display: none; }.top-actions .button { min-height: 43px; padding: 9px 12px; font-size: 11px; }
  .statusbar { position: sticky; top: 76px; z-index: 19; min-height: 34px; padding: 6px 12px; }.legend { display: none; }.swipe-hint { font-size: 10px; }
  .desktop-board { display: none; }
  .mobile-days { display: none; }
  .day-chip { scroll-snap-align: start; flex: 0 0 64px; border: 1px solid var(--line); background: var(--white); padding: 7px 4px; color: var(--ink); display: grid; gap: 3px; text-align: center; }.day-chip strong { font: 800 10px Rockwell,serif; text-transform: uppercase; }.day-chip span { font-size: 16px; }.day-chip.active { background: var(--forest); color: white; border-color: var(--forest); }.day-chip.today { box-shadow: inset 0 -3px var(--gold); }
  .mobile-board { display: grid; padding: 10px 10px calc(70px + var(--safe-bottom)); gap: 10px; }
  .mobile-person { background: var(--white); border: 1px solid var(--line); }.mobile-person.inactive { opacity: .7; }.mobile-person.inactive .mobile-week { display: none; }
  .mobile-person-head { position: sticky; top: 110px; z-index: 8; min-height: 61px; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: #f8f7f2; box-shadow: 0 2px 5px rgba(38,60,53,.08); }.mobile-person-head .person-photo { width: 42px; height: 42px; }.mobile-person-head .person-name { font-size: 14px; }.mobile-person-head .person-role { font-size: 11px; }
  .mobile-week { display: grid; }.mobile-day-row { min-height: 72px; display: grid; grid-template-columns: 42px minmax(0,1fr); border-bottom: 1px solid var(--line); }.mobile-day-row:last-child { border-bottom: 0; }
  .mobile-day-label { display: grid; place-content: center; gap: 2px; text-align: center; color: #707a75; background: #eeeee9; border-right: 1px solid var(--line); }.mobile-day-label strong { font: 800 11px Rockwell,serif; text-transform: uppercase; }.mobile-day-label span { font-size: 13px; }.mobile-day-label.today { color: white; background: var(--forest); box-shadow: inset 0 -3px var(--gold); }
  .mobile-day-slots { min-height: 72px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); position: relative; }.mobile-slot { grid-row: 1; min-height: 72px; border-right: 1px solid var(--line); position: relative; }.mobile-slot:last-child { border: 0; }.mobile-slot::before { content: attr(data-label); position: absolute; top: 4px; left: 5px; color: #909793; font-size: 8px; }.mobile-slot .slot-button { opacity: 1; top: 19px; }.mobile-slot .slot-button::after { width: 25px; height: 25px; font-size: 14px; color: #8d9892; box-shadow: none; background: #f1f1ed; }
  .mobile-assignment { grid-row: 1; align-self: stretch; z-index: 3; min-width: 0; margin: 20px 3px 4px; height: 47px; padding: 5px 16px 4px 7px; }.mobile-assignment .event-title { font-size: 9px; }.mobile-assignment .event-note { font-size: 8px; margin-top: 3px; }
  .board-footer { display: none; }
  .dialog { margin-top: auto; margin-bottom: 0; width: 100%; max-width: none; max-height: 92vh; }.dialog form { padding: 20px 16px calc(20px + var(--safe-bottom)); gap: 14px; }.form-grid { grid-template-columns: 1fr 1fr; }.dialog-actions { position: sticky; bottom: 0; background: white; padding-top: 8px; grid-template-columns: auto 1fr auto; }.dialog-actions .button-quiet { display: none; }.dialog-actions .button-primary { grid-column: 3; }.dialog-actions .button-danger { grid-column: 1; }.duration-fieldset { grid-template-columns: 1fr; }.password-row { grid-template-columns: 1fr; }
  .team-dialog-tools { align-items: stretch; flex-direction: column; }.team-dialog-tools .button { display: block; }.team-item { grid-template-columns: 62px minmax(0,1fr); }.team-fields { grid-template-columns: 1fr 1fr 48px; }.team-actions { grid-column: 2; justify-content: flex-end; }.team-actions .button { display: block; }
  .login-card { padding: 30px 22px; }.brand-dark { margin-bottom: 34px; }
}

@media (max-width: 390px) { .week-title { display: none; }.topbar { grid-template-columns: 1fr auto; }.form-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; }.marquee-track { animation: none !important; } }
