:root {
  --bg: #ffffff;
  --bg2: #f7f7f5;
  --linie: #e9e9e7;
  --text: #37352f;
  --slab: #8a8984;
  --accent: #2383e2;
  --accent-text: #fff;
  --rosu: #d44c47;
  --med-bg: #f5e0e9;
  --med-text: #8c2f5a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --bg2: #252525;
    --linie: #2f2f2f;
    --text: #e6e6e4;
    --slab: #9b9b98;
    --accent: #2383e2;
    --rosu: #ff7369;
    --med-bg: #4e2c3c;
    --med-text: #f0b6cf;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 16px calc(96px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin-inline: auto;
}
button, input { font: inherit; color: inherit; }

.sus { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 8px; }
.sus h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.icon {
  border: 0; background: transparent; width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center; color: var(--slab); cursor: pointer;
}
.icon:active { background: var(--bg2); }

#sumar {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  background: var(--bg2); border-radius: 12px; padding: 12px 14px; margin: 8px 0 4px;
}
#sumar .et { color: var(--slab); font-size: 14px; }
#sumar b { font-size: 22px; font-variant-numeric: tabular-nums; }
#sumar .puls { color: var(--slab); font-variant-numeric: tabular-nums; }

.zi { margin-top: 18px; }
.zi h2 { font-size: 13px; font-weight: 600; color: var(--slab); margin: 0 0 4px; text-transform: none; }
.rand {
  display: grid; grid-template-columns: 74px 1fr auto 34px; align-items: center; gap: 8px;
  width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer;
  padding: 10px 2px; border-bottom: 1px solid var(--linie);
}
.rand:active { background: var(--bg2); }
.cand { display: flex; align-items: center; gap: 6px; color: var(--slab); font-size: 14px; font-variant-numeric: tabular-nums; }
.val { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.val small { color: var(--slab); font-weight: 400; margin: 0 1px; }
.val.mare { color: var(--rosu); }
.val.gol { color: var(--slab); font-weight: 400; font-size: 16px; }
.rand .puls { color: var(--slab); font-variant-numeric: tabular-nums; font-size: 15px; }
.pill { justify-self: end; font-size: 13px; padding: 1px 7px; border-radius: 5px; background: var(--med-bg); color: var(--med-text); }
.gol-lista { color: var(--slab); text-align: center; margin-top: 48px; }

.actiuni {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--linie); background: var(--bg2); font-weight: 500;
}
.btn.principal { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.pericol { color: var(--rosu); background: transparent; border-color: transparent; padding: 0 8px; }
.btn.lat { width: 100%; }
.btn.slab { background: transparent; border-color: transparent; color: var(--slab); }
.actiuni .btn { flex: 1; max-width: 220px; min-height: 52px; font-size: 17px; box-shadow: 0 2px 12px rgb(0 0 0 / .12); }

dialog {
  border: 0; padding: 0; border-radius: 16px; background: var(--bg); color: var(--text);
  width: min(100% - 24px, 480px); max-height: calc(100dvh - 24px);
  box-shadow: 0 10px 40px rgb(0 0 0 / .3);
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog form { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
#export form { gap: 8px; }

.foto { position: relative; border-radius: 10px; overflow: hidden; background: var(--bg2); }
.foto img { display: block; width: 100%; max-height: 180px; object-fit: contain; }
.stare {
  position: absolute; left: 8px; bottom: 8px; font-size: 13px; padding: 3px 8px; border-radius: 6px;
  background: rgb(0 0 0 / .65); color: #fff;
}
.stare:empty { display: none; }
.stare.lucru::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: rot .8s linear infinite;
}
.stare.eroare { background: var(--rosu); }
@keyframes rot { to { transform: rotate(360deg); } }

.camp { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--slab); }
.camp input {
  font-size: 18px; color: var(--text); background: var(--bg2); border: 1px solid var(--linie);
  border-radius: 8px; padding: 10px; min-height: 46px; width: 100%; min-width: 0;
  -webkit-appearance: none; appearance: none;
}
.camp input[type="number"] { font-size: 22px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.camp input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.camp input.citit { animation: citit 1.2s ease-out; }
@keyframes citit { from { background: color-mix(in srgb, var(--accent) 30%, var(--bg2)); } }
.avert {
  margin: -6px 0 0; padding: 8px 10px; border-radius: 8px; font-size: 14px;
  background: color-mix(in srgb, #e9a23b 18%, var(--bg)); color: var(--text);
}
.trei { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.rand-camp { display: flex; align-items: center; justify-content: space-between; color: var(--slab); font-size: 15px; }
.rand-camp .moment { color: var(--text); }
.seg { display: inline-flex; background: var(--bg2); border-radius: 9px; padding: 3px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 18px; border-radius: 7px; color: var(--slab); cursor: pointer; }
.seg input:checked + span { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .15); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

dialog footer { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.spatiu { flex: 1; }

#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 15px;
  max-width: calc(100% - 32px); z-index: 10;
}
