:root {
  --bg: #070807;
  --panel: #0f1110;
  --panel-2: #141715;
  --line: #1f2421;
  --line-2: #2a302c;
  --text: #e8ece9;
  --muted: #8b938e;
  --dim: #5f6762;
  --accent: #a6dc74;
  --accent-dim: rgba(166, 220, 116, 0.14);
  --warn: #f2c36b;
  --act: #7cc4ff;
  --radius: 14px;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ikoner */
[data-icon] { display: inline-flex; width: 1em; height: 1em; vertical-align: -0.15em; }
[data-icon] svg { width: 100%; height: 100%; }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#0c0e0d, #090a09);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 34px; height: 34px; padding: 8px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  color: var(--accent);
}
.brand h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.brand .sub { margin: 0; font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 6px 12px; color: var(--muted); font-size: 11px;
}
.tabs button [data-icon] { font-size: 16px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); background: var(--panel-2); border-color: var(--line-2); }
.top-right { display: flex; align-items: center; gap: 8px; }
.weather-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; white-space: nowrap;
}
.weather-chip b { font-weight: 600; }
.weather-chip.ask { color: var(--accent); border-color: rgba(166, 220, 116, 0.4); }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line-2);
  font-size: 16px;
}
.icon-btn.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 13px; }
.icon-btn:hover { border-color: #3a423d; }

/* ---------- layout ---------- */
.studio {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 320px;
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 63px);
  min-height: 640px;
}
.col-left, .col-right { display: grid; gap: 12px; min-height: 0; min-width: 0; }
.studio > *, .panel { min-width: 0; }
.col-left { grid-template-rows: minmax(0, 1fr) 210px; }
.col-right { grid-template-rows: minmax(0, 1fr) auto; }
.col-center { display: grid; grid-template-rows: minmax(0, 1fr) 200px; gap: 12px; min-width: 0; min-height: 0; }
.row-bottom { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 12px; min-height: 0; }

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.panel-head > span { display: inline-flex; align-items: center; gap: 6px; }
.count { color: var(--dim); font-weight: 600; letter-spacing: 0.04em; }

/* ---------- vänster: lista ---------- */
.search {
  display: flex; align-items: center; gap: 8px;
  background: #0b0d0c; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 0 10px; color: var(--dim);
}
.search input { flex: 1; background: none; border: 0; outline: 0; padding: 8px 0; min-width: 0; }
.chips { display: flex; gap: 6px; margin: 8px 0 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-2); background: none; color: var(--muted);
  border-radius: 999px; padding: 3px 10px; font-size: 11px;
}
.chip.on { background: var(--accent-dim); color: var(--accent); border-color: rgba(166, 220, 116, 0.35); }
.plant-list { overflow: auto; margin: 0 -6px; padding: 0 6px; flex: 1; scrollbar-width: thin; scrollbar-color: #2a302c transparent; }
.bed-head {
  display: flex; align-items: center; gap: 6px;
  width: 100%; background: none; border: 0; padding: 10px 2px 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  text-align: left;
}
.bed-head .caret { transition: transform 0.15s; color: var(--dim); }
.bed-head.closed .caret { transform: rotate(-90deg); }
.bed-head .n { margin-left: auto; color: var(--dim); }
.p-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 7px 8px; margin: 1px 0;
}
.p-item:hover { background: #141816; }
.p-item.sel { background: #1b1f1d; border-color: #333a36; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); }
.p-item .txt { min-width: 0; flex: 1; }
.p-item .nm { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-item .sb { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-item .fav { color: var(--dim); font-size: 13px; opacity: 0; }
.p-item.sel .fav, .p-item .fav.on { opacity: 1; }
.p-item .fav.on { color: #f4c76b; }
.p-item.planned .nm::after { content: ' · planerad'; color: var(--dim); font-weight: 400; }
.swatch {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative; overflow: hidden;
}
.swatch.lg { width: 44px; height: 44px; border-radius: 10px; }
.swatch::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.25), transparent 55%);
}
.bloom-list { overflow: auto; display: grid; gap: 4px; align-content: start; scrollbar-width: thin; }
.bloom-row { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 2px; text-align: left; border-radius: 6px; }
.bloom-row:hover { background: #141816; }
.bloom-row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.bloom-row span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bloom-row small { color: var(--dim); }

/* ---------- mitten: scen ---------- */
.stage { padding: 0; overflow: hidden; position: relative; background: radial-gradient(ellipse 70% 60% at 50% 62%, #18201b 0%, #0c0e0d 60%, #090a09 100%); }
.stage-head {
  position: absolute; inset: 0 0 auto 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px 20px; pointer-events: none;
}
.stage-head h2 { margin: 0; font-size: clamp(22px, 2.6vw, 36px); font-weight: 800; letter-spacing: -0.01em; text-transform: uppercase; line-height: 1.05; }
.stage-head .latin { margin: 6px 0 0; font-family: var(--serif); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: #b9c0bb; }
.stage-head .meta { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }
.stage-pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; pointer-events: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(12, 14, 13, 0.75); backdrop-filter: blur(6px);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 11px; font-size: 11.5px;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.pill.off i { background: var(--dim); }
.canvas-wrap { position: absolute; inset: 0; }
.canvas-wrap canvas { display: block; cursor: grab; }
.canvas-wrap canvas:active { cursor: grabbing; }
.stage-msg {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: var(--muted); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; padding: 40px;
}
.stage-toolbar {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 14px 16px;
}
.group { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(20, 23, 21, 0.85); backdrop-filter: blur(6px);
  border: 1px solid var(--line-2); border-radius: 8px;
  padding: 6px 10px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: #3c443f; }
.btn.on { background: #e8ece9; color: #0b0c0b; border-color: #e8ece9; }
.btn.danger { color: #ff9b8a; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #0d140a; }

/* säsong */
.months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; flex: 1; min-height: 70px; }
.month {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px;
  background: #0b0d0c; border: 1px solid var(--line); border-radius: 8px; padding: 6px 0;
  font-size: 10.5px; color: var(--muted); overflow: hidden;
}
.month .bar { position: absolute; inset: auto 0 0 0; height: 0; opacity: 0.85; transition: height 0.2s; }
.month.bloom .bar { height: 62%; }
.month span { position: relative; z-index: 1; }
.month.bloom span { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.month.sel { border-color: #e8ece9; box-shadow: 0 0 0 1px #e8ece9; color: var(--text); }
.month.now::before { content: ''; position: absolute; top: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.hint { margin: 8px 0 0; color: var(--dim); font-size: 11px; }

/* grannar */
.tiles { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; flex: 1; scrollbar-width: thin; }
.tile {
  flex: none; width: 96px; display: flex; flex-direction: column; gap: 6px;
  background: #0b0d0c; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: left;
}
.tile:hover { border-color: var(--line-2); }
.tile.sel { border-color: #e8ece9; }
.tile .swatch { width: 100%; height: 48px; }
.tile b { font-size: 11px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile small { color: var(--dim); font-size: 10.5px; }

/* ---------- höger ---------- */
.details { overflow: auto; scrollbar-width: thin; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 10px; font-size: 12px; margin: 0 0 14px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }
.tag { display: inline-block; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; font-size: 11px; color: var(--muted); margin-right: 4px; }
.lvl { display: inline-flex; gap: 3px; vertical-align: middle; }
.lvl i { width: 14px; height: 5px; border-radius: 3px; background: #2a302c; }
.lvl i.on { background: var(--act); }
.lvl.feed i.on { background: var(--accent); }
.sec-title { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 4px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.wiki { display: grid; gap: 8px; font-size: 12px; color: #c9cfcb; }
.wiki img { width: 100%; max-height: 170px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.wiki p { margin: 0; }
.wiki a { color: var(--accent); text-decoration: none; font-size: 11.5px; }
.notes { margin-top: 14px; }
textarea, .field input, .field select {
  width: 100%; background: #0b0d0c; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; outline: 0;
}
textarea { min-height: 70px; resize: vertical; font-size: 12px; }
textarea:focus, .field input:focus, .field select:focus { border-color: #3f4843; }

.form { display: grid; gap: 10px; }
.field { display: grid; gap: 5px; font-size: 11.5px; }
.field > span { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row > * { min-width: 0; }
.month-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.month-pick label { display: block; }
.month-pick input { display: none; }
.month-pick span { display: block; text-align: center; padding: 4px 0; border: 1px solid var(--line-2); border-radius: 6px; font-size: 11px; color: var(--muted); cursor: pointer; }
.month-pick input:checked + span { background: var(--accent-dim); color: var(--accent); border-color: rgba(166, 220, 116, 0.4); }
input[type='color'] { padding: 2px; height: 32px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 5px 10px; font-size: 11.5px; color: var(--muted); }
.seg button.on { background: #e8ece9; color: #0b0c0b; }

/* skötsel */
.care-row { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.care-row:first-child { border-top: 0; padding-top: 0; }
.care-row .ic { font-size: 15px; color: var(--dim); }
.care-row.act .ic { color: var(--act); }
.care-row.watch .ic { color: var(--warn); }
.care-row b { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.rain { display: flex; align-items: flex-end; gap: 3px; height: 44px; margin: 4px 0 2px; }
.rain i { flex: 1; background: #3b6f9a; border-radius: 2px 2px 0 0; min-height: 2px; }
.rain i.f { background: #26465f; }
.rain-legend { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); }
.status { display: flex; align-items: center; gap: 7px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* platshållare */
.placeholder { padding: 12px; height: calc(100vh - 63px); }
.big-empty { height: 100%; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.big-empty > [data-icon] { font-size: 34px; color: var(--dim); }
.big-empty h2 { margin: 0; font-size: 22px; }
.big-empty p { margin: 0; color: var(--muted); max-width: 440px; }

/* dialog */
.dialog { border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel-2); color: var(--text); padding: 0; width: min(460px, 92vw); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.dialog-inner { padding: 16px; display: grid; gap: 16px; }

/* ---------- mindre skärmar ---------- */
@media (max-width: 1180px) {
  .studio { grid-template-columns: 240px minmax(0, 1fr); height: auto; }
  .col-right { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .col-center { grid-template-rows: 62vh auto; }
  .row-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .tabs { order: 3; width: 100%; justify-content: space-between; margin: 0; }
  .tabs button { flex: 1; }
  .top-right { margin-left: auto; }
  .weather-chip .wtxt { display: none; }
  .studio { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .col-left { grid-template-rows: 340px auto; order: 2; }
  .col-center { order: 1; grid-template-rows: 58vh auto; }
  .col-right { order: 3; grid-template-columns: 1fr; }
  .stage-head { flex-direction: column; gap: 8px; }
  .stage-pills { justify-content: flex-start; }
  .stage-head h2 { font-size: 22px; overflow-wrap: anywhere; }
  .months { gap: 2px; }
  .month { font-size: 9.5px; }
  .stage-toolbar .btn { padding: 6px 8px; }
}

/* ---------- kalender ---------- */
.tabs button { position: relative; }
.badge {
  position: absolute; top: 2px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #f0a868; color: #1a1208; font-size: 10px; font-weight: 700; line-height: 16px;
}
.cal {
  display: grid; gap: 12px; padding: 12px;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-rows: minmax(520px, 1fr) auto;
  min-height: calc(100vh - 63px);
}
.cal-main { grid-column: 1; grid-row: 1; }
.cal-list { grid-column: 2; grid-row: 1 / span 2; overflow: auto; }
.cal-suggest { grid-column: 1; grid-row: 2; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head h2 { margin: 0 6px; font-size: 22px; font-weight: 800; text-transform: capitalize; min-width: 180px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(84px, 1fr); gap: 4px; flex: 1; }
.cal-grid .wd { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); padding: 0 6px; align-self: end; }
.cal-grid { grid-template-rows: 22px; }
.day {
  background: #0b0d0c; border: 1px solid var(--line); border-radius: 9px; padding: 5px;
  display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; overflow: hidden;
}
.day:hover { border-color: var(--line-2); }
.day.out { opacity: 0.38; }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.dnum { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.day.today .dnum { color: var(--accent); }
.wx { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 500; color: #7cc4ff; }
.wx b { color: var(--dim); font-weight: 500; margin-left: 3px; }
.wx.frost { color: #b8c2ff; }
.dchip {
  display: flex; align-items: center; gap: 4px; width: 100%;
  border: 0; border-left: 3px solid var(--c); border-radius: 4px; padding: 2px 5px;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--text);
  font-size: 10.5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dchip svg { flex: none; width: 10px; height: 10px; }
.dchip.done { opacity: 0.5; text-decoration: line-through; }
.more { font-size: 10px; color: var(--dim); }

.tlist { display: grid; gap: 6px; align-content: start; }
.trow { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #0b0d0c; }
.trow.done .ttitle, .trow.skipped .ttitle { text-decoration: line-through; color: var(--muted); }
.trow.done, .trow.skipped { opacity: 0.7; }
.tcheck {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #4a524d; background: none;
  display: grid; place-items: center; color: transparent; font-size: 14px; padding: 0;
}
.tcheck:hover { border-color: var(--accent); color: var(--accent); }
.tcheck.on { background: var(--accent); border-color: var(--accent); color: #0d140a; }
.ttitle { font-weight: 600; font-size: 13px; }
.tmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; }
.tchip { display: inline-flex; align-items: center; gap: 4px; color: var(--c); font-size: 11px; font-weight: 500; }
.tdate { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.tbad { color: #f0a868; font-weight: 600; }
.tplants { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.plink { border: 1px solid var(--line-2); background: none; border-radius: 6px; padding: 1px 7px; font-size: 11px; color: var(--muted); }
.plink:hover { color: var(--text); border-color: #3c443f; }
.thint { margin-top: 5px; font-size: 11.5px; color: var(--muted); font-style: italic; }
.tacts { display: flex; flex-direction: column; gap: 4px; }
.icon-btn.on { color: #f4c76b; border-color: rgba(244, 199, 107, 0.4); }
.empty { padding: 8px 2px; }

.sg-group + .sg-group { margin-top: 14px; }
.sg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.sg { border: 1px solid var(--line); border-top: 2px solid var(--c); border-radius: 10px; padding: 10px 12px; background: #0b0d0c; display: flex; flex-direction: column; gap: 6px; }
.sg.missed { border-top-color: #f0a868; }
.sg-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.sg-ic { color: var(--c); display: inline-flex; font-size: 14px; }
.sg-when { margin-left: auto; font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.sg p { margin: 0; font-size: 11.5px; color: var(--muted); }
.sg-acts { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.btn.sm { padding: 4px 9px; font-size: 11px; }

/* uppgiftsdialog */
.dialog.wide { width: min(560px, 94vw); }
.dialog form { max-height: 88vh; overflow: auto; }
.pp-list { max-height: 190px; overflow: auto; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; background: #0b0d0c; }
.pp-bed { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin: 8px 0 3px; }
.pp-bed:first-child { margin-top: 0; }
.pp { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 2px 0; }
.pp input { width: auto; }

/* uppgifter i växtvyn */
.ptasks { display: grid; gap: 4px; margin-bottom: 14px; }
.ptask { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 2px; text-align: left; border-radius: 6px; font-size: 12px; }
.ptask:hover { background: #141816; }
.ptask i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ptask span { flex: 1; }
.ptask small { color: var(--dim); }
.ptask.done span { text-decoration: line-through; color: var(--muted); }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #1a1e1c; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); font-size: 12.5px; animation: tin 0.25s ease-out;
}
.toast > div { flex: 1; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

@media (max-width: 1100px) {
  .cal { grid-template-columns: 1fr; grid-template-rows: auto; }
  .cal-main, .cal-list, .cal-suggest { grid-column: 1; grid-row: auto; }
  .cal-list { max-height: none; }
}
@media (max-width: 760px) {
  .cal { padding: 8px; gap: 8px; }
  .cal-head h2 { min-width: 0; font-size: 18px; }
  .cal-grid { grid-auto-rows: minmax(54px, auto); gap: 2px; }
  .day { padding: 3px; }
  .dchip { font-size: 0; padding: 0; height: 5px; border-left-width: 0; background: var(--c); }
  .dchip svg { display: none; }
  .wx b { display: none; }
  .badge { right: 2px; }
}

/* ---------- karta ---------- */
.mapv { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; padding: 12px; height: calc(100vh - 63px); min-height: 600px; }
.map-panel { padding: 0; position: relative; overflow: hidden; }
#map { position: absolute; inset: 0; background: #0b0d0c; }
#map.drawing, #map.drawing .leaflet-interactive { cursor: crosshair !important; }
.map-tools { position: absolute; top: 12px; left: 12px; z-index: 500; display: flex; gap: 6px; flex-wrap: wrap; }
.map-draw {
  position: absolute; top: 56px; left: 12px; right: 12px; z-index: 500; margin: 0 auto; max-width: 640px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: rgba(16, 19, 17, 0.92); backdrop-filter: blur(6px); border: 1px solid rgba(166, 220, 116, 0.4);
  border-radius: 12px; padding: 10px 12px; font-size: 12.5px;
}
.map-bottom {
  position: absolute; left: 12px; bottom: 12px; z-index: 500; display: grid; gap: 6px;
  background: rgba(12, 14, 13, 0.85); backdrop-filter: blur(6px); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 10px;
  max-width: calc(100% - 90px);
}
.map-months { display: flex; gap: 3px; flex-wrap: wrap; }
.map-months button { border: 1px solid var(--line-2); background: none; color: var(--muted); border-radius: 6px; padding: 3px 7px; font-size: 11px; position: relative; }
.map-months button.on { background: #e8ece9; color: #0b0c0b; border-color: #e8ece9; }
.map-months button.now::after { content: ''; position: absolute; top: 2px; right: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.map-side { overflow: auto; }
.mres-list { display: grid; gap: 4px; margin-top: 6px; }
.mres { text-align: left; background: #0b0d0c; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 11.5px; color: var(--muted); }
.mres:hover { color: var(--text); border-color: var(--line-2); }
.map-list { margin-top: 8px; display: grid; gap: 2px; align-content: start; }
.mbed { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mbed .btn { text-transform: none; letter-spacing: 0; font-weight: 500; }
.btn.ghost { background: none; color: var(--muted); }
.mitem { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 8px; border: 1px solid transparent; }
.mitem[draggable='true'] { cursor: grab; }
.mitem:hover { background: #141816; border-color: var(--line); }
.mdot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1px solid rgba(255, 255, 255, 0.2); }
.mname { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 500; display: grid; }
.mname small { font-size: 10.5px; color: var(--dim); font-weight: 400; }
.mitem.placed .mname small { color: var(--accent); }

/* Leaflet i mörkt tema */
.leaflet-container { font: 12px/1.4 var(--sans); background: #0b0d0c; }
.leaflet-control-zoom a, .leaflet-bar a { background: #141715 !important; color: var(--text) !important; border-color: var(--line-2) !important; }
.leaflet-control-attribution { background: rgba(10, 11, 10, 0.7) !important; color: var(--dim) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-control-scale-line { background: rgba(10, 11, 10, 0.7); color: var(--text); border-color: var(--muted); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #161a18; color: var(--text); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.mpop { display: grid; gap: 3px; min-width: 200px; }
.mpop b { font-size: 13px; }
.mpop i { color: var(--muted); font-family: var(--serif); font-size: 13px; }
.mpop span { color: var(--muted); font-size: 11.5px; }
.mpop-acts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.pin i { display: block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.leaflet-tooltip.plant-label, .leaflet-tooltip.bed-label {
  background: rgba(10, 12, 11, 0.78); color: #fff; border: 0; border-radius: 6px; padding: 2px 6px; font-size: 11px; box-shadow: none;
}
.leaflet-tooltip.plant-label::before { display: none; }
.leaflet-tooltip.bed-label { background: none; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 10.5px; text-shadow: 0 1px 3px #000; }
#map.far .leaflet-tooltip.plant-label { display: none; }

@media (max-width: 1100px) {
  .mapv { grid-template-columns: 1fr; height: auto; }
  .map-panel { height: 70vh; }
}
@media (max-width: 760px) {
  .mapv { padding: 8px; gap: 8px; }
  .map-panel { height: 64vh; }
  .map-bottom { max-width: calc(100% - 70px); }
  .map-months button { padding: 3px 5px; }
}

/* ---------- dashboard ---------- */
.dash { padding: 12px; display: grid; gap: 12px; align-content: start; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px; min-width: 0; }
.kpi span { font-size: 11px; color: var(--muted); }
.kpi b { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.kpi b small { font-size: 15px; font-weight: 600; color: var(--muted); }
.kpi > small { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .warnx { color: #f0a868; }
.dgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dcard { position: relative; }
.bloomcard { grid-column: span 2; grid-row: span 2; }
.dhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.dlabel { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.dhead h3 { margin: 4px 0 0; font-size: 15px; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.dsel { background: #0b0d0c; border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 8px; font-size: 11.5px; }
.dchart { position: relative; height: 200px; flex: none; }
.dchart.auto { height: auto; }
.dnote { margin: 6px 0 0; font-size: 11px; color: var(--dim); }
.dchart svg { display: block; overflow: visible; }
.dtablewrap { display: none; overflow: auto; max-height: 420px; }
.dcard.show-table .dchart { display: none; }
.dcard.show-table .dtablewrap { display: block; }
.dtable { width: 100%; border-collapse: collapse; font-size: 12px; }
.dtable th, .dtable td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.dtable th { color: var(--muted); font-weight: 600; font-size: 11px; }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dchart .grid { stroke: #1f2421; stroke-width: 1; }
.dchart .base { stroke: #3a423d; stroke-width: 1; }
.dchart .tick { fill: var(--dim); font-size: 10px; }
.dchart .xl { fill: var(--muted); font-size: 10px; }
.dchart .xl.now { fill: var(--text); font-weight: 700; }
.dchart .dl { fill: var(--text); font-size: 10.5px; font-weight: 600; }
.dchart .nowline { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; }
.dchart .cross { stroke: var(--muted); stroke-width: 1; }
.dchart .hit.on { fill: rgba(255, 255, 255, 0.04); }
.clegend { display: flex; gap: 14px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.clegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ctip {
  position: absolute; z-index: 5; transform: translate(-50%, -100%); pointer-events: none;
  background: #1c201e; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; font-size: 11.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); white-space: nowrap; display: grid; gap: 2px;
}
.ctip span { color: var(--muted); font-size: 10.5px; }
.ctip div { display: flex; align-items: center; gap: 6px; }
.ctip i { width: 8px; height: 8px; border-radius: 2px; }
.ctip b { margin-left: auto; padding-left: 10px; font-variant-numeric: tabular-nums; }
.hb { display: grid; grid-template-columns: minmax(90px, 40%) 1fr 28px; align-items: center; gap: 8px; padding: 4px 0; font-size: 12px; }
.hl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht { height: 12px; background: #0b0d0c; border-radius: 4px; overflow: hidden; }
.ht i { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.hb b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* blomningskalender */
.dchart.bloomwrap { display: flex; flex-direction: column; height: auto; flex: 1; min-height: 0; }
.bhead, .brow { display: grid; grid-template-columns: minmax(130px, 210px) repeat(12, minmax(0, 1fr)); align-items: center; }
.bhead { font-size: 10px; color: var(--dim); text-align: center; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.bhead .now { color: var(--text); font-weight: 700; }
.brows { overflow: auto; flex: 1; max-height: 560px; scrollbar-width: thin; }
.brow { width: 100%; background: none; border: 0; padding: 0; text-align: left; height: 22px; }
.brow:hover { background: #141816; }
.bn { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; color: var(--text); }
.bc { height: 100%; display: flex; align-items: center; position: relative; }
.bc.now { background: rgba(166, 220, 116, 0.07); }
.bc i { display: block; width: 100%; height: 10px; margin: 0 -1px; }
.bc i.l { border-top-left-radius: 5px; border-bottom-left-radius: 5px; margin-left: 3px; }
.bc i.r { border-top-right-radius: 5px; border-bottom-right-radius: 5px; margin-right: 3px; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .dash { padding: 8px; gap: 8px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi b { font-size: 24px; }
  .dgrid { grid-template-columns: 1fr; gap: 8px; }
  .bloomcard { grid-column: auto; grid-row: auto; }
  .bhead, .brow { grid-template-columns: 96px repeat(12, minmax(0, 1fr)); }
  .bhead span { font-size: 8.5px; }
  .dhead { flex-direction: column; }
}

#mapMsg.blocked { z-index: 600; background: rgba(11, 13, 12, 0.96); color: var(--text); text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.5; max-width: none; }
#map.blocked .leaflet-pane, #map.blocked .leaflet-control-container { display: none; }

/* planvy */
.seg.layers { background: rgba(20, 23, 21, 0.85); backdrop-filter: blur(6px); }
.seg.layers button { padding: 6px 11px; font-size: 11.5px; font-weight: 500; }
.opacity {
  display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px;
  background: rgba(20, 23, 21, 0.85); backdrop-filter: blur(6px); border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 10px;
}
.opacity input { width: 120px; accent-color: var(--accent); }
.opacity b { font-weight: 600; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
#map.plan { background: #0e110f; background-image: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px); background-size: 32px 32px; }
.plan-status { display: block; margin-top: 8px; line-height: 1.45; }
.sdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1px solid; }
#surfList { margin-top: 6px; }
