/* ==========================================================================
   Velamart /thiet-bi — Thiết bị (khoá cửa thông minh), app/Views/devices/index.php (2026-10-27)
   Cùng ngôn ngữ với /tai-khoan: thẻ hero xanh navy viền cam, thẻ trắng bo 18px, nút cam #D4430C.
   Mọi selector scope dưới .vdv.
   ========================================================================== */

.vdv {
  --vdv-ink: #171717;
  --vdv-body: #404040;
  --vdv-muted: #6B7280;
  --vdv-line: #E8ECF2;
  --vdv-soft: #F5F7FB;
  --vdv-navy: #0F2A5F;
  --vdv-blue: #1C48C1;
  --vdv-orange: #D4430C;
  --vdv-orange-hover: #BC3B0A;
  --vdv-orange-tint: #FFF1E8;
  --vdv-font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  display: flow-root;
  padding: 16px 0 96px; /* chừa chỗ thanh điều hướng đáy trên điện thoại */
  background: var(--vdv-soft);
  color: var(--vdv-body);
  font-family: var(--vdv-font);
  font-size: 15px;
  line-height: 1.55;
}
.vdv *, .vdv *::before, .vdv *::after { box-sizing: border-box; }
.vdv svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vdv-wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; display: flex; flex-direction: column; gap: 14px; }
.vdv h1, .vdv h2 { margin: 0; color: var(--vdv-ink); font-family: var(--vdv-font); letter-spacing: 0; text-transform: none; }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.vdv-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px;
  padding: 20px 18px 22px; border-radius: 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #2D5BD0 0%, rgba(45, 91, 208, 0) 55%), linear-gradient(135deg, #10306E, var(--vdv-navy));
  box-shadow: 0 14px 30px -18px rgba(15, 42, 95, .8);
}
.vdv-hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: linear-gradient(90deg, #E8590C, #F59E0B); }
.vdv-hero-ic {
  flex: 0 0 60px; width: 60px; height: 60px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); color: #fff;
}
.vdv-hero-ic svg { width: 30px; height: 30px; stroke-width: 1.8; }
.vdv-hero-text { min-width: 0; }
.vdv-chip {
  display: inline-block; margin-bottom: 6px; padding: 2px 10px; border-radius: 999px; background: rgba(245, 158, 11, .2);
  color: #FCD34D; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.vdv-hero h1 { color: #fff; font-size: 21px; font-weight: 800; line-height: 1.25; }
.vdv-hero p { margin: 4px 0 0; color: rgba(255, 255, 255, .82); font-size: 13.5px; line-height: 1.45; }

/* ── Thẻ ──────────────────────────────────────────────────────────────── */
.vdv-card {
  padding: 18px 16px; border-radius: 18px; background: #fff; border: 1px solid var(--vdv-line);
  box-shadow: 0 1px 2px rgba(15, 42, 95, .04); scroll-margin-top: 90px;
}
.vdv-card h2 { font-size: 16.5px; font-weight: 800; line-height: 1.3; }
.vdv-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vdv-add {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--vdv-orange-tint); color: var(--vdv-orange) !important; font-size: 13px; font-weight: 700; text-decoration: none !important; white-space: nowrap;
}
.vdv-add svg { width: 16px; height: 16px; stroke-width: 2.4; }

.vdv-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 6px 4px; }
.vdv-empty-ic {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--vdv-soft); color: #94A3B8; margin-bottom: 4px;
}
.vdv-empty-ic svg { width: 30px; height: 30px; stroke-width: 1.7; }
.vdv-empty strong { color: var(--vdv-ink); font-size: 15px; }
.vdv-empty p { margin: 0; max-width: 34em; color: var(--vdv-muted); font-size: 13.5px; }
.vdv-empty p b { color: var(--vdv-ink); }

/* Các bước "Thêm thiết bị" */
.vdv-steps { list-style: none; counter-reset: vdv; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.vdv-steps li { counter-increment: vdv; position: relative; display: flex; flex-direction: column; padding-left: 40px; min-height: 30px; }
.vdv-steps li::before {
  content: counter(vdv); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--vdv-navy); color: #fff; font-size: 13px; font-weight: 800;
}
.vdv-steps li:not(:last-child)::after { content: ''; position: absolute; left: 13.5px; top: 32px; bottom: -10px; width: 1px; background: var(--vdv-line); }
.vdv-steps b { color: var(--vdv-ink); font-size: 14px; line-height: 1.35; }
.vdv-steps span { color: var(--vdv-muted); font-size: 13px; line-height: 1.45; }

.vdv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.vdv-btn {
  flex: 1 1 140px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--vdv-line); background: #fff; color: var(--vdv-ink) !important;
  font-size: 14.5px; font-weight: 700; text-decoration: none !important; white-space: nowrap; transition: background-color .15s ease;
}
.vdv-btn svg { width: 18px; height: 18px; }
.vdv-btn:active { transform: scale(.98); }
.vdv-btn--primary { background: var(--vdv-orange); border-color: var(--vdv-orange); color: #fff !important; box-shadow: 0 10px 20px -12px rgba(212, 67, 12, .9); }
.vdv-btn--primary:hover { background: var(--vdv-orange-hover); }
.vdv-note { margin: 12px 0 0; color: var(--vdv-muted); font-size: 12.5px; line-height: 1.5; }

/* Tính năng */
.vdv-feats { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.vdv-feats li { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--vdv-soft); }
.vdv-feats li > span:last-child { display: flex; flex-direction: column; gap: 2px; color: var(--vdv-muted); font-size: 12.5px; line-height: 1.45; }
.vdv-feats b { color: var(--vdv-ink); font-size: 13.5px; line-height: 1.3; }
.vdv-feat-ic { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.vdv-feat-ic svg { width: 19px; height: 19px; }
.vdv-feat-ic--unlock  { background: #E8EFFF; color: var(--vdv-blue); }
.vdv-feat-ic--pass    { background: var(--vdv-orange-tint); color: var(--vdv-orange); }
.vdv-feat-ic--history { background: #E7F7EF; color: #15803D; }
.vdv-feat-ic--alert   { background: #FEF3C7; color: #B45309; }

.vdv-login p { margin: 6px 0 0; color: var(--vdv-muted); font-size: 13.5px; }

/* Lối tắt tới danh mục khoá */
.vdv-shop {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-radius: 18px; background: #fff;
  border: 1px solid var(--vdv-line); color: var(--vdv-muted) !important; text-decoration: none !important; font-size: 13px;
}
.vdv-shop > span:nth-child(2) { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.vdv-shop b { color: var(--vdv-ink); font-size: 14.5px; }
.vdv-shop-ic { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: var(--vdv-orange-tint); color: var(--vdv-orange); }
.vdv-shop-ic svg { width: 21px; height: 21px; }
.vdv-chev { flex: 0 0 18px; width: 18px; height: 18px; color: #94A3B8; }

/* ══ Màn dùng hằng ngày (đã có khoá) — 2026-10-27 v2 ══════════════════════════════════════════════════ */
.vdv--home { padding-top: 10px; }
.vdv-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 4px 2px 0; }
.vdv-top-hi { display: block; color: var(--vdv-muted); font-size: 13px; font-weight: 500; }
.vdv-top-title { font-size: 24px !important; font-weight: 800; line-height: 1.2; }

.vdv-switch { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.vdv-switch::-webkit-scrollbar { display: none; }
.vdv-switch-btn {
  flex: 0 0 auto; height: 38px; min-height: 0; margin: 0; padding: 0 16px; border-radius: 999px; border: 1px solid var(--vdv-line);
  background: #fff; color: var(--vdv-body); font: inherit; font-size: 13.5px; font-weight: 700; letter-spacing: 0; text-transform: none; cursor: pointer;
}
.vdv-switch-btn[aria-selected="true"] { background: var(--vdv-navy); border-color: var(--vdv-navy); color: #fff; }

.vdv-lock {
  position: relative; padding: 18px 16px 16px; border-radius: 24px; background: #fff; border: 1px solid var(--vdv-line);
  box-shadow: 0 1px 2px rgba(15, 42, 95, .04), 0 22px 44px -32px rgba(15, 42, 95, .45);
}
.vdv-lock[hidden] { display: none; }
.vdv-lock-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.vdv-lock-title { min-width: 0; }
.vdv-lock-title h2 { font-size: 19px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.vdv-lock-sub { display: block; margin-top: 2px; color: var(--vdv-muted); font-size: 12.5px; }
.vdv-pills { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.vdv-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--vdv-soft); color: var(--vdv-body); font-size: 12px; white-space: nowrap; }
.vdv-pill[hidden] { display: none; }
.vdv-pill b { font-weight: 700; }
.vdv-pill--net i { width: 8px; height: 8px; border-radius: 50%; background: #94A3B8; }
.vdv-pill--net[data-online="1"] { background: #E7F7EF; color: #166534; }
.vdv-pill--net[data-online="1"] i { background: #22C55E; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.vdv-pill--net[data-online="0"] { background: #FEF2F2; color: #B91C1C; }
.vdv-pill--net[data-online="0"] i { background: #EF4444; }
.vdv-pill--bat i { position: relative; width: 20px; height: 10px; border: 1.6px solid currentColor; border-radius: 3px; }
.vdv-pill--bat i::before { content: ''; position: absolute; left: 1px; top: 1px; bottom: 1px; width: calc(var(--b, 0%) - 2px); max-width: calc(100% - 2px); border-radius: 1px; background: currentColor; }
.vdv-pill--bat i::after { content: ''; position: absolute; right: -4px; top: 2px; width: 2px; height: 3px; border-radius: 0 1px 1px 0; background: currentColor; }
.vdv-pill--bat[data-level="ok"]  { background: #E7F7EF; color: #166534; }
.vdv-pill--bat[data-level="mid"] { background: #FEF3C7; color: #92400E; }
.vdv-pill--bat[data-level="low"] { background: #FEF2F2; color: #B91C1C; }

/* Nút tròn "giữ để mở" */
.vdv-dial { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 0 18px; }
.vdv-hold {
  position: relative; width: 176px; height: 176px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #fff 0%, #F1F5FD 70%); box-shadow: 0 18px 40px -18px rgba(15, 42, 95, .55), inset 0 0 0 1px #E2E8F4;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  transition: transform .2s ease, box-shadow .2s ease; text-transform: none; letter-spacing: 0; font: inherit;
}
.vdv-hold:focus-visible { outline: 3px solid rgba(28, 72, 193, .45); outline-offset: 4px; }
.vdv-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.vdv-ring circle { fill: none; stroke-width: 7; }
.vdv-ring-bg { stroke: #E5EAF4; }
.vdv-ring-fg { stroke: var(--vdv-orange); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.vdv-hold-face {
  position: absolute; inset: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #183B86, var(--vdv-navy)); color: #fff; box-shadow: inset 0 -6px 14px rgba(0, 0, 0, .25), 0 10px 22px -10px rgba(15, 42, 95, .9);
  transition: background .25s ease;
}
.vdv-hold-face svg { width: 52px; height: 52px; stroke-width: 1.8; }
.vdv-ic-unlock { display: none; }
.vdv-spin { display: none; position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: vdv-spin .8s linear infinite; }
@keyframes vdv-spin { to { transform: rotate(360deg); } }
.vdv-hint { margin: 0; min-height: 22px; text-align: center; color: var(--vdv-muted); font-size: 14px; font-weight: 600; }
.vdv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.vdv-dial[data-state="holding"] .vdv-hold { transform: scale(.96); }
.vdv-dial[data-state="holding"] .vdv-hint { color: var(--vdv-orange); }
.vdv-dial[data-state="sending"] .vdv-hold-face svg { visibility: hidden; }
.vdv-dial[data-state="sending"] .vdv-spin { display: block; }
.vdv-dial[data-state="open"] .vdv-hold-face { background: linear-gradient(145deg, #22A35A, #15803D); }
.vdv-dial[data-state="open"] .vdv-ic-lock { display: none; }
.vdv-dial[data-state="open"] .vdv-ic-unlock { display: block; }
.vdv-dial[data-state="open"] .vdv-ring-fg { stroke: #22C55E; stroke-dashoffset: 0 !important; }
.vdv-dial[data-state="open"] .vdv-hint { color: #15803D; }
.vdv-dial[data-state="error"] .vdv-hint { color: #B91C1C; }
.vdv-dial[data-state="error"] .vdv-hold-face { background: linear-gradient(145deg, #3B4A6B, #273454); }

/* Lối tắt dưới nút */
.vdv-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding-top: 4px; border-top: 1px solid var(--vdv-line); }
.vdv-q {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 0; margin: 0; padding: 12px 2px 4px; border: 0; background: none; cursor: pointer;
  color: var(--vdv-ink) !important; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none !important;
  text-transform: none; letter-spacing: 0; border-radius: 14px;
}
.vdv-q:active { background: var(--vdv-soft); }
.vdv-q-ic { width: 42px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.vdv-q-ic svg { width: 20px; height: 20px; }

/* Hoạt động gần đây */
.vdv-recent { margin-top: 10px; padding: 14px 14px 6px; border-radius: 16px; background: var(--vdv-soft); }
.vdv-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vdv-recent-head h3 { margin: 0; color: var(--vdv-ink); font-size: 14px; font-weight: 800; font-family: var(--vdv-font); letter-spacing: 0; text-transform: none; }
.vdv-link { flex: 0 0 auto; white-space: nowrap; min-height: 0; margin: 0; padding: 4px 0; border: 0; background: none; color: var(--vdv-blue); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; text-transform: none; letter-spacing: 0; }
.vdv-log { list-style: none; margin: 8px 0 0; padding: 0; }
.vdv-log li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(15, 42, 95, .07); font-size: 13px; color: var(--vdv-muted); }
.vdv-log li:first-child { border-top: 0; }
.vdv-log li > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vdv-log b { color: var(--vdv-ink); font-weight: 700; }
.vdv-log time { flex: 0 0 auto; font-size: 12px; color: var(--vdv-muted); }
.vdv-log-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }
.vdv-log-empty { justify-content: center; text-align: center; }
.vdv-log-skel i { flex: 0 0 8px; height: 8px; border-radius: 50%; background: #E2E8F0; }
.vdv-log-skel span { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #E2E8F0, #F1F5F9, #E2E8F0); background-size: 200% 100%; animation: vdv-sk 1.2s infinite; }
@keyframes vdv-sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.vdv-log--full li { padding: 12px 0; }

.vdv-card--slim { padding: 14px 16px; }
.vdv-card--slim h2 { font-size: 15px; }
.vdv-card--slim .vdv-actions { margin-top: 10px; }
.vdv-card--slim .vdv-btn { min-height: 42px; font-size: 13.5px; }

/* Bảng trượt */
html.vdv-noscroll { overflow: hidden; }
.vdv-sheet { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: flex-end; justify-content: center; }
.vdv-sheet[hidden] { display: none; }
.vdv-sheet-bg { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); animation: vdv-fade .2s ease both; }
.vdv-sheet-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 8px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0; background: #fff; font-family: var(--vdv-font); color: var(--vdv-body); animation: vdv-up .25s ease both;
}
@keyframes vdv-fade { from { opacity: 0; } }
@keyframes vdv-up { from { transform: translateY(30px); opacity: 0; } }
.vdv-sheet-grip { width: 40px; height: 4px; margin: 2px auto 8px; border-radius: 2px; background: #CBD5E1; }
.vdv-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vdv-sheet-head h2 { margin: 0; font-size: 17px; font-weight: 800; color: var(--vdv-ink); font-family: var(--vdv-font); letter-spacing: 0; text-transform: none; }
.vdv-x { width: 36px; height: 36px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--vdv-soft); color: var(--vdv-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.vdv-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.vdv-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 0; margin: 0; padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid var(--vdv-line); background: #fff; font: inherit; text-align: left; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.vdv-opt b { color: var(--vdv-ink); font-size: 14.5px; }
.vdv-opt span { color: var(--vdv-muted); font-size: 12px; }
.vdv-opt.is-on { border-color: var(--vdv-orange); background: var(--vdv-orange-tint); }
.vdv-opt:disabled { opacity: .6; }
.vdv-pwd-out { margin-top: 14px; }
.vdv-code {
  padding: 14px; border-radius: 16px; background: var(--vdv-navy); color: #fff; text-align: center;
  font-size: 34px; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums; user-select: all;
}
.vdv-err { margin: 10px 0 0; color: #B91C1C; font-size: 13.5px; font-weight: 600; }
.vdv-err[hidden] { display: none; }
.vdv-form label { display: block; margin: 12px 0 6px; color: var(--vdv-ink); font-size: 13px; font-weight: 700; }
.vdv-form input { width: 100%; height: 46px; padding: 0 14px; border: 1.5px solid var(--vdv-line); border-radius: 12px; font: inherit; font-size: 16px; }
.vdv-form input:focus { outline: none; border-color: var(--vdv-blue); box-shadow: 0 0 0 3px rgba(28, 72, 193, .14); }

@media (min-width: 769px) {
  .vdv { padding: 32px 0 56px; }
  .vdv-hero { padding: 28px 26px 30px; }
  .vdv-hero h1 { font-size: 26px; }
  .vdv-feats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .vdv-feats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .vdv-btn, .vdv-hold, .vdv-hold-face { transition: none; }
  .vdv-btn:active, .vdv-dial[data-state="holding"] .vdv-hold { transform: none; }
  .vdv-sheet-bg, .vdv-sheet-panel, .vdv-log-skel span { animation: none; }
}

/* Theme (Flatsome) viết HOA + thêm margin/viền cho mọi <button> — trả lại kiểu chữ thường cho nút của trang này */
.vdv .vdv-btn, .vdv .vdv-opt, .vdv .vdv-q, .vdv .vdv-x, .vdv .vdv-link, .vdv .vdv-switch-btn, .vdv .vdv-hold {
  text-transform: none; letter-spacing: 0; margin: 0; font-family: var(--vdv-font);
}
.vdv .vdv-btn { line-height: 1.2; }
.vdv .vdv-x { border: 0; box-shadow: none; }
.vdv .vdv-x:focus { outline: none; box-shadow: none; }
.vdv .vdv-x:focus-visible { outline: 2px solid rgba(28, 72, 193, .45); outline-offset: 2px; }
