/* Kệ dung môi VNP — tông hồng pastel, giao diện note gọn, mobile-first. */
:root {
  --paper: #fffdfe; --paper-2: #fdf5f8; --paper-3: #f6e9ef;
  --ink: #2a1d24; --ink-2: #4b3b43; --muted: #8a7681; --neutral: #b7a5ad;
  --accent: #d6457d; --accent-ink: #b32f66; --accent-wash: #fbe7f0; --accent-soft: #f6cfe0; --accent-line: #ef9cc1;
  --ok: #3a9d6e; --ok-wash: #e3f6ec;
  --rule: #f0e2e9; --rule-2: #e6d2dc;
  --danger: #d6455c; --danger-wash: #fce8ec;
  --shadow: 28px 40px 80px -40px rgba(140, 40, 90, .35);
  --r: 16px; --spring: cubic-bezier(.22, 1, .36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font: 15px/1.5 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink); background:
    radial-gradient(900px 500px at 100% -10%, #fbe3ee, transparent 60%),
    radial-gradient(700px 500px at -10% 100%, #f7e7f0, transparent 55%),
    var(--paper-2);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 720px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 16px calc(40px + var(--safe-b)); min-height: 100%; }

/* ---- header ---- */
.hd { display: flex; align-items: center; gap: 12px; padding: 6px 0 16px; }
.hd-l { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.hd-logo svg { display: block; filter: drop-shadow(0 6px 14px rgba(217, 70, 127, .4)); border-radius: 9px; }
.hd-t { display: grid; min-width: 0; }
.hd-t b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.hd-t small { font-size: 12px; color: var(--muted); }
.hd-add {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 16px 0 13px; border: 0; border-radius: 12px;
  background: linear-gradient(180deg, #e2588f, #cc3d75); color: #fff; font: 600 14px 'Be Vietnam Pro', sans-serif;
  box-shadow: 0 10px 20px -10px rgba(204, 61, 117, .8); cursor: pointer; transition: transform .12s var(--spring), box-shadow .12s;
}
.hd-add:hover { box-shadow: 0 12px 24px -10px rgba(204, 61, 117, .9); }
.hd-add:active { transform: scale(.96); }

/* ---- tools ---- */
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.search { position: relative; display: flex; align-items: center; flex: 1 1 220px; }
.search svg { position: absolute; left: 13px; color: var(--neutral); pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0 14px 0 40px; border: 1px solid var(--rule-2); border-radius: 12px;
  background: #fff; font-size: 16px; color: var(--ink); -webkit-appearance: none; appearance: none;
  box-shadow: 0 1px 2px rgba(140, 40, 90, .05);
}
.search input::placeholder { color: var(--neutral); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--paper-3); }
.seg button {
  height: 38px; padding: 0 13px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: 600 13px 'Be Vietnam Pro', sans-serif; cursor: pointer; transition: all .14s var(--spring);
}
.seg button span { color: var(--neutral); font-weight: 600; margin-left: 2px; }
.seg button[aria-selected='true'] { background: #fff; color: var(--accent-ink); box-shadow: 0 2px 6px -2px rgba(140, 40, 90, .25); }
.seg button[aria-selected='true'] span { color: var(--accent); }

/* ---- list of cards ---- */
.list { display: grid; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; border-radius: var(--r);
  background: #fff; border: 1px solid var(--rule); box-shadow: 0 1px 2px rgba(140, 40, 90, .04);
  cursor: pointer; position: relative; overflow: hidden; transition: border-color .14s, box-shadow .14s, transform .1s;
  animation: in .3s var(--spring) both;
}
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
.row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); opacity: 0; transition: opacity .14s; }
.row:hover { border-color: var(--accent-line); box-shadow: 0 8px 22px -14px rgba(180, 50, 100, .4); }
.row:hover::before { opacity: 1; }
.row:active { transform: scale(.995); }
.row.het { background: var(--paper-2); }
.row.het .row-name { color: var(--muted); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.row-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--muted); align-items: center; }
.row-note { color: var(--neutral); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.con { color: var(--ok); background: var(--ok-wash); }
.pill.het { color: var(--muted); background: var(--paper-3); }
.row-badge { flex: none; text-align: right; display: grid; gap: 1px; }
.row-badge b { font-size: 14px; font-weight: 700; }
.row-badge.con b { color: var(--ok); }
.row-badge.het b { color: var(--muted); }
.row-badge small { font-size: 11px; color: var(--neutral); }
.row-chev { flex: none; color: var(--neutral); }

/* trạng thái rỗng / nạp */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.empty svg { color: var(--accent-soft); }
.empty b { font-size: 16px; color: var(--ink-2); font-weight: 700; }
.empty button { margin-top: 4px; }
.skel { height: 72px; border-radius: var(--r); background: linear-gradient(100deg, #fff 30%, var(--paper-2) 50%, #fff 70%); background-size: 200% 100%; animation: sh 1.2s linear infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.foot { text-align: center; color: var(--neutral); font-size: 12px; margin-top: 20px; }

/* ---- dialog ---- */
.ov { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ov[hidden] { display: none; }
.ov-scrim { position: absolute; inset: 0; background: rgba(60, 20, 40, .4); backdrop-filter: blur(4px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.card {
  position: relative; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  background: var(--paper); border-radius: 20px; padding: 20px; box-shadow: var(--shadow);
  display: grid; gap: 14px; animation: pop .26s var(--spring);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.card-h { display: flex; align-items: center; justify-content: space-between; }
.card-h h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.ic { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--paper-3); color: var(--muted); cursor: pointer; }
.ic:hover { background: var(--accent-wash); color: var(--accent-ink); }
.fld { display: grid; gap: 6px; }
.fld > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fld > span i { font-weight: 400; color: var(--neutral); font-style: normal; }
.in {
  height: 46px; padding: 0 13px; border: 1px solid var(--rule-2); border-radius: 11px; background: #fff;
  font-size: 16px; color: var(--ink); -webkit-appearance: none; appearance: none; width: 100%;
}
.in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tip { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: -4px; }
.err { background: var(--danger-wash); color: var(--danger); font-size: 13px; font-weight: 500; padding: 9px 12px; border-radius: 10px; }
.err[hidden] { display: none; }
.card-f { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.grow { flex: 1; }
.btn {
  height: 44px; padding: 0 18px; border: 1px solid var(--rule-2); border-radius: 12px; background: #fff; color: var(--ink-2);
  font: 600 14px 'Be Vietnam Pro', sans-serif; cursor: pointer; transition: all .12s var(--spring);
}
.btn:hover { border-color: var(--neutral); }
.btn:active { transform: scale(.97); }
.btn.primary { border: 0; background: linear-gradient(180deg, #e2588f, #cc3d75); color: #fff; box-shadow: 0 8px 18px -8px rgba(204, 61, 117, .8); }
.btn.ghost { border: 0; background: transparent; color: var(--danger); }
.btn.ghost:hover { background: var(--danger-wash); }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; padding: 11px 18px; border-radius: 12px;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5); display: flex; align-items: center; gap: 12px; animation: up .28s var(--spring);
}
.toast[hidden] { display: none; }
.toast button { background: none; border: 0; color: var(--accent-soft); font: 600 14px 'Be Vietnam Pro', sans-serif; cursor: pointer; }
@keyframes up { from { opacity: 0; transform: translate(-50%, 12px); } }

@media (max-width: 480px) {
  .hd-add span { display: none; }
  .hd-add { padding: 0 13px; }
  .seg { flex: 1 1 100%; }
  .seg button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
