:root {
  color-scheme: light;
  --ink: #241f1d;
  --muted: #706865;
  --forest: #241f1d;
  --forest-2: #7b5b52;
  --mint: #eee5e1;
  --cream: #f6f4f2;
  --paper: #ffffff;
  --line: rgba(43, 34, 30, 0.12);
  --warning: #9a6818;
  --warning-bg: #fff3df;
  --danger: #a34343;
  --danger-bg: #fff0ef;
  --success: #2f6e51;
  --success-bg: #e6f1eb;
  --shadow: 0 12px 32px rgba(45, 35, 30, 0.09);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }

html { background: #f6f4f2; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 95% 0%, rgba(159, 125, 113, 0.16), transparent 38%),
    #f6f4f2;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 18px calc(24px + env(safe-area-inset-bottom));
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(43, 34, 30, 0.11);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: var(--forest);
  border-radius: 12px;
  box-shadow: 0 7px 16px rgba(45, 35, 30, 0.2);
}

.brand-mark svg { width: 25px; height: 25px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.16em; }
.topbar h1 { margin: 1px 0 0; font-size: 17px; line-height: 1.1; letter-spacing: 0.035em; }

.network-badge {
  margin-left: auto;
  padding: 6px 9px;
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.intro { padding: 29px 2px 17px; }
.date-label { margin: 0 0 5px; color: var(--forest-2); font-size: 13px; font-weight: 750; }
.staff-label { margin: 0 0 7px; color: var(--ink); font-size: 16px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.intro h2 { margin: 0; font-size: clamp(27px, 8vw, 34px); line-height: 1.18; letter-spacing: -0.035em; }
.lead { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.status {
  min-height: 38px;
  margin-bottom: 12px;
  padding: 9px 12px;
  color: var(--forest-2);
  background: var(--mint);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}

.status-cached, .status-pending { color: var(--warning); background: var(--warning-bg); }
.status-error, .status-conflict { color: var(--danger); background: var(--danger-bg); }
.status-saved { color: var(--success); background: var(--success-bg); }

.content { min-height: 174px; }
.cards { display: grid; gap: 12px; }

.action-card {
  padding: 17px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(43, 34, 30, 0.1);
  border-radius: 17px;
  box-shadow: var(--shadow);
}
.action-card.is-conflict {
  border-color: rgba(198, 138, 45, 0.7);
  background: linear-gradient(180deg, #fff, #fff9ed);
}

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.action-name { margin: 0; font-size: 17px; line-height: 1.45; }
.target { flex: 0 0 auto; padding-top: 2px; color: var(--muted); font-size: 12px; font-weight: 700; }

.count-row { display: grid; grid-template-columns: 50px 1fr 50px; gap: 9px; margin-top: 15px; }
.count-button, .count-input {
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 13px;
}
.count-button { color: var(--forest); background: var(--mint); font-size: 24px; font-weight: 700; cursor: pointer; }
.count-button:active { transform: translateY(1px); }
.count-input { width: 100%; color: var(--ink); background: var(--paper); text-align: center; font-size: 21px; font-weight: 800; }
.count-input:focus-visible, button:focus-visible { outline: 3px solid rgba(32, 88, 77, 0.3); outline-offset: 2px; }

.card-foot { min-height: 44px; margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.unit { color: var(--muted); font-size: 12px; }
.zero-button { min-width: 74px; min-height: 44px; color: var(--muted); background: transparent; border: 0; border-radius: 11px; font-size: 13px; font-weight: 700; cursor: pointer; }
.zero-button:hover { background: #f3f5f3; }
.card-pending { color: var(--warning); font-size: 12px; font-weight: 700; }
.card-pending.is-conflict { color: #9a6818; }

.save-area { position: sticky; bottom: 0; padding: 15px 0 calc(4px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--cream) 22%); }
.primary-button {
  width: 100%;
  min-height: 50px;
  color: white;
  background: var(--forest);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(45, 35, 30, 0.2);
  font-weight: 800;
  cursor: pointer;
}
.primary-button:disabled { color: #a1aaa7; background: #dfe4e2; box-shadow: none; cursor: default; }
.save-hint { margin: 7px 2px 0; color: var(--muted); text-align: center; font-size: 11px; }

.empty-state {
  min-height: 174px;
  padding: 27px 21px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  background: rgba(255,255,255,0.7);
  border: 1px dashed #d2c8c3;
  border-radius: 16px;
}
.empty-state p { margin: 5px 0; }
.empty-title { color: var(--ink); font-weight: 800; }
.empty-state p:not(.empty-title) { color: var(--muted); font-size: 13px; line-height: 1.6; }
.secondary-button { min-height: 44px; margin-top: 13px; padding: 0 19px; color: var(--forest); background: white; border: 1px solid #cabdb7; border-radius: 12px; font-weight: 750; cursor: pointer; }

.skeleton-list { display: grid; gap: 12px; }
.skeleton {
  min-height: 174px;
  padding: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(43, 34, 30, 0.08);
  border-radius: 17px;
}
.skeleton-line, .skeleton-controls {
  background: linear-gradient(90deg, #e9eeec 25%, #f7f9f8 50%, #e9eeec 75%);
  background-size: 200% 100%;
  animation: shimmer 1.35s infinite;
  border-radius: 8px;
}
.skeleton-line { width: 62%; height: 13px; margin-bottom: 11px; }
.skeleton-title { width: 84%; height: 20px; }
.skeleton-controls { height: 50px; margin-top: 26px; }

[hidden] { display: none !important; }
noscript { display: block; padding: 20px; text-align: center; }

@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line, .skeleton-controls { animation: none; } }
@media (min-width: 700px) { .app-shell { padding-left: 24px; padding-right: 24px; } }
