:root {
  --bg: #f6f1ea;
  --paper: #fffdf9;
  --ink: #1c1a17;
  --muted: #6f675d;
  --line: #e4dccf;
  --accent: #0f5c4a;
  --accent-soft: #dcebe5;
  --ok: #1f7a4d;
  --ok-soft: #e1f2e8;
  --warn: #a86a00;
  --warn-soft: #fbefd6;
  --bad: #b3261e;
  --bad-soft: #f9e1de;
  --radius: 16px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 68px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--accent); }
.boot { display: grid; place-items: center; height: 100vh; font-family: var(--serif); font-size: 28px; color: var(--muted); }

/* ---------- schelet ---------- */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.top h1 { margin: 0; flex: 1; font: 600 26px/1.1 var(--serif); letter-spacing: -0.01em; }
.top .back { margin-left: -8px; }
main { padding: 4px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); max-width: 760px; margin: 0 auto; }
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h);
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600;
}
.nav a svg { width: 26px; height: 26px; }
.nav a.on { color: var(--accent); }

/* ---------- elemente ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border: 0; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 650; font-size: 17px; cursor: pointer;
  text-decoration: none; user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; }
.btn.accent { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; color: var(--ink); }
.icon-btn svg { width: 24px; height: 24px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
h2 { font: 600 21px/1.2 var(--serif); margin: 26px 0 10px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 0 8px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.18); flex: none; display: inline-block; }
.dot.multicolor { background: conic-gradient(#c62828, #f2c94c, #2e7d32, #2f5fb3, #6a3d9a, #c62828) !important; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-family: var(--serif); font-size: 20px; margin-bottom: 6px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: #6b4500; font-size: 14px; }
.notice.info { background: var(--accent-soft); color: var(--accent); }

/* formulare */
label.f { display: block; }
label.f > span { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin: 0 0 5px 2px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper);
  font-size: 17px; outline: none; appearance: none; -webkit-appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236f675d' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }

/* chips (categorii, culori) */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip small { opacity: 0.6; font-weight: 600; }
.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }

/* grila de piese */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tile { position: relative; display: block; border-radius: 14px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); aspect-ratio: 3 / 4; text-decoration: none; color: inherit; cursor: pointer; padding: 0; width: 100%; text-align: left; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .ph { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; padding: 10px; gap: 4px; font-size: 13px; line-height: 1.25; }
.tile .ph .dot { width: 34px; height: 34px; margin-bottom: auto; margin-top: 4px; }
.tile .code { position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 8px; background: rgba(255, 255, 255, 0.92); font-size: 12px; font-weight: 750; }
.tile.dat { opacity: 0.45; }
.tile .sel { position: absolute; inset: 0; border: 4px solid var(--accent); border-radius: 14px; display: none; }
.tile.selected .sel { display: block; }
.tile .tick { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: none; place-items: center; font-weight: 800; }
.tile.selected .tick { display: grid; }
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.strip .tile { flex: none; width: 84px; }

/* listă cu bife */
.list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 60px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .txt { flex: 1; min-width: 0; }
.li .txt small { display: block; color: var(--muted); }
.li.done .txt { text-decoration: line-through; color: var(--muted); }
.box { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--line); background: var(--paper); display: grid; place-items: center; cursor: pointer; padding: 0; }
.li.done .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.tier-head { display: flex; align-items: baseline; justify-content: space-between; }

/* poze încărcate */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shot { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--line); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot button { position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 18px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 96px; border-radius: 16px; border: 2px dashed var(--line); background: var(--paper); font-weight: 650; cursor: pointer; }
.pick label svg { width: 30px; height: 30px; }
.pick input { display: none; }

/* verdict */
.verdict { border-radius: 20px; padding: 18px; text-align: center; }
.verdict .big { font: 700 38px/1 var(--serif); letter-spacing: -0.01em; }
.verdict p { margin: 8px 0 0; }
.verdict.iau { background: var(--ok-soft); color: var(--ok); }
.verdict.gandeste { background: var(--warn-soft); color: var(--warn); }
.verdict.las { background: var(--bad-soft); color: var(--bad); }
.rules .r { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.rules .r:first-child { border-top: 0; }
.st { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.st.ok { background: var(--ok-soft); color: var(--ok); }
.st.warn, .st.atentie, .st.doar_daca { background: var(--warn-soft); color: var(--warn); }
.st.fail, .st.nu { background: var(--bad-soft); color: var(--bad); }
.st.na { background: #eee; color: #999; }
.rules b { display: block; font-size: 15px; }
.rules small { color: var(--muted); }
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fit div { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 14px; }
.fit div b { display: flex; align-items: center; gap: 6px; text-transform: capitalize; }

/* rezultate stil */
.piece { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.piece:first-child { border-top: 0; }
.piece .thumb { flex: none; width: 64px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--bg); display: grid; place-items: center; }
.piece .thumb img { width: 100%; height: 100%; object-fit: cover; }
.piece .body { flex: 1; min-width: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 750; }
.tag.am { background: var(--ok-soft); color: var(--ok); }
.tag.apropiat { background: var(--warn-soft); color: var(--warn); }
.tag.lipseste { background: var(--bad-soft); color: var(--bad); }

/* foaie de jos (sheet) */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(20, 16, 12, 0.42); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 10px 16px calc(env(safe-area-inset-bottom) + 20px); animation: up 0.2s ease-out; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { margin-top: 4px; }
@keyframes up { from { transform: translateY(40px); opacity: 0.5; } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
#toast.show { opacity: 1; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.btn.ghost .spinner, .btn.soft .spinner, .loading .spinner { border-color: var(--line); border-top-color: var(--accent); }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 28px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

.big-photo { border-radius: 18px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.big-photo img { width: 100%; max-height: 60vh; object-fit: contain; background: #fff; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gallery .g { position: relative; border-radius: 14px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); aspect-ratio: 3 / 4; }
.gallery .g img { width: 100%; height: 100%; object-fit: cover; }
.gallery .g .heart { position: absolute; right: 6px; bottom: 6px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); font-size: 20px; }
.gallery .g .state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 12px; color: var(--muted); font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px 0 8px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); font-size: 14px; font-weight: 600; cursor: pointer; }
.swatch.on { border-color: var(--ink); background: var(--ink); color: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t td, table.t th { padding: 8px 6px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.scroll-x { overflow-x: auto; }
.stat { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
.stat b { color: var(--ink); font-size: 17px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: 100%; max-width: 380px; padding: 28px 22px; }
.login h1 { font: 600 34px/1 var(--serif); margin: 0 0 6px; }
@media (min-width: 700px) {
  .items { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}
.tile .ph .dot { margin-top: 30px; }
#cabin-result, #style-result, #previews { scroll-margin-top: 80px; }
