:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #617067;
  --line: #dfe7e1;
  --paper: #f6f8f6;
  --panel: #ffffff;
  --brand: #13795b;
  --brand-dark: #0b5a43;
  --brand-soft: #eaf5ef;
  --danger: #a23f2c;
  --danger-soft: #fff0ec;
  --warning: #8a6116;
  --warning-soft: #fff7df;
  --shadow: 0 10px 30px rgba(25, 45, 34, .07);
  --shadow-lg: 0 20px 60px rgba(25, 45, 34, .11);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-dark); }
button, input, textarea, select { font: inherit; }
button, .btn { -webkit-tap-highlight-color: transparent; }
.wrap { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar .wrap {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  box-shadow: 0 7px 18px rgba(19,121,91,.22);
}
.brand small { display: block; font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: .01em; }
.nav { display: flex; align-items: center; gap: 8px; }
.nav form { margin: 0; }

.btn, button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.btn:hover, button:hover { transform: translateY(-1px); border-color: #c6d5cb; }
.btn.primary, button.primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(19,121,91,.16);
}
.btn.primary:hover, button.primary:hover { background: var(--brand-dark); }
.btn.ghost, button.ghost { background: transparent; }
.btn.danger, button.danger { color: var(--danger); background: var(--danger-soft); border-color: #f0c6bc; }
.btn.small, button.small { min-height: 38px; padding: 7px 10px; font-size: 14px; }

.hero {
  padding: 70px 0 52px;
  background:
    radial-gradient(circle at 85% 15%, rgba(19,121,91,.15), transparent 30%),
    linear-gradient(180deg, #eef6f0 0%, var(--paper) 100%);
}
.eyebrow { margin: 0 0 10px; color: var(--brand); font-size: 13px; font-weight: 850; text-transform: uppercase; letter-spacing: .1em; }
.hero h1, .page-head h1 { margin: 0; letter-spacing: -.045em; line-height: 1.05; }
.hero h1 { font-size: clamp(36px, 7vw, 64px); max-width: 760px; }
.hero p { color: var(--muted); max-width: 690px; font-size: 18px; margin: 18px 0 0; }

.page-shell { padding: 34px 0 56px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(30px, 5vw, 44px); }
.page-head p { margin: 8px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); align-items: start; }
.feature-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card h2, .card h3 { margin: 0 0 10px; letter-spacing: -.02em; }
.card p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.stat-card {
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-card .label { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-card strong { font-size: clamp(28px, 5vw, 38px); letter-spacing: -.04em; line-height: 1; }
.stat-card.accent { background: linear-gradient(145deg, var(--brand), var(--brand-dark)); color: #fff; border-color: transparent; }
.stat-card.accent .label { color: rgba(255,255,255,.82); }
.week-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 13px 16px;
  margin-bottom: 24px;
  border: 1px solid #d4e8dc;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.week-strip strong { font-size: 14px; }
.week-strip span { font-size: 14px; }

.profile-list { display: grid; gap: 14px; }
.profile-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.profile-mini-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 15px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 22px;
  font-weight: 850;
}
.profile-mini-logo img { width: 100%; height: 100%; object-fit: cover; }
.profile-row h2 { margin: 0; font-size: 19px; }
.profile-row p { margin: 3px 0 8px; color: var(--muted); font-size: 14px; }
.profile-row-meta { display: flex; gap: 13px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.profile-row-meta strong { color: var(--ink); }
.profile-row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.ok { color: #0b6045; background: #e8f7ef; }
.badge.off { color: #7b5612; background: var(--warning-soft); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.empty-state { padding: 36px; text-align: center; border: 1px dashed #cbd8cf; border-radius: var(--radius); background: rgba(255,255,255,.5); }

.form { display: grid; gap: 18px; }
.form-section { border: 0; padding: 0; margin: 0; }
.form-section + .form-section { padding-top: 22px; border-top: 1px solid var(--line); }
.form-section legend { width: 100%; margin-bottom: 15px; font-size: 18px; font-weight: 850; letter-spacing: -.02em; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #334139; font-size: 14px; font-weight: 750; }
input, textarea, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cfdad2;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(19,121,91,.11); }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--brand); }
.checkbox-line { display: flex; align-items: center; gap: 8px; }
.help { color: var(--muted); font-size: 12px; font-weight: 500; }
.logo-editor { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 14px; border-radius: 13px; background: #f7faf8; border: 1px solid var(--line); }
.logo-preview { display: block; width: 86px; height: 86px; object-fit: cover; border: 1px solid var(--line); background: #fff; }
.logo-preview.circle { border-radius: 50%; }.logo-preview.rounded { border-radius: 14px; }.logo-preview.square { border-radius: 2px; }.logo-preview.original { width: 140px; object-fit: contain; border-radius: 10px; }
.logo-preview.contain { object-fit: contain; padding: 5px; }
.logo-preview.pos-top { object-position: top center; }.logo-preview.pos-center { object-position: center; }.logo-preview.pos-bottom { object-position: bottom center; }

.notice { padding: 13px 15px; border: 1px solid #d3e7db; border-radius: 12px; background: var(--brand-soft); margin: 14px 0; }
.notice.error { color: var(--danger); background: var(--danger-soft); border-color: #f0c3b9; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }

.side-stack { display: grid; gap: 16px; position: sticky; top: 88px; }
.qr-panel { text-align: center; }
.qr-img { width: min(230px, 85%); aspect-ratio: 1; object-fit: contain; border: 10px solid #fff; border-radius: 18px; box-shadow: var(--shadow-lg); margin: 12px auto 16px; }
.qr-link { display: block; overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }
.mini-metrics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; margin-top: 14px; }
.mini-stat { padding: 11px; border-radius: 11px; background: #f5f8f6; border: 1px solid var(--line); }
.mini-stat span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.mini-stat strong { display: block; margin-top: 2px; font-size: 21px; }

.auth-shell { width: min(480px, calc(100% - 32px)); margin: 48px auto; }
.auth-card { padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); }
.auth-card h1 { margin-top: 0; letter-spacing: -.035em; }
.code-list { columns: 2; padding: 14px; border-radius: 12px; background: #f5f7f5; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.full-qr { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.full-qr img { width: min(72vw, 560px); border-radius: 22px; background: #fff; padding: 16px; box-shadow: var(--shadow-lg); }
footer { padding: 32px 0; color: var(--muted); font-size: 13px; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pwa-install { color: #fff; background: #667eea; border-color: #667eea; }
.pwa-install[hidden] { display: none !important; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid.two { grid-template-columns: 1fr; }
  .side-stack { position: static; }
  .profile-row { grid-template-columns: auto minmax(0,1fr); }
  .profile-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .wrap { width: min(100% - 22px, 1160px); }
  .topbar .wrap { min-height: 60px; }
  .brand-text { display: none; }
  .nav { gap: 5px; }
  .nav .btn, .nav button { min-height: 39px; padding: 7px 10px; font-size: 13px; }
  .hero { padding: 48px 0 36px; }
  .hero p { font-size: 16px; }
  .page-shell { padding-top: 24px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .stat-card { min-height: 108px; padding: 14px; }
  .feature-grid, .field-grid { grid-template-columns: 1fr; }
  .field-grid .full { grid-column: auto; }
  .card { padding: 17px; border-radius: 14px; }
  .profile-row { grid-template-columns: 1fr; }
  .profile-mini-logo { width: 52px; height: 52px; }
  .profile-row-actions .btn { flex: 1 1 auto; }
  .form-actions { flex-direction: column; }
  .form-actions .btn, .form-actions button { width: 100%; }
  .week-strip { gap: 9px; }
  input, select, textarea, button { font-size: 16px; }
}
