:root {
  --ink: #1f2430; --muted: #6b7280; --line: #e3e5ea; --bg: #f6f5f2; --card: #fff;
  --brand: #6b1d2a; --brand-2: #8f2b3c; --ok: #1d7a46; --warn: #b45309; --bad: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 1.5rem; margin: 6px 0 14px; }
h2 { font-size: 1.1rem; margin: 24px 0 10px; }
h2 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
a { color: var(--brand); }
.muted { color: var(--muted); } .small { font-size: .85rem; }

/* Header */
.top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 10px 18px; background: var(--brand); color: #fff; }
.brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 1.1rem; }
.brand span, .login h1 span { font-family: Georgia, serif; font-style: italic; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a { color: #f3dfe2; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
.who { display: flex; gap: 12px; align-items: center; }
.who a { color: #fff; text-decoration: none; }
.who small { background: rgba(255,255,255,.2); padding: 1px 6px; border-radius: 10px; font-size: .7rem; text-transform: uppercase; }
.who .link { color: #f3dfe2; }

/* Controls */
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #c9ccd3; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
form { margin: 0; }
label { display: block; margin-bottom: 12px; font-weight: 500; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #cfd3da; border-radius: 8px; background: #fff; }
label input, label select { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
input[type=checkbox] { width: 18px; height: 18px; }
input[type=color] { padding: 2px; width: 44px; height: 34px; }
.row { display: flex; gap: 12px; } .row label { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: #e7f5ec; color: var(--ok); border: 1px solid #bfe3cd; }
.flash.err { background: #fdecea; color: var(--bad); border-color: #f6c7c2; }

/* Login */
.login { max-width: 360px; margin: 8vh auto 0; text-align: center; }
.login form { text-align: left; } .login .btn { width: 100%; }
.narrow { max-width: 420px; }

/* My shifts */
.admin-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pill { background: #fff; border: 1px solid var(--line); padding: 5px 12px; border-radius: 20px; text-decoration: none; font-size: .9rem; }
.pill.warn { background: #fff4e5; border-color: #f5d4a6; color: var(--warn); font-weight: 600; }
.days { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.days li { display: flex; gap: 14px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: center; }
.days li:first-child { border-top: 0; }
.days li.today { background: #fbf1f2; box-shadow: inset 4px 0 0 var(--brand); }
.days li.past { opacity: .55; }
.dname { width: 62px; font-weight: 600; line-height: 1.15; } .dname small { color: var(--muted); font-weight: 400; }
.dshift b { font-size: 1.05rem; }
.total { text-align: right; margin: 6px 4px 0; }

/* Week grid */
.weekhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.weekhead h1 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 6px; }
.status { padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: .9rem; margin-right: auto; }
.status.pub { background: #e7f5ec; color: var(--ok); } .status.draft { background: #fff4e5; color: var(--warn); }
.hint { margin: 4px 0 10px; }
.gridwrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
.grid { border-collapse: collapse; width: 100%; min-width: 760px; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px; text-align: center; vertical-align: middle; }
.grid thead th { background: #faf9f7; font-weight: 600; } .grid thead small { color: var(--muted); font-weight: 400; }
.grid tbody th { text-align: left; padding-left: 12px; white-space: nowrap; border-left: 0; }
.grid tr.mine th { color: var(--brand); }
.grid tr.mine td, .grid tr.mine th { background: #fdf7f8; }
.grid .today { background: #fbf1f2 !important; }
.grid td.hrs { font-weight: 600; color: var(--muted); }
.grid td.edit { padding: 3px; }
.cellbtn { width: 100%; min-height: 44px; border: 1px dashed transparent; background: none; border-radius: 6px; cursor: pointer; font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.cellbtn:hover { border-color: #c9ccd3; background: #fafafa; }
.chip { display: inline-block; background: #e8eef7; border-radius: 6px; padding: 3px 8px; font-weight: 600; white-space: nowrap; font-size: .92rem; }
.chip b { font-weight: 700; margin-left: 2px; }
.off { color: #a3a8b3; }
.leave { display: block; font-size: .72rem; font-weight: 600; color: var(--ok); }
.leave.pending { color: var(--warn); }
.note { display: block; font-size: .72rem; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { list-style: none; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; margin-top: 14px; }

dialog { border: 0; border-radius: 14px; padding: 20px; width: min(440px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,20,30,.45); }
dialog h2 { margin-top: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.dlgbtns { display: flex; gap: 8px; align-items: center; }
.dlgbtns .link { margin-left: auto; }

/* Lists */
.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list th, .list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.list th { background: #faf9f7; font-size: .85rem; color: var(--muted); }
.list input:not([type=checkbox]):not([type=color]) { width: 100%; }
.list .num { width: 70px !important; }
.list tr.inactive td { opacity: .5; }
.list tr.newrow td { background: #fcfbf9; }
.tag { padding: 2px 8px; border-radius: 10px; font-size: .8rem; font-weight: 600; }
.tag.pending { background: #fff4e5; color: var(--warn); } .tag.approved { background: #e7f5ec; color: var(--ok); } .tag.declined { background: #fdecea; color: var(--bad); }
.req { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.req .acts { display: flex; gap: 8px; }

@media (max-width: 640px) {
  .top { padding: 10px 12px; gap: 8px; }
  .top nav { order: 3; flex: 1 1 100%; }
  .who { margin-left: auto; }
  .row { flex-direction: column; gap: 0; }
  .list.staff, .list.staff tbody, .list.staff tr { display: block; }
  .list.staff tr:first-child { display: none; }
  .list.staff tr { padding: 8px; border-bottom: 1px solid var(--line); }
  .list.staff td { display: inline-block; border: 0; padding: 4px; }
}

@media print {
  .top, .toolbar, .hint, .weekhead .btn, .flash { display: none !important; }
  body { background: #fff; } main { padding: 0; max-width: none; }
  .gridwrap { border: 0; } .grid { min-width: 0; }
  .grid th, .grid td { border: 1px solid #999; }
  .cellbtn { min-height: 0; }
}
