:root {
  --bg: #0b0e14;
  --panel: #12161f;
  --panel-2: #171c27;
  --text: #eef1f6;
  --muted: #7c8594;
  --line: #232b3a;
  --accent: #facc15;
  --good: #22c55e;
  --bad: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(250, 204, 21, 0.07), transparent 60%),
    radial-gradient(900px 500px at 50% 110%, rgba(34, 197, 94, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  padding: 16px;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.app {
  width: 100%;
  max-width: 460px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 14px 4px calc(24px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.app[hidden] { display: none !important; }

/* ---------- login ---------- */
.login-screen[hidden] { display: none !important; }

.login-screen {
  width: 100%;
  max-width: 460px;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 34px 26px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
}

.login-dot {
  width: 34px;
  height: 34px;
}

.login-card h1 {
  font-size: 20px;
  letter-spacing: 4px;
  font-weight: 800;
}

.login-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: -6px;
}

.login-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.login-input:focus { border-color: var(--accent); }

.login-error {
  font-size: 12px;
  color: #f87171;
  text-align: center;
}

.login-btn { width: 100%; margin: 4px 0 0; }

/* ---------- top bar ---------- */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-right {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.settings-btn:hover { color: var(--accent); border-color: var(--accent); }

/* desktop only */
@media (hover: none), (pointer: coarse) {
  .settings-btn { display: none; }
}

.notif-btn {
  width: 34px;
  height: 34px;
  align-self: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.notif-btn:hover { color: var(--accent); border-color: var(--accent); }

.notif-btn[hidden] { display: none !important; }

.user-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.logout-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.logout-btn:hover { color: #f87171; border-color: rgba(239, 68, 68, 0.4); }

/* ---------- top bar ---------- */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar h1 {
  font-size: 15px;
  letter-spacing: 3px;
  font-weight: 800;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.tab {
  flex: 1;
  padding: 11px 0;
  border: none;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: linear-gradient(180deg, #2a3346, #202837);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tab:active { transform: scale(0.97); }

/* ---------- panels ---------- */
.panel[hidden] { display: none !important; }

.panel.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 70px 20px;
  text-align: center;
}

.empty-icon { font-size: 46px; }

.empty-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
}

.empty-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- map ---------- */
.panel.map-panel {
  padding: 0;
  height: 62dvh;
  min-height: 320px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
}

.map-style-btn {
  align-self: flex-end;
  margin-top: -6px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.map-style-btn:hover { border-color: var(--accent); color: var(--accent); }
.map-style-btn[hidden] { display: none !important; }

#map {
  width: 100%;
  height: 100%;
  background: var(--panel);
}

.map-details {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1000;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.map-details-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.md-value {
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.md-level {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.md-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}

.md-place {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
}

.md-time {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.md-delete {
  width: 100%;
  margin-top: 14px;
  padding: 10px 0;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
}

.md-delete:active { transform: scale(0.98); }

#map .leaflet-control-attribution {
  font-size: 9px;
  background: rgba(11, 14, 20, 0.75);
  color: var(--muted);
}

#map .leaflet-control-attribution a { color: var(--accent); }

.map-pin {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  font-size: 15px;
  font-weight: 800;
  color: #0b0e14;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.map-pin-badge {
  width: 14px;
  height: 14px;
  position: absolute;
  bottom: -4px;
  right: -4px;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ---------- gauge ---------- */
.panel[data-panel="meter"] {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.gauge-wrap { width: 100%; max-width: 400px; }

.gauge { width: 100%; display: block; filter: drop-shadow(0 0 26px rgba(250, 204, 21, 0.08)); }

.track {
  fill: none;
  stroke: var(--line);
  stroke-width: 22;
  stroke-linecap: round;
}

.progress {
  fill: none;
  stroke: url(#arcGrad);
  stroke-width: 22;
  stroke-linecap: round;
  transition: stroke-dasharray 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.45));
}

.needle {
  stroke: #eef1f6;
  stroke-width: 5;
  stroke-linecap: round;
  transform-origin: 200px 200px;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.pivot {
  fill: var(--panel-2);
  stroke: var(--line);
  stroke-width: 2;
}

.pivot-core {
  fill: var(--accent);
  filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.8));
}

.tick {
  stroke: var(--line);
  stroke-width: 3;
  stroke-linecap: round;
}

.tick.major { stroke: #3a4456; stroke-width: 4; }

/* ---------- readout ---------- */
.value {
  font-size: 68px;
  font-weight: 800;
  line-height: 1;
  margin-top: 4px;
  background: linear-gradient(180deg, #ffffff, #aab3c2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.level {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 4px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--accent);
  transition: color 0.3s, border-color 0.3s;
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn {
  flex: 0 0 auto;
  width: 64px; height: 64px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: transform 0.1s, border-color 0.2s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.92); }
.btn:hover { border-color: #3a4456; }

.minus-glyph, .plus-glyph { position: absolute; inset: 0; margin: auto; }

.minus-glyph {
  width: 26px; height: 4px;
  border-radius: 2px;
  background: var(--text);
}

.plus-glyph::before, .plus-glyph::after {
  content: "";
  position: absolute;
  inset: 0; margin: auto;
  border-radius: 2px;
  background: var(--text);
}

.plus-glyph::before { width: 26px; height: 4px; }
.plus-glyph::after { width: 4px; height: 26px; }

/* slider */
.slider-wrap { flex: 1; min-width: 0; }

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent);
  box-shadow: 0 2px 10px rgba(0,0,0,0.5), 0 0 12px rgba(250, 204, 21, 0.5);
}

.slider::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent);
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* save button */
.save-btn {
  width: 220px;
  max-width: 100%;
  padding: 13px 0;
  margin: 10px auto 0;
  display: block;
  border: none;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #0b0e14;
  background: linear-gradient(180deg, #fde047, #facc15);
  cursor: pointer;
  transition: transform 0.1s, filter 0.2s;
}

.save-btn:hover { filter: brightness(1.06); }
.save-btn:active { transform: scale(0.97); }
.save-btn.saved { background: linear-gradient(180deg, #4ade80, #22c55e); }

/* ---------- list ---------- */
.list-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.filters {
  display: flex;
  gap: 8px;
}

.filter-search {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.filter-search:focus { border-color: var(--accent); }

.filter-level {
  flex: 0 0 auto;
  padding: 11px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.list { display: flex; flex-direction: column; gap: 10px; }

.entry {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.entry-value {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 58px;
}

.entry-info { flex: 1; min-width: 0; }

.entry-level {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
}

.entry-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.entry-loc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-del {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}

.entry-del:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.entry-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.entry-edit {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}

.entry-edit:hover { color: var(--accent); background: rgba(250, 204, 21, 0.12); }

.entry-note {
  font-size: 12px;
  color: var(--text);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- users ---------- */
.settings-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-screen[hidden] { display: none !important; }

.settings-inner {
  max-width: 460px;
  margin: 0 auto;
  padding: 22px 16px calc(30px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.settings-head h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 2px;
}

.settings-head-spacer { width: 1px; }

.settings-back {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.users-list { display: flex; flex-direction: column; gap: 10px; }

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.user-info { flex: 1; min-width: 0; }

.user-name2 {
  font-size: 15px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

.user-role.admin {
  color: var(--accent);
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.4);
}

.user-role.user {
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
}

.user-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.user-btn:active { transform: scale(0.97); }

.user-btn.del { color: #f87171; border-color: rgba(239, 68, 68, 0.35); }

.user-btn.del:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- save sheet ---------- */
.overlay[hidden] { display: none !important; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 6, 10, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}

.sheet {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  animation: slideUp 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-grab {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: #3a4456;
  margin: 4px auto 18px;
}

.sheet-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 22px;
}

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
}

.sheet-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
}

.sheet-meter { display: flex; align-items: center; gap: 12px; }

.modal-value {
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.modal-level {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.modal-loc {
  font-size: 13px;
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.modal-loc.loading { color: var(--muted); }

.sheet-save { margin: 22px auto 0; width: 100%; }

.sheet-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
  margin-top: -6px;
}

.cache-clear-btn {
  margin: 22px auto 0;
  width: 100%;
  padding: 13px 0;
  border: none;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(180deg, #f87171, #ef4444);
  cursor: pointer;
  transition: transform 0.1s, filter 0.2s;
}

.cache-clear-btn:hover { filter: brightness(1.06); }
.cache-clear-btn:active { transform: scale(0.97); }

.sheet-cancel {
  width: 100%;
  margin-top: 10px;
  padding: 12px 0;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
}

.sheet-cancel:active { opacity: 0.7; }

.sheet-col { flex-direction: column; align-items: stretch; gap: 8px; }

.sheet-loc-row { position: relative; }

.modal-loc-wrap {
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  max-width: 70%;
}

.loc-edit {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.4);
  flex: 0 0 auto;
}

.loc-picker { margin-top: 12px; }

.picker-search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.picker-search-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

.picker-search-input:focus { border-color: var(--accent); }

.picker-search-btn {
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #fde047, #facc15);
  color: #0b0e14;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
}

.picker-search-btn:active { transform: scale(0.97); }

.picker-map {
  width: 100%;
  height: 200px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
}

.loc-picker-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.loc-btn {
  flex: 1;
  padding: 12px 0;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, #fde047, #facc15);
  color: #0b0e14;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
}

.loc-btn.ghost {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
}

.loc-btn:active { transform: scale(0.98); }

.nearby {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.35);
}

.nearby-msg {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.nearby-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.note-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.note-input:focus { border-color: var(--accent); }

.photo-box { display: flex; align-items: center; gap: 10px; }

.photo-add {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.photo-add:active { transform: scale(0.97); }
.photo-add.danger { color: #f87171; }

.photo-preview {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: visible;
}

.photo-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--accent);
  display: block;
}

.photo-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.md-note {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

.md-photo-wrap {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.md-photo {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } }

/* ---------- notifications (toasts) ---------- */
.toasts {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 420px;
  width: 100%;
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  animation: toastIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast strong { color: var(--accent); }

@keyframes toastIn {
  from { transform: translateY(-12px); opacity: 0; }
}

@media (max-width: 360px) {
  .value { font-size: 56px; }
  .btn { width: 56px; height: 56px; }
}
