:root {
  --accent: #1f3a5f;
  --bg: #f3f5f8;
  --card: #fff;
  --text: #1b1f24;
  --muted: #6b7380;
  --line: #e2e6ec;
  --on: #e8f0fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--accent);
  color: #fff;
}

.brand { font-weight: 600; font-size: 18px; }

.link {
  background: none;
  border: 0;
  color: #fff;
  opacity: .8;
  font: inherit;
  font-size: 14px;
}

main { padding: 12px 12px 0; max-width: 720px; margin: 0 auto; }

.client {
  display: grid;
  gap: 8px;
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
}

.client label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

input[type=text], input[type=search] {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.search { margin: 12px 0 4px; }

.status { color: var(--muted); font-size: 14px; padding: 4px 4px 0; }
.status:empty { display: none; }

.section {
  background: var(--card);
  border-radius: 12px;
  margin-top: 12px;
  overflow: hidden;
}

.section summary {
  padding: 12px 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.work { border-bottom: 1px solid var(--line); }
.work:last-child { border-bottom: 0; }
.work.on { background: var(--on); }

.pick {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 2px 8px;
  padding: 12px 14px;
  cursor: pointer;
}

.pick input { grid-row: span 2; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.price { font-size: 13px; color: var(--muted); }

.qty {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 14px 12px 50px;
}

.work.on .qty { display: flex; }
.qty input { width: 90px; text-align: right; }
.unit { color: var(--muted); font-size: 14px; }
.sum { margin-left: auto; font-weight: 600; }

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--card);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .08);
}

.total { display: grid; flex: 1; }
.total span { font-size: 13px; color: var(--muted); }
.total strong { font-size: 20px; }

#pdf {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}

#pdf:disabled { opacity: .4; }

.card { background: var(--card); border-radius: 12px; padding: 12px; }

.rooms {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px -12px 0;
  padding: 0 12px 2px;
  scrollbar-width: none;
}

.chip {
  flex: none;
  display: grid;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  font-size: 15px;
}

.chip small { color: var(--muted); font-size: 12px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active small { color: #c9d6e6; }
.chip.add { color: var(--accent); font-weight: 600; align-content: center; }

.room { margin-top: 12px; display: grid; gap: 10px; }
.room-head { display: flex; gap: 8px; align-items: center; }
.room-name { font-weight: 600; }
.link.danger { color: #c0392b; opacity: 1; }
.room .link { color: var(--accent); opacity: 1; padding: 4px 0; }

.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dims label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }

.opening { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.opening span:first-child { width: 58px; flex: none; }
.opening input { width: 0; flex: 1; }
.opening .del { border: 0; background: none; font-size: 22px; color: var(--muted); padding: 0 4px; }

.add-openings { display: flex; gap: 16px; }
.measures { font-size: 13px; color: var(--muted); }

.filters { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.filters .search { margin: 0; flex: 1; }
.only { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); flex: none; }

.section summary { display: flex; justify-content: space-between; gap: 8px; }
.section summary small { color: var(--muted); font-weight: 400; flex: none; }
