/* FSC-branded light theme — palette taken from fsc.org
   dark green #285c4d, bright green #78be20, orange #ff6d2c */
:root {
  --fsc-green: #285c4d;      /* primary / header */
  --fsc-green-dark: #1e463b;
  --fsc-lime: #78be20;       /* bright accent */
  --fsc-lime-dark: #5f9a15;
  --fsc-orange: #ff6d2c;
  
  --bg: #ffffff;
  --bg-soft: #f4f8ee;        /* light green tint */
  --panel: #ffffff;
  --border: #dcdfd8;
  --text: #333333;
  --muted: #6b7280;
  
  --ok: #78be20;
  --off: #ff6d2c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-soft);
  color: var(--text);
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  font-size: 14px;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header — FSC dark green bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--fsc-green);
  color: #fff;
  border-bottom: 3px solid var(--fsc-lime);
}
.topbar h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
  letter-spacing: .01em;
}
.status { display: flex; align-items: center; gap: 8px; color: #e6efe4; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--fsc-lime); box-shadow: 0 0 0 3px rgba(120,190,32,.25); }
.dot-off { background: var(--fsc-orange); }

/* Filter bar */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.field.grow { flex: 1 1 260px; }
.field label {
  font-size: 11px;
  color: var(--fsc-green);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
}
.field input, .field select {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field input::placeholder { color: #a3aa9c; }
.field input:focus, .field select:focus {
  border-color: var(--fsc-lime);
  box-shadow: 0 0 0 3px rgba(120,190,32,.2);
}
.field select[multiple] { min-height: 34px; max-height: 96px; }
.field select[multiple] option:checked {
  background: var(--fsc-lime) linear-gradient(0deg, var(--fsc-lime), var(--fsc-lime));
  color: #fff;
}

.btn {
  background: var(--fsc-green);
  color: #fff;
  border: 1px solid var(--fsc-green);
  border-radius: 6px;
  padding: 9px 16px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background .12s;
}
.btn:hover { background: var(--fsc-green-dark); border-color: var(--fsc-green-dark); }

.main { flex: 1 1 auto; min-height: 0; background: var(--bg); }
perspective-viewer { width: 100%; height: 100%; }

/* Loading indicator */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.loading.hidden { display: none; }
.loading-content {
  background: var(--panel);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--fsc-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.loading-text {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

/* Detail slide-in */
.detail {
  position: fixed;
  top: 0; right: 0;
  width: min(520px, 92vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(40,92,77,.12);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform .18s ease;
}
.detail.hidden { transform: translateX(105%); }
.detail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--fsc-green);
  color: #fff;
}
.detail-head strong { font-size: 15px; font-weight: 700; }
.detail-body { padding: 14px 18px; overflow-y: auto; }
.btn-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; opacity: .85; }
.btn-close:hover { opacity: 1; }

.overlay {
  position: fixed; inset: 0; background: rgba(30,70,59,.35); z-index: 40;
}
.overlay.hidden { display: none; }
.detail.hidden ~ .overlay { display: none; }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; }
.kv dt { color: var(--fsc-green); font-size: 12px; font-weight: 600; }
.kv dd { margin: 0; word-break: break-word; }
.kv dd.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  background: var(--bg-soft);
  border: 1px solid var(--fsc-lime);
  color: var(--fsc-green-dark);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
}

/* desktop-only: block mobile layout */
.mobile-block { display: none; }
@media (max-width: 860px) {
  .mobile-block {
    display: flex; position: fixed; inset: 0; z-index: 9999;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; text-align: center; padding: 32px;
    background: var(--fsc-green); color: #fff; font-size: 20px; font-weight: 700;
  }
  .mobile-block > div:first-child { font-size: 46px; }
  .mobile-block .mb-sub { font-size: 13px; font-weight: 400; opacity: .9; max-width: 340px; line-height: 1.5; }
}