:root {
  --wood: #6b4423;
  --wood-dark: #4a2f18;
  --cream: #faf6ef;
  --accent: #b5652d;
  --green: #4c7a3d;
  --amber: #c98a1e;
  --red: #b03a2e;
  --gray: #8a8378;
  --ink: #2b2621;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--ink);
  padding: 16px;
  padding-bottom: 60px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 {
  font-size: 22px;
  margin: 0;
  color: var(--wood-dark);
}

a.button, button {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}

a.button.secondary, button.secondary {
  background: var(--gray);
}

.card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.tool-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tool-row a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
}

.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  color: white;
  white-space: nowrap;
}

.badge.in-shop { background: var(--green); }
.badge.in-truck { background: var(--amber); }
.badge.loaned-out { background: #3a6ea5; }
.badge.needs-repair { background: var(--red); }

label {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-family: inherit;
}

textarea { resize: vertical; min-height: 70px; }

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.status-grid button {
  background: white;
  color: var(--ink);
  border: 2px solid #ddd;
  font-size: 14px;
  padding: 12px 6px;
}

.status-grid button.active {
  border-color: var(--accent);
  background: #fdf1e7;
}

.muted { color: var(--gray); font-size: 14px; }
.empty-state { text-align: center; padding: 40px 0; color: var(--gray); }
.saved-msg {
  background: #eaf5e6;
  color: var(--green);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}
.error-msg {
  background: #fcebe9;
  color: var(--red);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}
footer.hint {
  margin-top: 30px;
  text-align: center;
  font-size: 12px;
  color: var(--gray);
}

/* ---------- v2 additions ---------- */

.owner-badge {
  background: #e9e4da;
  color: var(--ink);
  font-size: 12px;
  padding: 6px 12px;
}
.owner-badge.active { background: #f6d78a; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-tile {
  background: white;
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.stat-tile .num { font-size: 22px; font-weight: 800; color: var(--wood-dark); display:block; }
.stat-tile .label { font-size: 12px; color: var(--gray); }

.estate-box {
  background: #eaf1f8;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  font-size: 14px;
  color: #2c4a66;
}
.estate-box h3 { margin: 0 0 6px; font-size: 15px; }

.condition-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  color: white;
  background: var(--red);
}

.tap-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.tap-menu button {
  font-size: 14px;
  padding: 14px 8px;
}
.tap-menu button.primary { background: var(--green); }
.tap-menu button.secondary-action { background: var(--wood); }

.timer-banner {
  background: #fff4e0;
  border: 1px solid var(--amber);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 14px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.photo-slot {
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--gray);
  position: relative;
}
.photo-slot img {
  width: 100%;
  border-radius: 8px;
  display: block;
  margin-bottom: 6px;
  max-height: 140px;
  object-fit: cover;
}
.photo-slot input[type=file] { font-size: 12px; }

.history-item {
  border-bottom: 1px solid #eee;
  padding: 8px 0;
  font-size: 14px;
}
.history-item:last-child { border-bottom: none; }

.owner-only {
  opacity: 1;
}
.locked-note {
  font-size: 13px;
  color: var(--gray);
  font-style: italic;
}

.sellkit-output {
  width: 100%;
  min-height: 160px;
  font-family: monospace;
  font-size: 13px;
}

nav.tabbar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #eee;
  padding: 8px 0;
}
nav.tabbar a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--gray);
  font-size: 13px;
  font-weight: 600;
}
nav.tabbar a.active { color: var(--accent); }

