:root {
  color-scheme: dark;
  --bg: #071019;
  --bg-deep: #050b12;
  --surface: rgba(14, 29, 43, .88);
  --surface-strong: #102335;
  --surface-soft: rgba(26, 50, 72, .56);
  --line: rgba(155, 190, 218, .16);
  --line-strong: rgba(117, 188, 255, .32);
  --text: #edf6ff;
  --muted: #9cb0c1;
  --muted-strong: #c4d6e5;
  --blue: #58aaff;
  --blue-deep: #1975d1;
  --cyan: #65e4d4;
  --green: #79e1ad;
  --yellow: #f4ce77;
  --red: #ff8787;
  --shadow: 0 22px 60px rgba(0, 0, 0, .28);
  --radius: 18px;
  --radius-small: 12px;
  font-family: "Segoe UI Variable", "Segoe UI", "Microsoft JhengHei UI", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% 4%, rgba(37, 122, 201, .16), transparent 28rem),
    radial-gradient(circle at 90% 90%, rgba(31, 161, 152, .10), transparent 26rem),
    var(--bg);
  color: var(--text);
  letter-spacing: .01em;
}

button, input, select, textarea { font: inherit; }

button { cursor: pointer; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(101, 228, 212, .72);
  outline-offset: 2px;
}

a { color: var(--blue); }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(4, 12, 20, .84);
  padding: 26px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: linear-gradient(145deg, #64b7ff, #1867c7);
  box-shadow: 0 0 0 6px rgba(70, 155, 232, .09), 0 12px 25px rgba(25, 117, 209, .24);
  position: relative;
  flex: none;
}

.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #e8f6ff;
  border-radius: 50%;
}

.brand-mark::before { top: 8px; left: 7px; }
.brand-mark::after { bottom: 8px; right: 7px; }

.brand-mark span {
  position: absolute;
  left: 13px;
  top: 17px;
  width: 14px;
  border-top: 2px solid #e8f6ff;
  transform: rotate(45deg);
}

.brand-title { font-weight: 750; font-size: 16px; letter-spacing: .04em; }
.brand-subtitle { font-size: 11px; color: var(--muted); margin-top: 2px; }

.nav-label, .eyebrow {
  color: #7e9bb4;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 700;
}

.nav-label { padding: 0 12px 8px; }

.nav-list { display: grid; gap: 5px; }

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted-strong);
  background: transparent;
  padding: 11px 12px;
  text-align: left;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.nav-button:hover { background: rgba(68, 135, 190, .10); border-color: var(--line); transform: translateX(2px); }
.nav-button.active { background: linear-gradient(100deg, rgba(61, 142, 226, .26), rgba(47, 86, 124, .16)); border-color: rgba(88, 170, 255, .33); color: white; }
.nav-icon { width: 22px; text-align: center; color: #92caff; font-size: 15px; }
.nav-button.active .nav-icon { color: var(--cyan); }

.sidebar-bottom { margin-top: auto; display: grid; gap: 14px; }

.privacy-mini {
  border: 1px solid var(--line);
  background: rgba(20, 45, 64, .34);
  border-radius: 13px;
  padding: 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.privacy-mini strong { color: var(--green); font-size: 12px; }

.main-shell { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  min-height: 76px;
  padding: 16px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(7, 16, 25, .72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 4;
}

.topbar-title { font-size: 14px; color: var(--muted-strong); }
.topbar-title strong { color: var(--text); font-weight: 650; }

.status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.status-pill, .tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted-strong);
  background: rgba(17, 36, 53, .55);
  font-size: 12px;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(121, 225, 173, .7); }
.status-pill.locked .status-dot { background: var(--yellow); box-shadow: 0 0 12px rgba(244, 206, 119, .6); }

.content { width: min(1180px, 100%); margin: 0 auto; padding: clamp(24px, 5vw, 54px) clamp(18px, 4vw, 48px) 70px; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.page-heading h1 { margin: 6px 0 9px; font-size: clamp(27px, 4vw, 42px); letter-spacing: -.04em; line-height: 1.1; }
.page-heading p { max-width: 670px; margin: 0; color: var(--muted); line-height: 1.7; font-size: 14px; }
.heading-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-aside { grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr); align-items: start; }

.card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(17, 37, 55, .88), rgba(8, 22, 34, .82));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card.compact { padding: 17px; }
.card.soft { background: rgba(12, 30, 46, .56); box-shadow: none; }
.card h2, .card h3 { margin: 0; letter-spacing: -.02em; }
.card h2 { font-size: 20px; }
.card h3 { font-size: 16px; }
.card p { color: var(--muted); line-height: 1.65; font-size: 13px; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-header p { margin: 6px 0 0; }

.hero-card {
  padding: clamp(23px, 4vw, 38px);
  background:
    radial-gradient(circle at 84% 12%, rgba(84, 183, 255, .26), transparent 13rem),
    linear-gradient(130deg, rgba(22, 69, 104, .92), rgba(10, 27, 42, .91) 58%, rgba(7, 19, 29, .92));
  border-color: rgba(87, 173, 238, .30);
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -80px;
  bottom: -110px;
  border: 1px solid rgba(101, 228, 212, .24);
  border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(101, 228, 212, .04), 0 0 0 52px rgba(101, 228, 212, .025);
}

.hero-card h2 { font-size: clamp(25px, 4vw, 36px); max-width: 610px; line-height: 1.13; }
.hero-card p { max-width: 640px; font-size: 14px; margin: 13px 0 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 1; }

.button {
  border: 1px solid rgba(123, 183, 229, .25);
  background: rgba(21, 49, 71, .72);
  color: var(--muted-strong);
  border-radius: 11px;
  min-height: 40px;
  padding: 9px 14px;
  font-weight: 650;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.button:hover { transform: translateY(-1px); background: rgba(42, 90, 127, .76); border-color: rgba(119, 198, 255, .45); color: white; }
.button.primary { background: linear-gradient(135deg, #2481da, #1a5eac); color: white; border-color: rgba(137, 206, 255, .62); box-shadow: 0 9px 22px rgba(18, 99, 183, .28); }
.button.primary:hover { background: linear-gradient(135deg, #3392eb, #216fca); }
.button.ghost { background: transparent; }
.button.danger { color: #ffc0c0; border-color: rgba(255, 135, 135, .27); }
.button.danger:hover { background: rgba(157, 53, 53, .22); border-color: rgba(255, 135, 135, .54); }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: .52; transform: none; }

.metric-card { display: flex; align-items: center; gap: 14px; min-height: 110px; }
.metric-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: rgba(80, 175, 240, .15); border: 1px solid rgba(80, 175, 240, .24); color: var(--cyan); font-size: 19px; flex: none; }
.metric-value { font-size: 28px; font-weight: 730; letter-spacing: -.04em; }
.metric-label { color: var(--muted); font-size: 12px; margin-top: 2px; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(17, 43, 61, .48);
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.6;
}

.notice strong { color: var(--text); }
.notice.info { border-color: rgba(88, 170, 255, .29); }
.notice.success { border-color: rgba(121, 225, 173, .30); background: rgba(22, 73, 60, .28); }
.notice.warning { border-color: rgba(244, 206, 119, .30); background: rgba(83, 65, 26, .25); }
.notice.error { border-color: rgba(255, 135, 135, .35); background: rgba(95, 36, 44, .27); color: #ffd1d1; }
.notice-icon { color: var(--cyan); font-weight: 800; flex: none; }
.notice.warning .notice-icon { color: var(--yellow); }
.notice.error .notice-icon { color: var(--red); }

.empty-state { padding: 36px 20px; text-align: center; border: 1px dashed rgba(144, 183, 211, .26); border-radius: 15px; background: rgba(5, 17, 28, .34); }
.empty-state .empty-icon { width: 46px; height: 46px; display: grid; place-items: center; margin: 0 auto 11px; border-radius: 15px; background: rgba(78, 168, 236, .14); color: var(--blue); font-size: 20px; }
.empty-state h3 { margin: 0 0 7px; }
.empty-state p { max-width: 440px; margin: 0 auto 17px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted-strong); font-size: 12px; font-weight: 650; }
.field small { color: #7f9aaf; font-size: 11px; line-height: 1.5; }
.input, .select, .textarea {
  width: 100%;
  color: var(--text);
  background: rgba(4, 14, 24, .76);
  border: 1px solid rgba(137, 183, 216, .23);
  border-radius: 10px;
  min-height: 42px;
  padding: 9px 11px;
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: #61798d; }
.input:read-only { color: var(--muted-strong); }
.field-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.form-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 74px; }
.password-toggle { position: absolute; right: 6px; top: 5px; min-height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--blue); padding: 5px 8px; font-size: 11px; }

.account-list { display: grid; gap: 10px; }
.account-row { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7, 20, 31, .48); }
.account-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, rgba(84, 184, 255, .28), rgba(68, 113, 187, .24)); color: var(--cyan); font-weight: 800; flex: none; }
.account-meta { min-width: 0; flex: 1; }
.account-name { font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-issuer { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.otp-focus {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px solid rgba(101, 228, 212, .30);
  background:
    radial-gradient(circle at 50% 20%, rgba(80, 193, 226, .18), transparent 15rem),
    rgba(8, 30, 42, .66);
}

.otp-account-name { color: var(--muted-strong); font-size: 14px; }
.otp-selector { width: min(420px, 100%); text-align: left; }
.otp-account-name { margin-top: 25px; }
.otp-side { gap: 16px; }
.otp-code { margin: 12px 0 10px; font-size: clamp(42px, 8vw, 68px); line-height: 1; letter-spacing: .12em; font-weight: 760; color: white; text-shadow: 0 0 30px rgba(88, 170, 255, .24); font-variant-numeric: tabular-nums; }
.otp-code.dim { color: #587184; text-shadow: none; }
.otp-countdown { width: min(300px, 100%); display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.progress { appearance: none; height: 6px; overflow: hidden; border: 0; border-radius: 99px; background: rgba(146, 178, 204, .16); flex: 1; }
.progress::-webkit-progress-bar { background: rgba(146, 178, 204, .16); border-radius: 99px; }
.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--cyan), var(--blue)); border-radius: 99px; transition: width .3s linear; }
.progress::-moz-progress-bar { background: linear-gradient(90deg, var(--cyan), var(--blue)); border-radius: 99px; }

.security-list { display: grid; gap: 11px; }
.security-row { display: flex; align-items: flex-start; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 20, 31, .44); }
.security-row .security-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: rgba(121, 225, 173, .13); color: var(--green); flex: none; }
.security-row strong { font-size: 13px; }
.security-row p { margin: 4px 0 0; font-size: 12px; }

.step-list { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; counter-reset: step; }
.step-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.step-list li::before { counter-increment: step; content: counter(step); width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid rgba(88, 170, 255, .35); border-radius: 50%; color: var(--blue); font-size: 11px; font-weight: 800; }
.step-list strong { color: var(--text); }

.qr-layout { display: grid; grid-template-columns: minmax(210px, .55fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.qr-box { min-height: 250px; display: grid; place-items: center; background: #fff; border-radius: 14px; padding: 18px; border: 8px solid #fff; }
.qr-box svg { display: block; width: min(100%, 270px); height: auto; aspect-ratio: 1; }
.qr-placeholder { width: 100%; min-height: 200px; display: grid; place-items: center; color: #556b7e; text-align: center; font-size: 12px; }

.lock-card { max-width: 560px; margin: 7vh auto; }
.lock-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 19px; background: linear-gradient(145deg, rgba(89, 186, 255, .24), rgba(32, 100, 170, .28)); border: 1px solid rgba(93, 184, 255, .31); color: var(--cyan); font-size: 25px; margin-bottom: 19px; }
.lock-card h2 { font-size: 25px; margin-bottom: 9px; }
.lock-card > p { margin-top: 0; }
.strength { height: 5px; border-radius: 99px; background: rgba(146, 178, 204, .13); overflow: hidden; margin-top: 8px; }
.strength span { display: block; height: 100%; width: 0; transition: width .22s ease, background .22s ease; }
.strength-label { color: var(--muted); font-size: 11px; margin-top: 6px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(1, 7, 12, .78); backdrop-filter: blur(8px); }
.modal { width: min(670px, 100%); max-height: min(88vh, 760px); overflow: auto; border: 1px solid rgba(118, 187, 231, .30); border-radius: 20px; background: #0b1c2a; box-shadow: 0 24px 80px rgba(0,0,0,.58); padding: 22px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.modal-header h2 { margin: 0; font-size: 21px; }
.modal-header p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.close-button { border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted-strong); min-width: 34px; min-height: 34px; }
.close-button:hover { background: rgba(92, 153, 199, .14); color: white; }
.qr-uri { word-break: break-all; color: var(--muted); background: rgba(3, 10, 17, .75); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 30; display: grid; gap: 9px; width: min(390px, calc(100% - 40px)); pointer-events: none; }
.toast { border: 1px solid rgba(117, 188, 255, .35); border-radius: 12px; background: rgba(8, 25, 39, .95); box-shadow: var(--shadow); color: var(--muted-strong); padding: 12px 14px; font-size: 12px; line-height: 1.55; animation: toast-in .22s ease both; }
.toast.success { border-color: rgba(121, 225, 173, .42); }
.toast.error { border-color: rgba(255, 135, 135, .46); color: #ffd1d1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.divider { height: 1px; background: var(--line); margin: 18px 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }
.hidden { display: none !important; }

.noscript { max-width: 600px; margin: 12vh auto; padding: 24px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; gap: 15px; }
  .sidebar-bottom { display: none; }
  .nav-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  .nav-label { display: none; }
  .nav-button { width: auto; white-space: nowrap; }
  .nav-button:hover { transform: none; }
  .topbar { position: static; }
}

@media (max-width: 700px) {
  .grid.two, .grid.three, .grid.main-aside, .qr-layout { grid-template-columns: 1fr; }
  .page-heading { display: block; }
  .heading-actions { margin-top: 18px; justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .account-row { align-items: flex-start; }
  .account-actions { width: 100%; justify-content: flex-start; margin-left: 50px; }
  .qr-box { min-height: 220px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .status-row { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
