:root {
  --ink: #11130f;
  --ink-soft: #30352c;
  --paper: #f1f2ec;
  --paper-deep: #e6e9df;
  --paper-line: #d5d9ce;
  --white: #fbfcf7;
  --muted: #7c8376;
  --lime: #d6f458;
  --lime-dark: #afcf32;
  --orange: #ff8061;
  --blue: #74aef8;
  --danger: #c8554d;
  --shadow: 0 18px 52px rgba(22, 27, 17, 0.12);
  --radius: 10px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(17, 19, 15, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 19, 15, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
  width: 242px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 29px 20px 24px;
  color: var(--paper);
  background: var(--ink);
  position: sticky;
  top: 0;
  align-self: flex-start;
  overflow: hidden;
}

.sidebar::after {
  content: "";
  width: 130px;
  height: 130px;
  position: absolute;
  bottom: 104px;
  right: -70px;
  border: 1px solid rgba(214, 244, 88, 0.24);
  transform: rotate(45deg);
}

.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 0 9px; }
.brand-mark { display: flex; align-items: end; gap: 3px; height: 24px; width: 25px; }
.brand-mark span { display: block; width: 6px; background: var(--lime); }
.brand-mark span:nth-child(1) { height: 10px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 24px; }
.brand-name { font-family: Syne, sans-serif; font-size: 24px; line-height: 0.9; letter-spacing: -0.7px; }
.brand-caption { margin-top: 5px; color: #899081; font-family: "DM Mono", monospace; font-size: 8px; letter-spacing: 0.8px; text-transform: uppercase; }

.main-nav { display: grid; gap: 5px; margin-top: 70px; }
.nav-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 11px 10px;
  color: #91988a;
  background: transparent;
  text-align: left;
  transition: 160ms ease;
}
.nav-item svg { width: 16px; height: 16px; }
.nav-item span { font-size: 13px; font-weight: 600; }
.nav-item b { color: #697065; font: 11px "DM Mono", monospace; font-weight: 500; }
.nav-item:hover { color: var(--paper); background: rgba(255, 255, 255, 0.05); }
.nav-item.active { color: var(--ink); background: var(--lime); }
.nav-item.active b { color: #58651c; }

.sidebar-rule { height: 1px; margin: 28px 9px 26px; background: #2e332b; }
.section-kicker { color: var(--muted); font: 500 9px "DM Mono", monospace; letter-spacing: 1.25px; text-transform: uppercase; }
.sidebar .section-kicker { color: #697065; }
.side-status { padding: 0 9px; }
.vault-row { display: flex; align-items: center; gap: 7px; margin-top: 15px; color: #c2c8b8; font-size: 12px; font-weight: 600; }
.vault-state { margin-left: auto; color: var(--lime); font: 9px "DM Mono", monospace; text-transform: uppercase; }
.pulse-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(214, 244, 88, 0.1); }
.side-status p { max-width: 171px; margin: 13px 0 0; color: #70776b; font-size: 11px; line-height: 1.6; }
.sidebar-footer { margin-top: auto; padding: 0 9px; position: relative; z-index: 1; }
.footer-stamp { color: #5c6359; font: 700 9px/1.45 "DM Mono", monospace; letter-spacing: 1.1px; }
.version { margin-top: 14px; color: #444b42; font: 9px "DM Mono", monospace; }

.main-content { width: calc(100% - 242px); max-width: 1700px; padding: 0 52px 58px; }
.topbar { height: 87px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--paper-line); }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.breadcrumb svg { width: 13px; height: 13px; }
.breadcrumb strong { color: var(--ink); font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.sync-indicator { display: flex; align-items: center; gap: 8px; margin-right: 4px; color: var(--muted); font: 10px "DM Mono", monospace; }
.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: rgba(251, 252, 247, 0.45);
  transition: 160ms ease;
}
.icon-button:hover { border-color: #aeb6a3; background: var(--white); transform: translateY(-1px); }
.icon-button:disabled { cursor: wait; opacity: 0.5; }
.is-spinning svg { animation: spin 850ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-button svg { width: 16px; height: 16px; }
.primary-button, .secondary-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0 15px;
  color: var(--ink);
  background: var(--lime);
  font-size: 12px;
  font-weight: 700;
  transition: 160ms ease;
}
.primary-button:hover { background: #e0fa70; box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px, -1px); }
.primary-button svg, .secondary-button svg { width: 15px; height: 15px; }
.secondary-button { border-color: var(--paper-line); background: transparent; }
.secondary-button:hover { border-color: var(--ink); background: var(--paper-deep); }

.page-intro { display: flex; align-items: end; justify-content: space-between; padding: 50px 0 38px; }
.page-intro h1 { max-width: 660px; margin: 13px 0 12px; font: 800 clamp(38px, 4.4vw, 64px)/0.98 Syne, sans-serif; letter-spacing: -2.7px; }
.page-intro h1 em { color: #657d19; font-style: normal; }
.page-intro p { margin: 0; color: #737b6d; font-size: 14px; }
.intro-note { display: flex; align-items: center; gap: 10px; padding-bottom: 5px; color: var(--muted); font: 10px/1.5 "DM Mono", monospace; text-align: right; }
.intro-note b { color: var(--ink); font-weight: 500; }
.note-line { width: 34px; height: 1px; background: var(--orange); }

.metrics-grid { display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr 1.1fr; gap: 10px; }
.metric-card { min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--paper-line); border-radius: var(--radius); background: rgba(251, 252, 247, 0.66); }
.metric-main { color: var(--paper); border-color: var(--ink); background: var(--ink); }
.metric-accent { border-color: var(--orange); background: var(--orange); }
.metric-label { color: var(--muted); font: 500 9px "DM Mono", monospace; letter-spacing: 0.8px; }
.metric-main .metric-label { color: #838d7d; }
.metric-accent .metric-label { color: #713a30; }
.metric-value { display: flex; align-items: baseline; gap: 6px; margin-top: 13px; font: 500 37px/1 "DM Mono", monospace; letter-spacing: -2px; }
.metric-value.small { font-size: 40px; }
.metric-main .metric-value { color: var(--lime); }
.metric-accent .metric-value { color: var(--ink); }
.currency { font-size: 19px; letter-spacing: 0; }
.metric-foot { display: flex; align-items: center; gap: 7px; color: #87907f; font: 10px "DM Mono", monospace; }
.metric-foot.muted { color: var(--muted); }
.accent-foot { justify-content: space-between; color: #713a30; }
.accent-foot svg { width: 14px; height: 14px; }
.trend-dot { width: 6px; height: 6px; border-radius: 50%; }
.trend-dot.lime { background: var(--lime); }
.trend-dot.orange { background: var(--orange); }

.workspace-grid { display: grid; grid-template-columns: minmax(330px, 0.85fr) minmax(500px, 1.55fr); gap: 10px; margin-top: 28px; align-items: start; }
.accounts-panel, .detail-panel { border: 1px solid var(--paper-line); border-radius: var(--radius); background: rgba(251, 252, 247, 0.6); }
.accounts-panel { min-height: 570px; padding: 24px 0 8px; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; padding: 0 24px; }
.panel-heading h2 { margin: 7px 0 0; font: 700 22px Syne, sans-serif; letter-spacing: -0.8px; }
.record-count { color: var(--muted); font: 10px "DM Mono", monospace; }
.directory-toolbar { display: flex; gap: 8px; margin: 22px 24px 12px; }
.search-box { height: 36px; display: flex; align-items: center; gap: 8px; flex: 1; padding: 0 11px; border: 1px solid var(--paper-line); border-radius: 5px; background: rgba(241, 242, 236, 0.72); }
.search-box:focus-within { border-color: var(--ink); background: var(--white); }
.search-box svg { width: 15px; height: 15px; color: var(--muted); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: #a2a89d; }
.sort-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--paper-line); border-radius: 5px; color: var(--muted); background: transparent; }
.sort-button:hover { color: var(--ink); border-color: var(--ink); }
.sort-button svg { width: 15px; height: 15px; }
.account-list { display: grid; gap: 3px; }
.account-row { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 12px 24px; border: 0; border-left: 3px solid transparent; color: var(--ink); background: transparent; text-align: left; transition: 140ms ease; }
.account-row:hover { background: rgba(230, 233, 223, 0.62); }
.account-row.selected { border-left-color: var(--lime-dark); background: var(--paper-deep); }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 7px; color: var(--ink); background: var(--blue); font: 700 13px Syne, sans-serif; }
.avatar.orange { background: var(--orange); }
.avatar.lime { background: var(--lime); }
.avatar.ink { color: var(--paper); background: var(--ink); }
.account-copy { min-width: 0; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; color: var(--muted); font-size: 10px; }
.account-balance { text-align: right; }
.account-balance strong { display: block; font: 500 13px "DM Mono", monospace; }
.account-balance span { display: block; margin-top: 5px; color: var(--muted); font: 9px "DM Mono", monospace; }
.status-label { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; color: #6a743e; font: 9px "DM Mono", monospace; text-transform: uppercase; }
.status-label .pulse-dot { width: 5px; height: 5px; box-shadow: none; background: #91aa28; }
.status-label.warning { color: var(--danger); }
.status-label.warning .pulse-dot { background: var(--danger); }
.empty-list { min-height: 345px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-list[hidden] { display: none; }
.empty-list strong { color: var(--ink); font-size: 13px; }
.empty-list span { font-size: 11px; }
.empty-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 5px; border: 1px dashed var(--paper-line); border-radius: 50%; color: var(--muted); }
.empty-icon svg { width: 17px; }

.detail-panel { overflow: hidden; }
.detail-hero { display: flex; justify-content: space-between; gap: 22px; padding: 28px; border-bottom: 1px solid var(--paper-line); background: var(--white); }
.identity { display: flex; align-items: center; gap: 15px; min-width: 0; }
.identity .avatar { width: 54px; height: 54px; font-size: 18px; }
.identity-copy { min-width: 0; }
.identity-copy h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; font: 700 22px Syne, sans-serif; letter-spacing: -0.8px; }
.identity-copy p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.identity-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.live-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 4px; color: #5e7217; background: #eff8bf; font: 9px "DM Mono", monospace; text-transform: uppercase; }
.live-badge .pulse-dot { width: 5px; height: 5px; box-shadow: none; background: #91aa28; }
.public-id { color: var(--muted); font: 9px "DM Mono", monospace; }
.hero-actions { display: flex; gap: 7px; align-items: start; }
.hero-actions .icon-button { width: 34px; height: 34px; }
.danger-button { color: var(--danger); }
.danger-button:hover { color: #9d3934; border-color: #ddaaa3; background: #fff4f2; }
.wallet-section { padding: 27px 28px 25px; background: var(--ink); }
.wallet-heading { display: flex; align-items: start; justify-content: space-between; }
.wallet-heading .section-kicker { color: #7e897a; }
.wallet-sync { color: #899381; font: 9px "DM Mono", monospace; }
.wallet-amount { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; color: var(--lime); font: 500 40px/1 "DM Mono", monospace; letter-spacing: -2px; }
.wallet-amount .currency { font-size: 21px; }
.wallet-breakdown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.wallet-breakdown div { padding-left: 11px; border-left: 1px solid #394035; }
.wallet-breakdown div:first-child { border-left-color: var(--lime); }
.wallet-breakdown span { display: block; color: #899381; font: 9px "DM Mono", monospace; }
.wallet-breakdown strong { display: block; margin-top: 7px; color: var(--paper); font: 500 12px "DM Mono", monospace; }
.wallet-breakdown span, .wallet-breakdown strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-breakdown .negative { color: var(--orange); }
.detail-body { padding: 27px 28px 26px; }
.keys-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 15px; }
.keys-heading h3 { margin: 7px 0 0; font: 700 17px Syne, sans-serif; letter-spacing: -0.5px; }
.keys-heading > span { color: var(--muted); font: 10px "DM Mono", monospace; }
.key-list { display: grid; gap: 9px; }
.key-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 76px; padding: 12px 13px; border: 1px solid var(--paper-line); border-radius: 7px; background: rgba(241, 242, 236, 0.68); }
.key-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 5px; color: var(--ink); background: var(--lime); }
.key-icon svg { width: 15px; height: 15px; }
.key-info { min-width: 0; }
.key-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.key-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.key-status { padding: 3px 5px; color: #657d19; background: #edf6c3; font: 8px "DM Mono", monospace; text-transform: uppercase; }
.key-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 6px; color: var(--muted); font: 10px "DM Mono", monospace; }
.key-usage { display: flex; gap: 13px; margin-top: 7px; color: #989f92; font: 9px "DM Mono", monospace; }
.key-actions { display: flex; gap: 5px; }
.key-actions .icon-button { width: 31px; height: 31px; background: var(--white); }
.key-actions .reveal-key { color: var(--ink); border-color: var(--ink); }
.key-actions .reveal-key:hover { color: var(--ink); background: var(--lime); }
.key-actions .reveal-key.revealed { color: #fff; border-color: var(--danger); background: var(--danger); }
.key-actions svg { width: 14px; height: 14px; }
.empty-keys { padding: 28px 12px; border: 1px dashed var(--paper-line); color: var(--muted); font-size: 12px; text-align: center; }
.detail-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 17px; border-top: 1px solid var(--paper-line); color: var(--muted); font: 9px "DM Mono", monospace; }
.detail-footer button { display: inline-flex; align-items: center; gap: 6px; border: 0; padding: 0; color: var(--ink); background: transparent; font: 600 10px "DM Mono", monospace; }
.detail-footer button:hover { color: #667e17; }
.detail-footer svg { width: 13px; height: 13px; }
.no-selection { min-height: 570px; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); text-align: center; }
.no-selection .empty-icon { width: 48px; height: 48px; }
.no-selection strong { color: var(--ink); font: 700 16px Syne, sans-serif; }
.no-selection span { font-size: 11px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(17, 19, 15, 0.62); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(100%, 505px); position: relative; padding: 31px; border: 1px solid #4a5142; border-radius: 10px; color: var(--paper); background: var(--ink); box-shadow: var(--shadow); animation: modal-in 180ms ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-close { position: absolute; top: 18px; right: 18px; border-color: #3b4336; color: #9ba394; background: transparent; }
.modal-close:hover { color: var(--paper); border-color: #6c7766; background: #2a3026; }
.modal-topline { display: flex; align-items: center; gap: 10px; color: #838c7e; font: 9px "DM Mono", monospace; letter-spacing: 0.8px; }
.modal-index { display: grid; place-items: center; width: 22px; height: 22px; color: var(--ink); background: var(--lime); font-weight: 700; }
.modal h2 { margin: 22px 0 8px; font: 700 28px Syne, sans-serif; letter-spacing: -1px; }
.modal-description { max-width: 390px; margin: 0 0 25px; color: #929a8c; font-size: 12px; line-height: 1.6; }
.field-label { display: flex; justify-content: space-between; margin: 16px 0 7px; color: #c2c8b8; font-size: 11px; font-weight: 600; }
.field-label span { color: #737d70; font: 9px "DM Mono", monospace; font-weight: 400; }
.text-input, .text-area { width: 100%; border: 1px solid #3a4236; border-radius: 5px; outline: 0; padding: 11px 12px; color: var(--paper); background: #1a1e18; font-size: 12px; transition: 160ms ease; }
.text-input:focus, .text-area:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(214, 244, 88, 0.1); }
.text-input::placeholder, .text-area::placeholder { color: #626b5f; }
.mono-input { font: 11px "DM Mono", monospace; }
.text-area { resize: vertical; min-height: 108px; line-height: 1.55; }
.form-status { min-height: 18px; margin-top: 12px; color: var(--orange); font-size: 11px; line-height: 1.45; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal .secondary-button { border-color: #3a4236; color: #b6bdae; }
.modal .secondary-button:hover { color: var(--paper); border-color: #687363; background: #242b21; }
.modal-footnote { display: flex; gap: 8px; align-items: start; margin-top: 24px; padding-top: 17px; border-top: 1px solid #30372c; color: #707a6d; font: 10px/1.5 "DM Mono", monospace; }
.modal-footnote svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--lime); }
.toast { position: fixed; right: 26px; bottom: 24px; z-index: 20; max-width: min(360px, calc(100vw - 32px)); padding: 12px 15px; border: 1px solid var(--ink); border-radius: 6px; opacity: 0; pointer-events: none; color: var(--paper); background: var(--ink); box-shadow: 5px 5px 0 rgba(214, 244, 88, 0.85); font-size: 12px; transform: translateY(7px); transition: 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .main-content { padding: 0 30px 45px; }
  .workspace-grid { grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr); }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 132px; }
}

@media (max-width: 820px) {
  .sidebar { width: 70px; padding: 24px 10px; }
  .brand-lockup { justify-content: center; padding: 0; }
  .brand-lockup > div:last-child, .nav-item span, .nav-item b, .side-status, .sidebar-rule, .sidebar-footer { display: none; }
  .main-nav { margin-top: 58px; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 12px 4px; }
  .main-content { width: calc(100% - 70px); padding: 0 20px 40px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .detail-panel { min-height: 0; }
  .no-selection { min-height: 320px; }
}

@media (max-width: 620px) {
  .topbar { height: auto; min-height: 74px; gap: 16px; }
  .breadcrumb, .sync-indicator { display: none; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .page-intro { display: block; padding: 34px 0 27px; }
  .page-intro h1 { font-size: clamp(35px, 10vw, 48px); letter-spacing: -1.7px; }
  .page-intro p { max-width: 315px; line-height: 1.55; }
  .intro-note { justify-content: flex-start; margin-top: 21px; text-align: left; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .metric-card { min-height: 123px; padding: 15px; }
  .metric-label { font-size: 8px; letter-spacing: 0.4px; }
  .metric-value { margin-top: 10px; font-size: 24px; letter-spacing: -1.2px; }
  .metric-value.small { font-size: 30px; }
  .metric-foot { font-size: 8px; }
  .workspace-grid { margin-top: 20px; }
  .accounts-panel { min-height: 430px; }
  .panel-heading, .directory-toolbar { margin-left: 15px; margin-right: 15px; }
  .account-row { padding-left: 15px; padding-right: 15px; }
  .detail-hero, .wallet-section, .detail-body { padding-left: 18px; padding-right: 18px; }
  .detail-hero { display: block; }
  .hero-actions { margin-top: 18px; }
  .wallet-amount { font-size: 33px; }
  .wallet-breakdown { gap: 8px; }
  .wallet-breakdown strong { font-size: 10px; }
  .wallet-breakdown span { font-size: 8px; }
  .key-row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
  .key-icon { width: 29px; height: 29px; }
  .key-usage { gap: 7px; font-size: 8px; }
  .modal { padding: 25px 19px 21px; }
}
