:root {
  --primary: #16351F;
  --accent: #CFDCC8;
  --bg: #f4f6f3;
  --card: #ffffff;
  --text: #16351F;
  --muted: #5a6b5e;
  --danger: #9b2c2c;
  --ok: #1f7a3f;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(22, 53, 31, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); min-height: 100%; }
body { max-width: 480px; margin: 0 auto; min-height: 100dvh; }

header.appbar {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.appbar h1 { font-size: 1.05rem; margin: 0; font-weight: 700; letter-spacing: 0.02em; }
header.appbar .meta { font-size: 0.75rem; opacity: 0.85; }

main { padding: 16px; padding-bottom: 40px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 18px 14px;
  font-size: 1rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
  gap: 8px;
  box-shadow: var(--shadow);
}
.btn span.icon { font-size: 1.4rem; line-height: 1; }
.btn.secondary { background: #fff; color: var(--primary); border: 2px solid var(--accent); }
.btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.35); min-height: auto; padding: 8px 10px; font-size: 0.8rem; }
.btn.stub { background: #e8eee6; color: var(--muted); }
.btn.full { width: 100%; min-height: 48px; align-items: center; justify-content: center; flex-direction: row; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

label { display: block; font-size: 0.8rem; font-weight: 600; margin: 10px 0 4px; color: var(--muted); }
input, textarea, select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #d5ddd4;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }

.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  max-width: 90vw;
  z-index: 50;
  display: none;
}
.toast.show { display: block; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.85rem; }
.line-item { display: grid; grid-template-columns: 2fr 0.7fr 0.9fr auto; gap: 6px; margin-bottom: 8px; align-items: center; }
.line-item button { min-height: auto; padding: 8px; background: #eee; color: #333; border: none; border-radius: 8px; }

.panel-title { margin: 0 0 8px; font-size: 1.1rem; }
.back { background: none; border: none; color: var(--primary); font-weight: 700; padding: 0 0 8px; cursor: pointer; }

.role-pill {
  display: inline-flex;
  gap: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 2px;
}
.role-pill button {
  border: none;
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  cursor: pointer;
}
.role-pill button.active { background: #fff; color: var(--primary); font-weight: 700; }

.owner-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.owner-tabs button {
  border: 1px solid var(--accent);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}
.owner-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 10px 0; border-bottom: 1px solid #e6ece4; font-size: 0.9rem; }

#preview { width: 100%; border-radius: 12px; margin-top: 8px; max-height: 220px; object-fit: cover; }
