* { box-sizing: border-box; }

/* Inline display-stílar mega aldrei yfirskrifa hidden attribute */
[hidden] { display: none !important; }

:root {
  --bg: #f6f4f0;
  --card: #ffffff;
  --ink: #262220;
  --muted: #8a8177;
  --line: #e5dfd6;
  --accent: #9c6b3f;
  --accent-dark: #7d5330;
  --danger: #b3452f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(38, 34, 32, 0.08), 0 6px 20px rgba(38, 34, 32, 0.05);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px 60px; }

/* ---------- Haus ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}
.brand .tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
}
.topbar-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar-title h1 { font-size: 17px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }

/* ---------- Takkar og form ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: #3d3733; }
.btn:active { transform: scale(0.98); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: #efeae3; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.danger:hover { background: #f9ece8; }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: var(--accent-dark); }

input[type="text"], input[type="number"], input[type="search"],
input[type="email"], input[type="password"], input[type="tel"], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid rgba(156, 107, 63, 0.35); border-color: var(--accent); }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin: 12px 0 4px; }
textarea { resize: none; }

/* Hreinn skráaval-takki — felum ljóta native „Choose file" ---------- */
.filepick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.filepick-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.filepick-btn:hover { background: #efeae3; border-color: #d8cfc2; }
.filepick-btn input[type="file"] { display: none; }
.filepick .fname { font-size: 13px; color: var(--muted); }
.filepick .fname.set { color: var(--accent-dark); font-weight: 600; }

/* Haus fyrir eina-fyrirtækis stjórnun ---------- */
.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.company-head h2 { margin: 3px 0 6px; font-size: 24px; }
.company-head .lead { margin: 0 0 16px; font-size: 14px; color: #4c453f; max-width: 620px; }
.company-head a.inline { color: var(--accent-dark); font-weight: 600; text-decoration: underline; }

/* ---------- Spjöld ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.panel h2 { margin: 0 0 8px; font-size: 16px; }
.panel p { margin: 6px 0; font-size: 14px; color: #4c453f; }
.hint { color: var(--muted); font-size: 12.5px; }

.section-title { margin: 34px 0 14px; font-size: 20px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.card:hover, .card.clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(38, 34, 32, 0.1), 0 14px 34px rgba(38, 34, 32, 0.09);
}
.card-body { padding: 14px 16px 16px; }
.card-body h3 { margin: 0 0 2px; font-size: 15.5px; }
.card-body .meta { color: var(--muted); font-size: 13px; }
.card-actions { display: flex; gap: 8px; padding: 0 16px 16px; flex-wrap: wrap; }

.price { color: var(--accent-dark); font-weight: 700; font-size: 14px; }

.thumb {
  height: 210px;
  background: linear-gradient(180deg, #fbfaf8, #f0ece5);
  border-bottom: 1px solid var(--line);
}
.thumb model-viewer {
  width: 100%;
  height: 100%;
  pointer-events: none;
  --poster-color: transparent;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 50px 20px;
  font-size: 15px;
}

.error-msg { color: var(--danger); font-size: 13.5px; margin-top: 8px; min-height: 18px; }

.searchbar { position: relative; flex: 1; max-width: 380px; }
.searchbar input { padding-left: 36px; }
.searchbar::before {
  content: "🔍";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.55;
}

/* ---------- Viewer síða ---------- */
.viewer-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  height: calc(100vh - 61px);
}
.viewer-stage { position: relative; background: var(--bg); }
.viewer-stage model-viewer { width: 100%; height: 100%; --poster-color: transparent; }
.viewer-side {
  padding: 28px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.viewer-side h2 { font-size: 16px; margin: 0; }
.viewer-side p { font-size: 14px; color: #4c453f; margin: 0; }
#qr-panel img { display: block; }
.dims { font-size: 13px; color: var(--muted); }
#qr { border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; margin: 8px 0; }

.ar-btn {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(38, 34, 32, 0.3);
}

/* Alvöru <a rel="ar"> hnappur á iOS — img er raunverulegt barn, textinn úr ::after */
a.ar-native { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
a.ar-native img { width: 20px; height: 20px; object-fit: contain; border-radius: 4px; }
a.ar-native::after { content: "Skoða í þínu rými (AR)"; }

@media (max-width: 860px) {
  .viewer-main { grid-template-columns: 1fr; height: auto; }
  .viewer-stage { height: 62vh; }
  .viewer-side { border-left: none; border-top: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr !important; }
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.form-actions { margin-top: 18px; display: flex; align-items: center; gap: 12px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .name { font-weight: 600; font-size: 14.5px; }
.list-row .meta { color: var(--muted); font-size: 12.5px; }
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.ok { color: #2e6b45; border-color: #bcd8c6; background: #eef7f1; }
