* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --green: #20985A;
  --green-dark: #177a47;
  --red: #C74C49;
  --page-bg: #F1F2F3;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
}

html, body {
  background: var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 24px;
}

/* ===== Header ===== */
.header {
  background: linear-gradient(160deg, #26a865 0%, var(--green) 55%, var(--green-dark) 100%);
  padding: 18px 16px 26px;
}
.header-title {
  text-align: center;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.header .store-name {
  display: block;
  font-size: 13px;
  font-weight: 400;
  opacity: 0.9;
  margin-top: 2px;
}
.banner {
  width: 100%;
  border-radius: 12px;
  display: block;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  background: #f7f1e3; /* 加载完成前占位底色（米色，与品牌VI协调），避免空白 */
  min-height: 90px;
}
.banner-wrap { position: relative; }
.banner-edit {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 12px;
  padding: 5px 14px;
  cursor: pointer;
}
.banner-edit:active { background: rgba(0,0,0,.75); }

/* ===== Store portal cards (Saizeriya style) ===== */
.store-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: #fff;
  border-left: 4px solid var(--green);
  box-shadow: 0 2px 10px rgba(32,152,90,.10);
}
.store-card:last-child { margin-bottom: 0; }
.store-card .info { flex: 1; padding-right: 12px; }
.store-card .title { font-size: 16px; font-weight: 800; color: var(--green); margin-bottom: 3px; }
.store-card .desc { font-size: 12px; color: var(--text-2); }
.store-card .enter-btn { background: var(--red); }

/* ===== SOP files ===== */
.sop-add {
  margin-left: auto;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 16px;
  cursor: pointer;
}
.sop-add:active { transform: scale(.96); }
.sop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px;
  border-top: 1px solid #f0f2f4;
}
.sop-item:first-of-type { border-top: none; }
.sop-info { flex: 1; min-width: 0; padding-right: 10px; }
.sop-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sop-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.sop-actions { display: flex; gap: 8px; flex-shrink: 0; }
.sop-actions .mini {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #d8dce0;
  background: #fff;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.sop-actions .mini:active { transform: scale(.96); }
.sop-actions .mini.danger { color: #c74c49; border-color: #ecc4c3; }
.empty.small { padding: 22px 16px; font-size: 13px; }

/* ===== Cards ===== */
.section {
  margin: -14px 14px 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.section + .section { margin-top: 14px; }
.section-head {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
}
.section-head::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--green);
  margin-right: 8px;
}

/* status row */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.status-label { font-size: 16px; font-weight: 700; }
.badge {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-left: 8px;
}
.badge.done { background: #e6f7ee; color: var(--green); }
.badge.pending { background: #fdf1ec; color: #d96a3c; }
.status-time { color: var(--text-3); font-size: 13px; display: flex; align-items: center; }
.status-time .arrow { margin-left: 4px; }

/* ===== Form cards ===== */
.form-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.form-card:last-child { margin-bottom: 0; }
.form-card .info { flex: 1; padding-right: 12px; }
.form-card .title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.form-card .desc { font-size: 13px; color: var(--text-2); }
.form-card .meta { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.btn {
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 22px;
  border-radius: 9px;
  min-width: 78px;
  cursor: pointer;
  transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; padding: 12px; font-size: 16px; border-radius: 10px; }
.btn-ghost {
  background: #fff; color: var(--green); border: 1px solid var(--green);
}

/* ===== Form detail ===== */
.topbar {
  background: var(--green);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .back {
  font-size: 20px;
  margin-right: 8px;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
}
.topbar .tt { font-size: 17px; font-weight: 700; flex: 1; }
.topbar .mode { font-size: 12px; background: rgba(255,255,255,.22); padding: 3px 10px; border-radius: 20px; }

.date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 12px 16px;
  border-bottom: 1px solid #eceef0;
}
.date-bar input[type=date] {
  border: 1px solid #d8dce0;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 15px;
  color: var(--text);
}
.date-bar .nav-date {
  border: 1px solid #d8dce0;
  background: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
}

.check-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin: 10px 14px 0;
  box-shadow: var(--shadow);
}
.check-head { display: flex; align-items: center; }
.check-no {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--green); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-right: 10px; flex-shrink: 0;
}
.check-name { flex: 1; font-size: 15px; font-weight: 600; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; z-index: 2; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; background: #d4d8dc; border-radius: 20px; transition: .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(20px); }
.check-item.done .check-name { color: var(--text-2); }

.check-body { margin-top: 12px; padding-left: 34px; }
.field-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.text-input {
  width: 100%;
  border: 1px solid #d8dce0;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
}
.text-input:focus { outline: none; border-color: var(--green); }

.photo-box { margin-top: 10px; }
.photo-thumb {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 10px;
  overflow: hidden;
  display: inline-block;
  margin-right: 8px;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .del {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%;
  width: 22px; height: 22px; font-size: 13px;
  cursor: pointer; line-height: 1;
}
.upload-add {
  width: 96px; height: 96px;
  border: 1.5px dashed #c0c6cc;
  border-radius: 10px;
  display: inline-flex;
  flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  background: #fafbfc;
  vertical-align: top;
}
.upload-add .plus { font-size: 26px; line-height: 1; }
.upload-add span { font-size: 12px; margin-top: 4px; }

/* summary block */
.summary { margin: 14px; background: #fff; border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.summary .progress-text { font-size: 13px; color: var(--text-2); margin-bottom: 8px; display: flex; justify-content: space-between; }
.progress-bar { height: 8px; background: #eef0f2; border-radius: 6px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--green); border-radius: 6px; transition: width .3s; }

.save-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 12px 14px;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  display: flex;
  gap: 10px;
}
.readonly-tip {
  margin: 14px;
  background: #fff8e8;
  border: 1px solid #ffe2a8;
  color: #9a6b1f;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
}

/* ===== Gallery ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 14px;
}
.gallery-item {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery-item .cap { padding: 8px 10px; font-size: 12px; color: var(--text-2); }
.gallery-item .cap .t { color: var(--text-3); font-size: 11px; margin-top: 2px; }
.gallery-item .del {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%;
  width: 26px; height: 26px; cursor: pointer;
}
.gallery-add {
  border: 1.5px dashed #c0c6cc;
  border-radius: 12px;
  aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  background: #fafbfc;
}
.gallery-add .plus { font-size: 34px; }
.gallery-add span { font-size: 13px; margin-top: 6px; }

.empty {
  text-align: center;
  color: var(--text-3);
  padding: 50px 20px;
  font-size: 14px;
}

/* ===== Login ===== */
.login-wrap {
  max-width: 400px;
  margin: 60px auto;
  background: #fff;
  border-radius: 16px;
  padding: 32px 26px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .ico {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--green); color: #fff;
  font-size: 30px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.login-logo h2 { font-size: 19px; margin-top: 12px; }
.login-logo p { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.login-wrap .form-group { margin-bottom: 16px; }
.login-wrap label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.toast {
  position: fixed;
  left: 50%; top: 38%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.8);
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 999;
  max-width: 80%;
  text-align: center;
}
.muted { color: var(--text-3); font-size: 13px; text-align: center; margin-top: 16px; }
.admin-link {
  position: fixed; right: 12px; bottom: 10px;
  font-size: 12px; color: var(--text-3);
  text-decoration: none;
}

/* ===== Standard vs Actual comparison ===== */
.compare {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.compare-col { flex: 1; min-width: 0; }
.compare-label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}
.compare-label .dot {
  width: 6px; height: 6px; border-radius: 50%;
  margin-right: 5px;
}
.compare-label.std { color: #b8832a; }
.compare-label.std .dot { background: #e0a53a; }
.compare-label.act { color: var(--green); }
.compare-label.act .dot { background: var(--green); }

.std-thumb, .std-add, .std-empty {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.std-thumb {
  border: 2px solid #f0d9a8;
  background: #fffaf0;
}
.std-thumb img { width: 100%; height: 100%; object-fit: cover; }
.std-thumb .edit {
  position: absolute; right: 4px; bottom: 4px;
  background: rgba(184,131,42,.92); color: #fff;
  border: none; border-radius: 6px;
  font-size: 11px; padding: 3px 8px; cursor: pointer;
}
.std-empty {
  border: 1.5px dashed #d8c9a8;
  display: flex; align-items: center; justify-content: center;
  color: #c2ac82; font-size: 12px;
  background: #fdfaf3;
  text-align: center; padding: 6px;
}
.std-add {
  border: 1.5px dashed #d8b978;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #b8832a; cursor: pointer; background: #fdfaf3;
}
.std-add .plus { font-size: 24px; line-height: 1; }
.std-add span { font-size: 11px; margin-top: 4px; }
.std-note {
  font-size: 11px; color: #9a7b48;
  margin-top: 5px; line-height: 1.4;
}

/* ===== Dashboard ===== */
.dash-summary {
  display: flex;
  gap: 10px;
  margin: 14px;
}
.dash-stat {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.dash-stat .num { font-size: 22px; font-weight: 800; }
.dash-stat .lbl { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.dash-stat.ok .num { color: var(--green); }
.dash-stat.warn .num { color: #d96a3c; }
.dash-stat.total .num { color: var(--text); }

.dash-store {
  background: #fff;
  border-radius: 12px;
  margin: 12px 14px 0;
  padding: 14px;
  box-shadow: var(--shadow);
}
.dash-store-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.dash-store-name { font-size: 16px; font-weight: 800; }
.dash-store-name .gcount {
  font-size: 11px; color: var(--text-3); font-weight: 400; margin-left: 6px;
}
.dash-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid #f0f2f4;
}
.dash-row .left { display: flex; align-items: center; }
.dash-row .tag {
  width: 4px; height: 18px; border-radius: 2px; margin-right: 8px;
}
.dash-row .fname { font-size: 14px; font-weight: 600; }
.dash-row .meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.dash-pill {
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 16px;
}
.dash-pill.miss { background: #fbeceb; color: #c74c49; }
.dash-pill.partial { background: #fdf3e3; color: #d98a2c; }
.dash-pill.full { background: #e6f7ee; color: var(--green); }
.dash-pill.view {
  background: #f2f4f6; color: var(--text-2); cursor: pointer;
}

/* ===== User management ===== */
.user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid #f0f2f4;
}
.user-row:first-child { border-top: none; }
.user-row .uname { font-size: 15px; font-weight: 700; }
.user-row .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.role-badge {
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
}
.role-badge.super_admin { background: #eef0fb; color: #4a52c0; }
.role-badge.manager { background: #fdf3e3; color: #d98a2c; }
.role-badge.employee { background: #eef6f1; color: var(--green); }
.user-actions { display: flex; gap: 8px; margin-top: 8px; }
.user-actions .mini {
  font-size: 12px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid #d8dce0; background: #fff; color: var(--text-2);
  cursor: pointer; min-width: 0;
}
.user-actions .mini.danger { color: #c74c49; border-color: #ecc4c3; }
.inactive-flag { font-size: 11px; color: #c74c49; margin-left: 6px; }

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end;
  z-index: 100;
}
.modal {
  background: #fff; width: 100%;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px 28px;
  max-width: 560px; margin: 0 auto;
  max-height: 88vh; overflow-y: auto;
}
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.modal .form-group { margin-bottom: 14px; }
.modal label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.modal select.text-input { appearance: auto; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions .btn { flex: 1; }
