:root {
  --bg: #FCFCFB;
  --ink: #2E2C27;
  --muted: #6B6A63;
  --accent: #C6613F;
  --line: rgba(46, 44, 39, 0.12);
  --soft: rgba(46, 44, 39, 0.05);
  --sheet: #FFFFFF;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1E1D1A;
    --ink: #F1F0EC;
    --muted: #A5A39B;
    --accent: #D9774F;
    --line: rgba(241, 240, 236, 0.14);
    --soft: rgba(241, 240, 236, 0.06);
    --sheet: #2A2925;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---- butoane ---- */
.btn {
  border: 1px solid var(--line); background: transparent; border-radius: 10px;
  padding: 8px 14px; cursor: pointer; min-height: 40px;
}
.btn:disabled { opacity: 0.5; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.danger { color: var(--accent); border-color: var(--accent); }
.btn.big { padding: 14px 22px; font-size: 18px; }

/* ---- login ---- */
.login { max-width: 420px; margin: 18vh auto 0; padding: 0 24px; text-align: center; }
.login h1 { font-size: 34px; margin: 0 0 8px; letter-spacing: -0.02em; }

/* ---- mobil ---- */
.app { max-width: 720px; margin: 0 auto; padding-bottom: 96px; }
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 0;
  border-bottom: 1px solid var(--line);
}
.quick { display: flex; gap: 8px; }
.quick input {
  flex: 1; font-size: 17px; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--soft); outline: none;
}
.quick input:focus { border-color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 5px 2px 8px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; padding: 10px 9px; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tab.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tab .n { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: none; border-radius: 999px;
  padding: 5px 12px; font-size: 15px; white-space: nowrap; cursor: pointer; min-height: 34px;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.ptr { height: 0; overflow: hidden; text-align: center; color: var(--muted); font-size: 14px; transition: height .15s; }
.list { list-style: none; margin: 0; padding: 0; }
.row {
  position: relative; display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px; background: var(--bg);
  touch-action: pan-y; transition: transform .18s ease, opacity .25s;
}
.row.gone { opacity: 0; }
.row .check {
  flex: none; width: 26px; height: 26px; margin-top: 1px; border-radius: 50%;
  border: 2px solid var(--muted); background: none; cursor: pointer; padding: 0;
}
.row .check:active, .row .check.done { background: var(--ink); border-color: var(--ink); }
.row .body { flex: 1; min-width: 0; cursor: pointer; }
.row .t { font-weight: 600; overflow-wrap: anywhere; }
.row .m { color: var(--muted); font-size: 15px; margin-top: 2px; }
.flag, .row .flag { color: var(--accent); font-size: 14px; margin-top: 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 2px; }
.swipe-bg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
  padding-right: 20px; color: #fff; background: var(--accent); font-weight: 600;
}
.wrap { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.swipe-bg { visibility: hidden; }
.wrap.swiping .swipe-bg { visibility: visible; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.group-h { padding: 14px 16px 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---- sheet detalii ---- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 88vh; overflow-y: auto;
  background: var(--sheet); border-radius: 16px 16px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px);
  max-width: 720px; margin: 0 auto;
}
.sheet h2 { font-size: 15px; color: var(--muted); font-weight: 500; margin: 16px 0 6px; }
.sheet .titlu { width: 100%; font-size: 18px; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 6px; background: none; resize: none; }
.sheet .titlu:focus, .sheet textarea:focus, .sheet input:focus { border-color: var(--line); outline: none; }
.sheet textarea, .sheet input[type=text] { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.actions .btn { flex: 1; }
.src { overflow-wrap: anywhere; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg); padding: 10px 10px 10px 18px; border-radius: 12px;
  display: flex; gap: 14px; align-items: center; z-index: 30; transition: transform .2s; max-width: 92vw;
}
.toast.show { transform: translate(-50%, 0); }
.toast-btn { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 6px 8px; cursor: pointer; }

/* ---- desktop ---- */
.desk { padding: 16px 24px 80px; }
.desk header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.desk header h1 { font-size: 22px; margin: 0; }
.desk nav a { margin-right: 14px; color: var(--muted); text-decoration: none; }
.desk nav a.on { color: var(--ink); font-weight: 600; }
.fbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 12px; }
.fbar input, .fbar select, td select, td input {
  border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 8px; font-size: 15px;
}
.fbar input[type=search] { min-width: 240px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid th { text-align: left; font-weight: 500; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid td.tt { min-width: 320px; }
.grid td.tt .t { font-weight: 600; }
.grid td.tt .d { color: var(--muted); font-size: 13px; white-space: pre-wrap; max-height: 3.2em; overflow: hidden; }
.grid td input.cui { width: 150px; }
.grid tr.sel { background: var(--soft); }
.grid td.num { text-align: right; color: var(--muted); }
.bulk { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.rev { max-width: 760px; margin: 0 auto; }
.rev .card { border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-top: 14px; }
.rev .card .t { font-size: 22px; font-weight: 600; }
.rev .card .det { white-space: pre-wrap; margin-top: 10px; }
.rev .keys { color: var(--muted); margin-top: 14px; font-size: 15px; }
.rev kbd { border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font: 14px ui-monospace, monospace; }
.rev .sig { color: var(--accent); margin-top: 8px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin-top: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
code.key { background: var(--soft); padding: 4px 8px; border-radius: 6px; user-select: all; overflow-wrap: anywhere; }
.login input[type=text] { width: 100%; font-size: 17px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); text-align: center; }
