/* ===== Sadovnjak Babno Polje ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark: #2e5e3c;
  --green: #3f7d4f;
  --green-light: #e8f2e6;
  --cream: #faf8f0;
  --line: #dde5d8;
  --text: #2b3a2e;
  --muted: #6b7d6e;
  --blossom: #e05c9a;
  --blossom-bg: #f8d9e8;
  --harvest: #e8862c;
  --harvest-bg: #fbe3c8;
  --red: #c0392b;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--cream);
  font-size: 15px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px;
  background: var(--green-dark);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
}
.brand { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  border: none; background: rgba(255,255,255,0.12); color: #fff;
  padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 14px;
}
.tabs button:hover { background: rgba(255,255,255,0.25); }
.tabs button.active { background: #fff; color: var(--green-dark); font-weight: 600; }

main { padding: 18px 20px 60px; max-width: 1500px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }

h1 { font-size: 22px; color: var(--green-dark); }
h2 { font-size: 17px; color: var(--green-dark); margin-bottom: 8px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.small-note { font-weight: 400; }
.hidden { display: none !important; }
/* every control reserved for the administrator carries .admin-only */
body.not-admin .admin-only { display: none !important; }
code { background: var(--green-light); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--red); border-color: #e6c6c2; }
.btn.danger:hover { background: #fdf0ee; border-color: var(--red); }
.btn.small { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.linklike { border: none; background: none; color: var(--green); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 2px; }

/* ---------- map ---------- */
.map-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.map-hint { flex: 1; text-align: right; min-width: 200px; }
.zoom-ctrl { display: inline-flex; align-items: center; gap: 5px; }
.zoom-ctrl #zoom-val { font-size: 13px; color: var(--muted); min-width: 44px; text-align: center; }
.placing-banner {
  background: #fff6dd; border: 1px solid #eddc9d; color: #7a611b;
  padding: 8px 14px; border-radius: 8px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px; font-weight: 600;
}
.map-wrap {
  overflow: auto; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; height: calc(100vh - 175px); min-height: 420px;
}
/* expand/shrink controls pinned to the four edges of the map (edit mode) */
.map-outer { position: relative; }
.map-size-ctl { position: absolute; z-index: 30; display: flex; gap: 6px; }
.map-size-ctl .btn { background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.2); }
.map-size-ctl.edge-top { top: 8px; left: 50%; transform: translateX(-50%); }
.map-size-ctl.edge-bottom { bottom: 8px; left: 50%; transform: translateX(-50%); }
.map-size-ctl.edge-left { left: 8px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.map-size-ctl.edge-right { right: 8px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.map-size-ctl .drag-handle { touch-action: none; user-select: none; }
.map-size-ctl.edge-top .drag-handle, .map-size-ctl.edge-bottom .drag-handle { cursor: ns-resize; }
.map-size-ctl.edge-left .drag-handle, .map-size-ctl.edge-right .drag-handle { cursor: ew-resize; }
.species-card { cursor: pointer; }
#map-sizer { position: relative; overflow: hidden; }
#map {
  position: relative; transform-origin: 0 0;
  background-color: #f6f9f2;
  background-image:
    linear-gradient(to right, rgba(46,94,60,0.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(46,94,60,0.22) 1px, transparent 1px),
    linear-gradient(to right, rgba(46,94,60,0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(46,94,60,0.10) 1px, transparent 1px);
  background-size: 200px 200px, 200px 200px, 40px 40px, 40px 40px;
}
#map.placing { cursor: crosshair; }

.tree {
  position: absolute; transform: translate(-50%, -55%);
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: none;
}
#map.editing .tree { cursor: grab; }
#map.editing .tree:active { cursor: grabbing; }
.tree .tree-icon { position: relative; width: 48px; height: 48px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25)); }
.tree .tree-icon svg { width: 100%; height: 100%; }
.tree .health-dot {
  position: absolute; top: -4px; right: -6px;
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid #fff; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 13px; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.tree .tree-label {
  margin-top: 2px; background: rgba(255,255,255,0.92);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 1px 8px; font-size: 11px; font-weight: 600; color: var(--green-dark);
  white-space: nowrap;
}
.tree { z-index: 2; }
.tree.selected .tree-icon { outline: 2px dashed #2b6cb0; outline-offset: 2px; border-radius: 50%; }
.tree.selected .tree-label { border-color: #2b6cb0; color: #2b6cb0; background: #eaf2fb; }
.selection-rect {
  position: absolute; z-index: 5; pointer-events: none;
  border: 1.5px dashed #2b6cb0; background: rgba(43,108,176,0.08); border-radius: 4px;
}

/* map objects — a building roof seen from above */
.mapobj {
  position: absolute; z-index: 1;
  background: linear-gradient(180deg, #cb926e 0%, #ba805d 48%, #916144 52%, #a26c4c 100%);
  border: 2px solid #6d4636; border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.mapobj::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: rgba(60,30,15,0.55); transform: translateY(-1px);
}
#map.editing .mapobj { cursor: move; }
.obj-resize {
  position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px;
  background: #fff; border: 2px solid #6d4636; border-radius: 50%;
  cursor: nwse-resize; z-index: 3;
}
.obj-del {
  position: absolute; right: -9px; top: -9px; width: 20px; height: 20px;
  background: var(--red); color: #fff; border: 2px solid #fff; border-radius: 50%;
  text-align: center; line-height: 16px; font-size: 13px; font-weight: 700;
  cursor: pointer; z-index: 3;
}

.map-empty-hint {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%);
  background: #fff; border: 1px dashed var(--green); border-radius: 10px;
  padding: 14px 22px; color: var(--muted); font-size: 14px; text-align: center;
}

/* ---------- cards ---------- */
.cards { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; width: 360px; display: flex; flex-direction: column; gap: 8px;
}
.card .card-head { display: flex; align-items: center; gap: 10px; }
.card .card-head svg { width: 34px; height: 34px; flex-shrink: 0; }
.card .card-title { font-weight: 700; font-size: 16px; color: var(--green-dark); }
.card .card-sub { font-size: 12px; color: var(--muted); }
.card img.card-photo { height: 60px; width: auto; max-width: 100%; object-fit: contain; border-radius: 8px; align-self: center; }
.card .card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  background: var(--green-light); color: var(--green-dark);
  border-radius: 12px; padding: 2px 10px; font-size: 12px; font-weight: 600;
}

/* ---------- forms ---------- */
.form-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; max-width: 860px; margin-bottom: 16px;
}
.form-row { margin-bottom: 16px; }
.form-row > label, .form-row > label > span:first-child { font-weight: 600; font-size: 14px; }
.form-row label { display: block; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input[type="text"], input[type="date"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; margin-top: 5px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(63,125,79,0.35); border-color: var(--green); }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.req { color: var(--red); }

.radio-row { display: flex; gap: 8px; margin-top: 6px; }
.chip-radio {
  display: inline-flex !important; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 18px; padding: 6px 14px;
  cursor: pointer; font-size: 14px; font-weight: 400 !important;
}
.chip-radio:has(input:checked) { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600 !important; }
.chip-radio input { accent-color: #fff; }

.chips-select { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips-select .use-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 18px;
  padding: 6px 15px; cursor: pointer; font-size: 14px;
}
.chips-select .use-chip.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }

.img-upload { display: flex; gap: 14px; align-items: flex-start; margin-top: 8px; }
.img-upload img { max-width: 110px; max-height: 80px; border-radius: 8px; border: 1px solid var(--line); }
.img-upload-btns { display: flex; flex-direction: column; gap: 8px; }
.file-btn { display: inline-block; }

/* ---------- timeline editor ---------- */
.tl-editor { margin-top: 8px; max-width: 720px; }
.tl-months, .tld-months {
  display: grid; grid-template-columns: repeat(12, 1fr);
  font-size: 10.5px; color: var(--muted); text-align: center; margin-bottom: 2px;
}
.tl-cells {
  display: grid; grid-template-columns: repeat(24, 1fr);
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  cursor: pointer; touch-action: none; background: #fff;
}
.tl-cell { height: 26px; border-right: 1px solid #f0f0ea; }
.tl-cell:nth-child(2n) { border-right: 1px solid var(--line); }
.tl-cell:last-child { border-right: none; }
.tl-editor.blossom .tl-cell.sel { background: var(--blossom); }
.tl-editor.harvest .tl-cell.sel { background: var(--harvest); }
.tl-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 3px; }
.tl-label { font-size: 12.5px; color: var(--muted); }

/* ---------- timeline display (calendar, details) ---------- */
.tld { width: 100%; }
.tld-grid {
  position: relative;
  display: grid; grid-template-columns: repeat(24, 1fr); grid-template-rows: 10px 10px;
  gap: 3px 0; padding: 4px 0;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to right, #f2f2ec 1px, transparent 1px);
  background-size: calc(100% / 12) 100%, calc(100% / 24) 100%;
}
.tld-bar { border-radius: 4px; }
.tld-bar.blossom { grid-row: 1; background: var(--blossom); }
.tld-bar.harvest { grid-row: 2; background: var(--harvest); }

.legend { display: flex; gap: 18px; align-items: center; margin-bottom: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.legend-swatch { width: 22px; height: 11px; border-radius: 4px; display: inline-block; }
.legend-swatch.blossom { background: var(--blossom); }
.legend-swatch.harvest { background: var(--harvest); }

/* ---------- analize sort ---------- */
.analyses-layout { display: flex; gap: 16px; align-items: flex-start; margin-top: 14px; flex-wrap: wrap; }
#analyses-list {
  width: 300px; flex-shrink: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  max-height: calc(100vh - 240px); overflow-y: auto;
}
.sp-group {
  font-size: 12px; font-weight: 700; color: var(--green-dark);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 8px 4px;
}
.sp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.sp-row:hover { background: var(--green-light); }
.sp-row.selected { background: var(--green); color: #fff; }
.sp-row.selected .muted, .sp-row.selected .sp-row-name { color: #fff; }
.sp-row.disabled { cursor: default; opacity: 0.55; }
.sp-row.disabled:hover { background: none; }
.sp-row-name { font-weight: 600; color: var(--green-dark); flex: 1; }
.sp-row .muted { font-size: 12px; }
.analysis-view {
  flex: 1; min-width: 320px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px;
  max-height: calc(100vh - 240px); overflow-y: auto;
}
.analysis-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 8px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.analysis-head svg { width: 26px; height: 26px; vertical-align: -6px; margin-right: 4px; }
.analysis-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* species form: fields size to content, user can drag-resize them */
#species-form textarea { resize: vertical; min-height: 38px; }
/* species search — styled like the app's buttons */
.species-search-row { margin: 0 0 16px; }
#sp-search {
  max-width: 380px; width: 100%;
  padding: 10px 18px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
#sp-search:hover { border-color: var(--green); }
/* Chat tab */
.chat-layout { display: flex; gap: 16px; align-items: flex-start; }
#chat-list { width: 260px; flex: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; max-height: calc(100vh - 230px); overflow-y: auto; }
#chat-view { flex: 1; min-width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.chat-list-msgs { max-height: calc(100vh - 380px); min-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 2px; }
.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); }
.chat-msg.user { align-self: flex-end; background: var(--green-light); border-color: transparent; }
.chat-msg.assistant { align-self: flex-start; background: #f6f2e9; }
.chat-msg.pending { color: var(--muted); font-style: italic; }
.chat-md.analysis-report h3 { margin: 10px 0 4px; }
.chat-md.analysis-report h4 { margin: 8px 0 3px; }
.chat-md.analysis-report p { margin: 5px 0; }
.chat-compose { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.chat-compose textarea { flex: 1; resize: vertical; }
/* right-click menu on a tree */
.ctx-menu {
  position: fixed; z-index: 3000; min-width: 230px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22); padding: 6px;
  display: flex; flex-direction: column;
}
.ctx-menu .ctx-title {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 13px; color: var(--green-dark);
  padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.ctx-menu .ctx-title svg { width: 18px; height: 18px; flex: none; }
.ctx-menu button {
  text-align: left; background: none; border: 0; border-radius: 6px;
  padding: 8px 10px; font-size: 14px; cursor: pointer; color: var(--text);
}
.ctx-menu button:hover:not(:disabled) { background: var(--green-light); }
.ctx-menu button.danger { color: #b3402a; }
.ctx-menu button:disabled { cursor: default; opacity: 0.55; }
/* toasts (top-right notifications) */
#toast-wrap {
  position: fixed; top: 16px; right: 16px; z-index: 4000;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  background: #fff; border: 1px solid var(--green); border-radius: 10px;
  padding: 12px 16px; font-size: 14px; line-height: 1.45; color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 1; transition: opacity 0.4s;
}
.toast.gone { opacity: 0; }
.toast-link {
  color: #b35309; font-weight: 600; text-decoration: underline; cursor: pointer;
}
/* suggest-change dialog: species data left, proposal form right
   (.dialog.suggest-dialog so it beats the base .dialog width defined later) */
.dialog.suggest-dialog { width: 1240px; max-width: 96vw; }
.suggest-layout { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; margin-top: 14px; }
.suggest-left, .suggest-right { flex: 1 1 460px; min-width: 320px; }
.suggest-left { max-height: 68vh; overflow-y: auto; padding-right: 14px; border-right: 1px solid var(--line); }
.suggest-row {
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 10px 12px; margin-bottom: 10px;
}
.suggest-row .sug-field { width: 100%; margin-bottom: 8px; }
.suggest-row textarea { width: 100%; min-height: 92px; resize: vertical; margin-bottom: 8px; }
.suggest-row textarea:last-child { margin-bottom: 0; }
/* Predlogi uporabnikov */
.sug-area { font-size: 17px; color: var(--green-dark); margin: 20px 0 10px; }
.sug-card { max-width: 980px; margin-bottom: 14px; }
.sug-table { width: 100%; border-collapse: collapse; margin: 10px 0 6px; }
.sug-table th, .sug-table td { border: 1px solid var(--line); padding: 6px 9px; font-size: 13.5px; text-align: left; vertical-align: top; }
.sug-table th { background: var(--green-light); color: var(--green-dark); }
.sug-status { font-size: 12.5px; }
.sug-status.ok { color: var(--green-dark); font-weight: 600; }
.sug-status.no { color: #b3402a; font-weight: 600; }
/* Sporočila */
.messages-layout { display: flex; gap: 16px; align-items: flex-start; }
#msg-threads { width: 260px; flex: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
#msg-thread-view { flex: 1; min-width: 300px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.msg-list { max-height: calc(100vh - 320px); min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.msg { max-width: 75%; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); }
.msg.mine { align-self: flex-end; background: var(--green-light); border-color: transparent; }
.msg.theirs { align-self: flex-start; background: #f6f2e9; }
.msg-text { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.msg-meta { font-size: 11.5px; color: #7a7a72; margin-top: 3px; }
.msg-compose { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.msg-compose textarea { flex: 1; }
.report-editor {
  width: 100%; min-height: 440px; resize: vertical;
  font-size: 13.5px; line-height: 1.5; margin-top: 10px;
}
.analysis-report h3 { font-size: 17px; color: var(--green-dark); margin: 18px 0 6px; }
.analysis-report h4 { font-size: 14.5px; color: var(--green-dark); margin: 14px 0 4px; }
.analysis-report p { margin: 7px 0; font-size: 14px; line-height: 1.55; }
.analysis-report ul { margin: 6px 0 6px 22px; }
.analysis-report li { font-size: 14px; line-height: 1.55; margin: 3px 0; }

/* calendar rows */
.cal-row { display: grid; grid-template-columns: 210px 1fr; gap: 12px; align-items: center; margin-bottom: 7px; }
.cal-row.head { margin-bottom: 3px; }
.cal-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; color: var(--green-dark); overflow: hidden; }
.cal-name svg { width: 26px; height: 26px; flex-shrink: 0; }
.cal-name .cal-sub { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.cal-section { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }

/* ---------- table (all parameters) ---------- */
.table-wrap {
  overflow: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  max-height: calc(100vh - 220px);
}
table.data { border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th, table.data td {
  padding: 7px 11px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line); border-right: 1px solid #f0f0ea;
  max-width: 240px; overflow-wrap: break-word;
}
table.data th {
  position: sticky; top: 0; z-index: 3;
  background: var(--green-light); color: var(--green-dark);
  white-space: nowrap; font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis;
}
table.data td { overflow: hidden; }
table.data td .cellclamp {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 4; overflow: hidden;
}
.col-resizer {
  position: absolute; top: 0; right: 0; width: 9px; height: 100%;
  cursor: col-resize; touch-action: none;
}
.col-resizer:hover, .col-resizer:active { background: rgba(63,125,79,0.35); }
table.data .name-col {
  position: sticky; left: 0; z-index: 2;
  background: #fff; font-weight: 600; color: var(--green-dark);
  white-space: nowrap; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis;
}
table.data th.name-col { z-index: 4; background: var(--green-light); cursor: default; }
table.data td.name-col:hover { text-decoration: underline; }
table.data tr.type-row td {
  background: #eaf2e6; color: var(--green-dark); font-weight: 700;
  font-size: 13.5px; border-bottom: 1px solid var(--line); cursor: default;
}
table.data tr.type-row td.name-col:hover { text-decoration: none; }
.table-icon svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 5px; }
.health-dot.table-dot {
  position: static; display: inline-block; vertical-align: -3px; margin-right: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

/* ---------- groups ---------- */
.group-card { width: 300px; }
.group-count { margin-left: auto; }
.group-list { display: flex; flex-direction: column; gap: 6px; }
.group-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.group-item svg { width: 24px; height: 24px; flex-shrink: 0; }

/* ---------- orchards ---------- */
.orchard-select {
  width: auto; margin-top: 0; padding: 7px 10px;
  font-weight: 600; color: var(--green-dark); max-width: 260px;
}
.orchard-filter { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.no-orchard { max-width: 520px; margin: 60px auto; padding: 40px 30px; }
.no-orchard h2 { margin-bottom: 10px; }
.no-orchard p { margin-bottom: 18px; }
.orchard-card .card-sub { font-size: 13px; margin-top: 2px; }
.orchard-photo {
  width: 56px; height: 56px; border-radius: 10px; object-fit: cover;
  flex-shrink: 0; border: 1px solid var(--line);
}
.orchard-photo-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: var(--green-light);
}
.dialog.analysis { width: 720px; }
.dlg-section {
  font-size: 16px; color: var(--green-dark);
  margin: 22px 0 4px; padding-top: 14px; border-top: 1px solid var(--line);
}
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--green); color: var(--green);
  font-size: 10.5px; font-weight: 700; font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  cursor: pointer; vertical-align: 1px; margin-left: 4px; user-select: none;
}
.info-icon:hover { background: var(--green-light); }
.info-pop {
  display: block; margin-top: 5px; background: #fdfcf5;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px; font-size: 12.5px; color: var(--muted); font-weight: 400;
}
.doc-upload { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.doc-upload span { font-size: 13.5px; }
.report-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; margin-top: 8px; font-size: 14px;
}
.report-item .report-name { flex: 1; min-width: 200px; color: var(--green-dark); font-weight: 600; text-decoration: none; }
.report-item .report-name:hover { text-decoration: underline; }

/* ---------- modal / drawer ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,35,24,0.45);
  z-index: 100; display: flex; justify-content: flex-end;
}
.modal-backdrop.center { justify-content: center; align-items: center; }
.drawer {
  background: var(--cream); width: 520px; max-width: 94vw; height: 100%;
  overflow-y: auto; padding: 20px; box-shadow: -4px 0 22px rgba(0,0,0,0.25);
}
.dialog {
  background: var(--cream); border-radius: 14px; width: 560px; max-width: 94vw;
  max-height: 92vh; overflow-y: auto; padding: 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.drawer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.drawer-head svg { width: 42px; height: 42px; }
.drawer-head h2 { font-size: 21px; }
.drawer-head .type-name { color: var(--muted); font-size: 13px; }
.drawer-close { margin-left: auto; border: none; background: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.drawer img.detail-photo { max-height: 115px; max-width: 100%; width: auto; object-fit: contain; border-radius: 10px; margin: 10px auto; display: block; }
.detail-section { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.detail-section h3 { font-size: 14px; color: var(--green-dark); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.4px; }
.detail-row { display: flex; gap: 10px; padding: 4px 0; font-size: 14px; }
.detail-row .k { width: 190px; flex-shrink: 0; color: var(--muted); }
.detail-row .v { flex: 1; }
.detail-tl { margin: 6px 0 10px; }
.detail-tl .tl-name { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.health-row { display: flex; align-items: center; gap: 4px; }
.health-pip { width: 15px; height: 15px; border-radius: 50%; background: #e4e4dc; }
.drawer-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- auth ---------- */
.auth-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: var(--cream);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px; overflow-y: auto;
}
.auth-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 30px; width: 480px; max-width: 96vw;
  box-shadow: 0 8px 30px rgba(20,50,25,0.12);
}
.auth-brand { font-size: 21px; font-weight: 700; color: var(--green-dark); text-align: center; margin-bottom: 18px; }
.auth-card h2 { margin-bottom: 14px; text-align: center; }
.auth-btn { width: 100%; padding: 10px; font-size: 15px; margin-top: 4px; }
.auth-switch { margin-top: 16px; text-align: center; }
.auth-error {
  background: #fdf0ee; border: 1px solid #e6c6c2; color: var(--red);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13.5px;
}
.topbar-right {
  margin-left: auto; display: flex; flex-direction: column;
  align-items: flex-end; gap: 6px;
}
.tabs.tabs-mini button { padding: 4px 12px; font-size: 12.5px; }
.user-box { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 13px; }
.user-box .btn { background: rgba(255,255,255,0.15); border-color: transparent; color: #fff; }
.user-box .btn:hover { background: rgba(255,255,255,0.32); }

/* ---------- locked species form (non-admin) ---------- */
input:disabled, select:disabled, textarea:disabled {
  background: #f2f2ec; color: #8a948b; cursor: not-allowed;
}
.chips-select .use-chip:disabled { opacity: 0.55; cursor: not-allowed; }
.tl-editor.locked { pointer-events: none; opacity: 0.55; }
.ai-fetch-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
#ai-status { font-size: 13.5px; }

/* ---------- events & history ---------- */
.event-kind-btns { display: flex; gap: 12px; margin-top: 16px; }
.event-kind-btns .btn { flex: 1; padding: 16px 8px; font-size: 15px; line-height: 1.6; }
.history-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.hist-dialog { width: 900px; max-width: 96vw; }
.hist-table-wrap { overflow-x: auto; }
.hist-table { width: 100%; border-collapse: collapse; }
.hist-table th {
  text-align: left; font-size: 12.5px; color: var(--green-dark);
  padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.hist-table td { padding: 5px 8px 5px 0; vertical-align: middle; }
.hist-table input, .hist-table select { margin-top: 0; padding: 7px 9px; font-size: 14px; }
.hist-table input[type="date"] { width: 150px; min-width: 150px; }
.hist-table input[type="text"] { min-width: 240px; }
.hist-table select { min-width: 135px; }

/* ---------- save indicator ---------- */
#save-indicator {
  position: fixed; bottom: 14px; right: 16px; z-index: 200;
  background: var(--green-dark); color: #fff; border-radius: 16px;
  padding: 5px 14px; font-size: 13px; opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
#save-indicator.show { opacity: 1; }

.empty-state {
  background: #fff; border: 1px dashed var(--line); border-radius: 12px;
  padding: 26px; text-align: center; color: var(--muted); margin-top: 12px;
}

/* ---------- obiranje: kg table + harvest statistics ---------- */
.event-kind-btns { flex-wrap: wrap; }
.harvest-dialog { width: 1100px; max-width: 96vw; }
.harvest-table input[type="number"] { width: 92px; min-width: 92px; text-align: right; }
.harvest-table th.num, .harvest-table td.num,
.stats-table th.num, .stats-table td.num { text-align: right; white-space: nowrap; }
.harvest-table .new-date { background: var(--green-light); }
.harvest-table tfoot td { font-weight: 600; border-top: 1px solid var(--line); padding-top: 8px; }
.stats-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.stats-table tr.lvl-0 td { font-weight: 600; }
.stats-table tr.lvl-1 td:first-child { padding-left: 34px; }
.stats-table tr.lvl-2 td:first-child { padding-left: 64px; }
.stats-table td.total { font-weight: 600; }
.stats-table tfoot td { font-weight: 700; border-top: 2px solid var(--green); border-bottom: 0; }
.stats-table .tog {
  width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 15px; line-height: 1; margin-right: 4px;
}
.stats-table .tog:hover { border-color: var(--green); }
.stats-table svg { width: 18px; height: 18px; vertical-align: -4px; }
.stats-table .linklike { padding: 0; font-size: 14px; }

/* admin: which tabs other users see */
.tabs-pick { flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
/* chat locked until a land analysis exists */
.chat-gate { padding: 36px 20px; }
.chat-gate p { margin: 0 0 10px; font-size: 15px; }
.chat-gate .btn { margin-top: 8px; }

/* unread messages: count pill + amber tab until the thread is opened */
.badge {
  display: inline-block; margin-left: 6px; min-width: 18px; padding: 1px 6px;
  border-radius: 999px; background: #d9480f; color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 16px; text-align: center; vertical-align: 1px;
}
.tabs button.has-unread { background: #f6c453; color: #3b2a00; border-color: #f6c453; }
.tabs button.has-unread:hover { background: #f9d57a; }
.tabs button.has-unread.active { background: #fff3cf; color: #3b2a00; }
#msg-threads .sp-row.unread .sp-row-name { font-weight: 700; color: #b3400f; }
#msg-threads .sp-row.selected.unread .sp-row-name { color: #fff; }

/* the empty-orchard hint carries a real button */
.map-empty-hint { pointer-events: none; }
.map-empty-hint .btn { pointer-events: auto; margin-top: 12px; }

/* pošta autocomplete in the orchard form */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 60; margin-top: 2px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15); max-height: 240px; overflow-y: auto;
}
.ac-item { padding: 7px 10px; cursor: pointer; font-size: 14px; }
.ac-item:hover { background: var(--green-light); }
.ac-code { display: inline-block; min-width: 46px; color: var(--muted); font-variant-numeric: tabular-nums; }
#of-postcode[readonly] { background: #f6f3ea; color: var(--green-dark); font-weight: 600; }
.stats-table .tog-space { display: inline-block; width: 28px; }
