:root {
  color: #1c2421;
  background: #f3f1ec;
  font-family: "Yu Gothic UI", "Hiragino Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

* { box-sizing: border-box; }

body { margin: 0; }

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: #1f3d32;
  color: #fff;
  cursor: pointer;
}

button.ghost, a.button {
  background: #1f3d32;
  color: #fff;
  border: 0;
}

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  border-radius: 8px;
  text-decoration: none;
}

button.ghost {
  background: transparent;
  color: #1f3d32;
  border: 1px solid #cfc8bc;
}

button.warn { background: #8c2f2f; }

#app { max-width: 1100px; margin: 0 auto; padding: 16px; }

#app.wide { max-width: none; }

header, .panel, .card {
  background: #fff;
  border: 1px solid #e2ddd4;
  border-radius: 12px;
}

header, .panel { padding: 16px; margin-bottom: 12px; }

h1 { font-size: 22px; margin: 0 0 8px; }

h2 { font-size: 18px; margin: 0 0 12px; }

h3 { font-size: 16px; margin: 0 0 8px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }

.tabs button[aria-selected="true"] { background: #1f3d32; color: #fff; }

.tabs button { background: #fff; color: #1f3d32; border: 1px solid #cfc8bc; }

label { display: grid; gap: 4px; font-size: 14px; }

input, select, textarea {
  min-height: 44px;
  border: 1px solid #cfc8bc;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  width: 100%;
  accent-color: #1f3d32;
}

input[type="checkbox"] {
  accent-color: #1f3d32;
}

input[readonly], input:disabled, textarea:disabled { background: #f3f1ec; color: #1c2421; }

textarea { min-height: 88px; resize: vertical; }

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

label.check input { width: 20px; min-height: 20px; }

.tabbar { display: none; }

.grid { display: grid; gap: 10px; }

.grid.two { grid-template-columns: 1fr 1fr; }

.grid.one { grid-template-columns: minmax(0, 520px); }

.block { margin-top: 12px; }

.shift-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin: 0;
}

.shift-summary div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #e2ddd4;
}

.shift-summary dt,
.shift-summary dd { margin: 0; }

.shift-summary dd { font-weight: 700; }

.pay-lines {
  display: grid;
  margin: 0;
}

.pay-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #e2ddd4;
}

.pay-lines dt,
.pay-lines dd { margin: 0; }

.pay-lines dd { font-weight: 700; white-space: nowrap; }

@media (min-width: 721px) {
  .shift-summary { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

.stack { max-width: 560px; margin-top: 16px; }

.subtabs { margin-bottom: 0; }

.notice {
  color: #1f3d32;
  background: #e7f0eb;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
}

.quota-status {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.quota-status li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.quota-status + h3 { margin-top: 16px; }

.penalty-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.penalty-list li { padding: 4px 0; }

.mark {
  flex: 0 0 1.4em;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.mark.ok { color: #1b7a3a; }

.mark.ng { color: #c62828; }

button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 14px;
}

table.plain th,
table.plain td { text-align: left; white-space: normal; }

table.sheet { font-size: 13px; }

table.roster { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }

table.roster.sales,
table.roster.extensions { table-layout: fixed; width: 100%; }

table.roster.sales { min-width: 80rem; }

table.roster.sales col.name,
table.roster.extensions col.name { width: 8rem; }

table.roster.sales col.sales,
table.roster.sales col.reward { width: 7rem; }

table.roster.sales col.average { width: 5.25rem; }

table.roster.sales col.guests { width: 4.25rem; }

table.roster.sales th,
table.roster.sales td { padding-left: 6px; padding-right: 6px; }

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 16px;
  color: #5c6560;
}

.loading p { margin: 0; }

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #e2ddd4;
  border-top-color: #1f3d32;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

table.roster.sales col.tail { width: 6.75rem; }

table.roster.extensions col.count { width: 7.5rem; }

table.roster.cash { min-width: 78rem; }

table.roster.cash col.day { width: 3.5rem; }

table.roster.cash col.amount { width: 6.5rem; }

table.roster thead th {
  text-align: center;
  vertical-align: bottom;
  background: #fff;
  color: #1f3d32;
}

table.roster thead tr:first-child th:first-child,
table.roster tbody td:first-child,
table.roster tfoot td:first-child {
  text-align: left;
  background: #fff;
}

table.roster tfoot td {
  font-weight: 600;
  border-top: 1px solid rgba(31, 61, 50, 0.28);
}

table.roster thead tr:last-child th {
  text-align: right;
  font-weight: 500;
  font-size: 12px;
  color: #5c6560;
}

table.roster .band.free,
table.roster .band.bring { background: #f4f8f6; }

table.roster .band.store { background: #fff; }

table.roster .band.start { box-shadow: inset 1px 0 0 rgba(31, 61, 50, 0.16); }

table.roster thead tr:first-child th.band {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
}

table.roster.extensions thead tr th {
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  color: #1f3d32;
}

table.roster.extensions thead tr th:first-child { text-align: left; }

table.roster.extensions .start { box-shadow: inset 1px 0 0 rgba(31, 61, 50, 0.16); }

table.roster.cash thead tr th {
  text-align: right;
  font-weight: 600;
  font-size: 12px;
  color: #1f3d32;
}

table.roster.cash thead tr th:first-child,
table.roster.cash tbody td:first-child,
table.roster.cash tfoot td:first-child { text-align: left; }

.scroll.cash-scroll { overflow: visible; }

.cash-actions { justify-content: flex-end; margin-top: 16px; }

table.cash-book {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

table.cash-book tbody tr { height: 53px; }

table.cash-book th,
table.cash-book td {
  white-space: normal;
  vertical-align: middle;
  text-align: left;
}

table.cash-book thead th {
  text-align: center;
  color: #1f3d32;
  background: #fff;
}

table.cash-book td.cat,
table.cash-book td.kind {
  text-align: center;
  background: #f4f8f6;
  font-weight: 600;
  color: #1f3d32;
}

table.cash-book td.cat { width: 4.5rem; }

table.cash-book td.kind { width: 7.5rem; }

table.cash-book td.money {
  width: 11rem;
  text-align: right;
  white-space: nowrap;
}

table.cash-book tr.section-total td.money { font-weight: 600; }

table.cash-book td.with-info { white-space: nowrap; }

table.cash-book button.info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin-left: 6px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #5c6560;
  vertical-align: -4px;
}

table.cash-book button.info:hover,
table.cash-book button.info:focus {
  background: transparent;
  color: #1f3d32;
}

table.cash-book button.info svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

table.cash-book button.info .tip {
  display: none;
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #1f3d32;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  z-index: 5;
}

table.cash-book button.info:hover .tip,
table.cash-book button.info:focus .tip { display: block; }

table.cash-book input {
  min-height: 36px;
  text-align: right;
}

td.act, th.act { text-align: left; white-space: nowrap; }

td.diff { background: #fff4cc; }

tr.selected td { background: #e7f0eb; }

tr.selected td.diff { background: #fff4cc; }

.days { display: grid; gap: 8px; }

.day {
  display: grid;
  grid-template-columns: auto minmax(5.2em, 8.2em);
  justify-content: start;
  gap: 8px;
  align-items: center;
}

.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }

.cal-dow { margin-bottom: 6px; color: #5c6560; font-size: 12px; text-align: center; }

button.cal-day {
  min-height: 44px;
  padding: 0;
  background: #fff;
  color: #1c2421;
  border: 1px solid #e2ddd4;
}

button.cal-day.on { background: #1f3d32; color: #fff; border-color: #1f3d32; }

button.cal-day.saved { box-shadow: inset 0 -3px 0 #9bb5a8; }

button.cal-day.on.saved { box-shadow: inset 0 -3px 0 #d7e4dc; }

.cal-pad { min-height: 44px; }

.day > label {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.day > label input { width: 18px; min-height: 18px; }

.fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 25;
  width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border-radius: 50%;
  font-size: 32px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(28, 36, 33, 0.28);
}

.fab.save {
  width: auto;
  min-width: 88px;
  height: 48px;
  min-height: 48px;
  border-radius: 24px;
  padding: 0 18px;
  font-size: 16px;
}

.has-fab { margin-bottom: 72px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(28, 36, 33, 0.45);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border: 1px solid #e2ddd4;
  border-radius: 12px;
  padding: 16px;
}

.modal-card.sale-dialog { width: min(640px, 100%); }

.toast {
  position: fixed;
  right: 16px;
  bottom: 80px;
  z-index: 35;
  margin: 0;
  max-width: min(320px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  background: #1f3d32;
  color: #fff;
  box-shadow: 0 4px 14px rgba(28, 36, 33, 0.28);
}

.toast.bad { background: #8c2f2f; }

.muted { color: #5c6560; font-size: 14px; }

.error { color: #8c2f2f; margin: 8px 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td { border-bottom: 1px solid #e2ddd4; padding: 8px; text-align: right; white-space: nowrap; }

th:first-child, td:first-child { text-align: left; }

.scroll { overflow-x: auto; }

.login button { width: 100%; margin-top: 8px; }

.cards { display: grid; gap: 10px; }

.sale-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e2ddd4;
  border-radius: 12px;
}

.sale-card > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.line-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  flex: none;
}

button.icon {
  width: 36px;
  min-height: 36px;
  padding: 0;
  background: transparent;
  color: #1f3d32;
  border: 0;
}

button.icon.warn { background: transparent; color: #8c2f2f; }

button.icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 720px) {
  .grid.two { grid-template-columns: 1fr; }
}

.day select { width: 100%; }

html.phone .fab { bottom: calc(76px + env(safe-area-inset-bottom)); }

html.phone .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }

html.phone .tabs.primary { display: none; }

html.phone #app { padding-bottom: 88px; }

html.phone .tabbar {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: #fff;
  border-top: 1px solid #e2ddd4;
  overflow-x: auto;
  padding-bottom: env(safe-area-inset-bottom);
}

html.phone .tabbar button {
  flex: 1 0 72px;
  min-height: 58px;
  border-radius: 0;
  background: transparent;
  color: #5c6560;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  line-height: 1.2;
  padding: 6px 2px;
}

html.phone .tabbar button[aria-selected="true"] {
  color: #1f3d32;
  background: transparent;
}

.tabbar svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
