:root {
  --bg: #f5f4f0; --card: #fff; --text: #1d1d1b; --muted: #6b6a66; --line: #e3e1da;
  --brand: #1f3a5f; --brand-2: #2d5288;
  --ok: #1e7d43; --ok-bg: #e5f4ea; --bad: #b42318; --bad-bg: #fdecea; --warn: #8a5a00; --warn-bg: #fff3d6;
  --radius: 10px; --tap: 48px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45; }
.icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
a { color: var(--brand-2); }
h1 { font-size: 24px; margin: 8px 0 12px; } h2 { font-size: 18px; margin: 20px 0 10px; } h3 { font-size: 17px; margin: 18px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .hidden { display: none; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  padding: 10px 16px; background: var(--brand); color: #fff; }
.brand { font-weight: 600; font-size: 17px; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: #dfe7f3; text-decoration: none; padding: 8px 12px; border-radius: 8px; display: inline-flex; gap: 6px; align-items: center; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.top .ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.who { display: flex; flex-direction: column; gap: 0; } .who .muted { color: #c9d5e6; font-size: 11px; }
.who select { min-height: 34px; padding: 4px 8px; color: var(--text); width: auto; max-width: 260px; }
.banner:empty { display: none; }
.banner { background: var(--warn-bg); color: var(--warn); padding: 8px 16px; font-size: 14px; text-align: center; }
.main { max-width: 980px; margin: 0 auto; padding: 16px 16px 80px; }

/* controls */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid #c9c6bc; background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { border-color: #9b988f; }
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.primary:hover { background: var(--brand-2); }
.ghost { background: transparent; }
.danger { color: var(--bad); }
.big { min-height: var(--tap); padding: 10px 20px; font-size: 17px; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #c9c6bc; border-radius: 8px; padding: 8px 10px; background: #fff; min-height: 40px; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #8fb3e6; outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field > span { font-size: 14px; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 10px; } .field.inline select { width: auto; min-width: 220px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 6px 12px 6px 0; }
.check input { width: 20px; height: 20px; min-height: 0; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.btns.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head h1, .card-head h3 { margin: 6px 0; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; margin-bottom: 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 20; max-width: 90vw; }

/* segmented */
.seg { display: inline-flex; border: 1px solid #c9c6bc; border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid #e3e1da; min-height: 44px; }
.seg button:last-child { border-right: 0; }
.seg.big { display: flex; } .seg.big button { flex: 1; font-size: 18px; min-height: 56px; }
.seg button.on { background: var(--brand); color: #fff; }

/* home */
.restaurant { color: var(--brand); }
.form-list { display: grid; gap: 10px; }
.form-card { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
  text-decoration: none; color: var(--text); font-size: 18px; min-height: 64px; }
.form-card span:first-child { flex: 1; font-weight: 500; }
.form-card:hover { border-color: var(--brand-2); }

/* fill */
.form-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.small-r { font-size: 15px; font-weight: 600; }
.form-head h1 { margin-top: 2px; }
.name-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.name-row .name { flex: 1; min-width: 220px; font-size: 18px; min-height: 48px; }
.opened { color: var(--muted); white-space: nowrap; margin-left: auto; }
.notes { background: #eef3fa; border-radius: 10px; padding: 10px 14px; font-size: 14px; color: #33445c; margin-bottom: 12px; }
.rows { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.row { display: grid; grid-template-columns: 300px minmax(0, 1fr) 96px; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.head { background: #f3f2ee; font-size: 13px; color: var(--muted); padding: 8px 12px; font-weight: 600; }
.row .c { text-align: center; }
.row.s-done { background: #f6fbf7; } .row.s-notDone { background: #fef7f6; } .row.s-attention { background: #fffaf0; }
.task { font-size: 16px; } .num { color: var(--muted); font-size: 13px; }
.seg.status { display: flex; } .seg.status button { flex: 1; min-width: 48px; min-height: 48px; padding: 6px 8px; color: var(--muted); }
.seg.status .lbl { font-size: 13px; }
.seg.status button.ok.on { background: var(--ok); color: #fff; }
.seg.status button.bad.on { background: var(--bad); color: #fff; }
.seg.status button.warn.on { background: #c98a00; color: #fff; }
.photo-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cam { width: 52px; height: 48px; padding: 0; font-size: 20px; }
.cam.need { border-color: var(--bad); color: var(--bad); }
.req { font-size: 12px; color: var(--bad); } .req.ok { color: var(--ok); }
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.thumb { padding: 0; width: 40px; height: 40px; min-height: 0; overflow: hidden; border-radius: 6px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.error { color: var(--bad); font-weight: 500; margin-top: 8px; min-height: 1.4em; }
.submit-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.counts { flex: 1; }
@media (max-width: 720px) {
  .row { grid-template-columns: minmax(0, 1fr) 68px; grid-template-areas: "task photo" "status photo"; gap: 8px; padding: 12px 10px; }
  .row > .seg.status { grid-area: status; } .row > .task { grid-area: task; } .row > .photo-cell { grid-area: photo; }
  .row.head { display: none; }
  .seg.status .lbl { font-size: 12px; }
  .seg.status button { flex-direction: column; gap: 2px; padding: 4px; }
  .cam { width: 52px; }
  .top { padding: 8px 12px; } .brand { font-size: 15px; } .who .muted { display: none; }
}

/* done */
.done { text-align: center; padding: 30px 10px; }
.done-icon { font-size: 64px; color: var(--ok); }
.done .btns { justify-content: center; }

/* badges, lists */
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 13px; background: #efeee9; color: #4a4945; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.role-superadmin { background: #ece6fb; color: #4b2e9c; } .badge.role-admin { background: #e3ecfa; color: #1f4f91; } .badge.role-manager { background: var(--ok-bg); color: var(--ok); }
.list { display: grid; gap: 8px; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; text-decoration: none; color: inherit; }
.list-row.plain { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.card .list-row { border-left: 0; border-right: 0; border-radius: 0; border-top: 0; padding: 12px 0; }
.row-btns { display: flex; gap: 4px; }
.locs { max-width: 260px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.loc-card { text-decoration: none; color: inherit; display: block; margin: 0; }
.loc-card:hover { border-color: var(--brand-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef3fa; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; }
.chip .x { min-height: 0; padding: 2px; border: 0; background: transparent; }
.add-row { display: flex; gap: 8px; margin-top: 6px; } .add-row input { max-width: 360px; }
.demo-tools { margin-top: 30px; border-top: 1px dashed var(--line); padding-top: 12px; }
.email-meta div { margin: 2px 0; }
.email-body { overflow-x: auto; }

/* editor */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair > div { position: relative; }
.pair .tag { position: absolute; top: -7px; left: 8px; font-size: 10px; background: #fff; padding: 0 4px; color: var(--muted); }
.edit-item .grow { flex: 1; min-width: 0; }
.order { display: flex; flex-direction: column; align-items: center; }
.order button { min-height: 28px; padding: 2px 6px; border: 0; }
.photo-req { white-space: nowrap; margin: 0; }
.alerts { display: grid; gap: 6px; }
.alert-row { display: grid; grid-template-columns: 48px 160px auto; gap: 10px; align-items: center; }
.locked { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.loc-checks { display: flex; flex-wrap: wrap; }
@media (max-width: 720px) {
  .pair, .two { grid-template-columns: 1fr; gap: 12px; }
  .list-row.plain { grid-template-columns: minmax(0, 1fr) auto; }
  .locs { display: none; }
}
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
.dialog { background: #fff; border-radius: 12px; padding: 18px 20px; width: min(420px, 100%); }
.dialog p { margin: 0 0 12px; font-size: 17px; }
.danger-fill { background: var(--bad); border-color: var(--bad); }

/* resources */
.c-blue { --c: #1f5fbf; --c-bg: #e4eefc; } .c-green { --c: #1e7d43; --c-bg: #e2f3e8; } .c-orange { --c: #c25a00; --c-bg: #fdeedd; }
.c-red { --c: #b42318; --c-bg: #fde7e5; } .c-purple { --c: #6b3fb8; --c-bg: #efe8fb; } .c-gray { --c: #55534d; --c-bg: #ecebe6; }
.res-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.res-btn-wrap { display: flex; flex-direction: column; gap: 4px; }
.res-btn { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 96px; padding: 16px 18px; border-radius: 14px;
  background: var(--c); color: #fff; text-decoration: none; }
.res-btn:hover { filter: brightness(1.08); }
.res-btn-name { font-size: 19px; font-weight: 600; line-height: 1.25; }
.res-btn-sub { font-size: 13px; opacity: .85; }
.res-btn-tools { display: flex; justify-content: center; gap: 4px; }
.res-btn-tools button { min-height: 32px; padding: 2px 8px; border: 0; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--c); margin-right: 10px; vertical-align: 2px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; background: var(--c); color: #fff; border: 3px solid transparent; }
.swatch.on { border-color: #1d1d1b; }
.res-row { grid-template-columns: minmax(0, 1fr) auto; }
.res-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-height: 44px; }
.res-icon { font-size: 26px; color: var(--brand); display: inline-flex; }
.move-sel { width: auto; min-height: 40px; padding: 4px 8px; font-size: 14px; }
.viewer { display: flex; flex-direction: column; align-items: center; gap: 12px; overflow-x: auto; }
.pdf-page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); max-width: none; }
.pdf-page canvas { display: block; }
.res-img { max-width: 100%; height: auto; border-radius: 8px; background: #fff; }
.viewer-head h1 { overflow-wrap: anywhere; }
@media (max-width: 720px) { .res-grid { grid-template-columns: 1fr 1fr; } .res-btn { min-height: 84px; } .res-btn-name { font-size: 17px; } }
.who.live { align-items: flex-end; } .who-name { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.tiny { min-height: 28px; padding: 2px 10px; font-size: 13px; }
.start { max-width: 520px; margin: 40px auto; text-align: center; }
.start .btns { justify-content: center; }
.dialog.wide { width: min(560px, 100%); max-height: 90vh; overflow-y: auto; }
.check.block { display: flex; margin: 6px 0; }
.copy-list { display: grid; gap: 10px; margin: 8px 0; }
.history-filters { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.date-pick { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.date-pick input { width: auto; }
.meter { height: 10px; background: #e8e6df; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.meter > div { height: 100%; background: var(--ok); }
.clean-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.clean-row select { width: auto; }
.list-row.two-col { grid-template-columns: minmax(0,1fr) auto; }
/* editor: item rows */
.edit-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.edit-item .num { padding-top: 10px; text-align: right; }
.item-text { resize: none; overflow: hidden; min-height: 42px; line-height: 1.4; }
.item-tools { display: flex; align-items: center; gap: 2px; }
.item-tools button { min-height: 40px; padding: 6px 8px; }
.item-tools .photo-req { margin: 0 8px; }
details.spanish summary { font-weight: 600; }
@media (max-width: 720px) {
  .edit-item { grid-template-columns: 22px minmax(0, 1fr); }
  .item-tools { grid-column: 2; justify-content: space-between; }
  .item-tools .photo-req { margin: 0 auto 0 4px; }
}
@media (max-width: 720px) { .top { position: static; } }
@media (max-width: 720px) {
  .list-row, .list-row.plain { grid-template-columns: minmax(0, 1fr) auto; }
  .list-row .badges { grid-column: 1; grid-row: 2; }
  .list-row > .icon { grid-column: 2; grid-row: 1 / span 2; }
  .res-row { grid-template-columns: minmax(0, 1fr); }
  .res-row .row-btns { justify-content: flex-end; flex-wrap: wrap; }
  .res-row.view-only { grid-template-columns: minmax(0, 1fr) auto; }
}
