/* =========================================================
   JSIMPLE VAULT — style.css (CLEAN, SINGLE-SOURCE)
   - Dark/Light via html[data-theme]
   - No duplicates / no drift
   - Works for: login/MFA, topbar, tables, drawers, toasts
========================================================= */

/* ---------- THEME TOKENS ---------- */
:root{
  --bg: #0f172a;
  --card: #111827;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #3b82f6;
  --danger: #ef4444;

  --input-bg: #020617;
  --input-border: #1f2937;

  --hover: rgba(148,163,184,.08);
  --shadow: 0 25px 50px rgba(0,0,0,.45);
}

html[data-theme="light"]{
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --danger: #dc2626;

  --input-bg: #ffffff;
  --input-border: #cbd5e1;

  --hover: rgba(15,23,42,.06);
  --shadow: 0 10px 24px rgba(15,23,42,.10);
}

/* ---------- RESET / BASE ---------- */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background: linear-gradient(145deg, var(--bg), var(--bg));
  color: var(--text);
  min-height:100vh;
}
a{ color: inherit; }

h1,h2,h3{ margin:0; }
p{ margin:0; color: var(--muted); }

.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* =========================================================
   AUTH (CENTERED PAGES ONLY)
========================================================= */
body.centered{
  display:flex;
  align-items:center;
  justify-content:center;
}

.card{
  width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.card.wide{
  width: 100%;
  padding: 0;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: none;
}

label{
  display:block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select, textarea{
  width:100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
}

textarea{ min-height: 90px; resize: vertical; }

input:focus, select:focus, textarea:focus{
  outline: none;
  border-color: var(--primary);
}

.error{
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.35);
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 14px;
  color: #fecaca;
  font-size: 13px;
}

/* =========================================================
   BUTTONS / LINKS
========================================================= */
button{
  font: inherit;
  cursor:pointer;
}

.linkbtn, .btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-decoration:none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.linkbtn:hover, .btn:hover{ background: var(--hover); }

.linkbtn.primary, .btn.primary{
  background: var(--primary);
  border-color: rgba(37,99,235,.0);
  color: #fff;
}
.linkbtn.primary:hover, .btn.primary:hover{ opacity:.95; background: var(--primary); }

.linkbtn.danger, .btn.danger{
  border-color: rgba(239,68,68,.35);
  color: #fecaca;
}
html[data-theme="light"] .linkbtn.danger,
html[data-theme="light"] .btn.danger{
  color: var(--danger);
  border-color: rgba(220,38,38,.25);
}

.btn-small{
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.action-btn{
  width: auto;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.action-btn:hover{ background: var(--hover); }

/* Icon button (critical reset for theme toggle / close buttons) */
button.icon-btn{
  all: unset;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1;
}
button.icon-btn:hover{ background: var(--hover); }

/* =========================================================
   TOP BAR
========================================================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, #020617, rgba(2,6,23,.95));
  border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .topbar{
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.topbar-inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 10px;
}
.brand-logo{ font-size: 16px; }
.brand-name{
  font-size: 16px;
  font-weight: 700;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================================================
   PAGE LAYOUT
========================================================= */
.page{
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

.page-header{
  display:flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.page-title{
  font-size: 22px;
  font-weight: 700;
}

.page-subtitle{
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.page-actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
}

.footer{
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

/* =========================================================
   TABLES
========================================================= */
.table-wrap{
  overflow:auto;
  border-radius: 12px;
}

.table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th{
  text-align:left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}

.table tbody tr:hover{ background: var(--hover); }
.table .right{ text-align:right; }

/* Badges */
.badge{
  display:inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(59,130,246,.10);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
}
.badge.success{
  background: rgba(34,197,94,.15);
  border-color: rgba(34,197,94,.35);
  color: #22c55e;
}
.badge.muted{
  background: rgba(148,163,184,.12);
  border-color: rgba(148,163,184,.25);
  color: var(--muted);
}

/* =========================================================
   FILTERS (AUDIT)
========================================================= */
.filters{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.filters .field label{ margin-bottom: 6px; }
.filters .actions{
  display:flex;
  gap: 10px;
  align-items: end;
}
.filters .actions button{ width:auto; min-width: 120px; }

/* =========================================================
   TOASTS
========================================================= */
.toast-container{
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.toast{
  min-width: 260px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 20px 40px rgba(0,0,0,.35);
  font-size: 13px;
  animation: toast-in .25s ease;
}

.toast.success{ border-color: rgba(34,197,94,.45); }
.toast.error{
  border-color: rgba(239,68,68,.45);
  color: #fecaca;
}
.toast.warning{ border-color: rgba(245,158,11,.45); }

@keyframes toast-in{
  from{ opacity:0; transform: translateY(8px); }
  to{ opacity:1; transform: translateY(0); }
}

/* =========================================================
   SLIDING DRAWER (Add Vault, future drawers)
========================================================= */
.overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.40);
  opacity: 0;
  pointer-events: none;
  transition: opacity .20s ease;
  z-index: 40;
}
.overlay.open{
  opacity: 1;
  pointer-events: auto;
}

.drawer{
  position: fixed;
  top: 0;
  right: 0;
height: 100vh;
  width: min(420px, 92vw);
  background: var(--card);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform .20s ease;
  z-index: 50;
  display:flex;
  flex-direction: column;
}
.drawer.open{ transform: translateX(0); }

.drawer-header{
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display:flex;
  justify-content: space-between;
  align-items:center;
}

.drawer-body{
  padding: 14px 16px;
  flex: 1;
  overflow-y: auto;
}

.drawer-footer{
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display:flex;
  justify-content: flex-end;
  gap: 10px;
  background: linear-gradient(to top, var(--card), rgba(0,0,0,0));
}

.drawer-footer .primary{ min-width: 140px; }

/* Drawer form rhythm */
.form-group{ margin-bottom: 10px; }

/* Sections (optional, if you use .section + .section-title) */
.section{
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.section:last-child{ border-bottom: none; }

.section-title{
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

/* Owners checklist */
.owners-list{
  display:flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 6px;

  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
}

.owner-item{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.owner-item:hover{ background: rgba(59,130,246,.06); }

.owner-item input[type="checkbox"]{
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

/* =========================================================
   MOBILE
========================================================= */
@media (max-width: 900px){
  .filters{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-header{ flex-direction: column; align-items: stretch; }
  .page-actions{ justify-content: flex-start; }
}

@media (max-width: 768px){
  .topbar-inner{ flex-wrap: wrap; }
  .topbar-left{ width: 100%; }
  .topbar-right{
    width: 100%;
    justify-content: flex-start;
  }

  .linkbtn, .btn{
    padding: 8px 10px;
    font-size: 12px;
  }

  .table-wrap{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
/* =========================================================
   DENSITY TUNING — ADD VAULT DRAWER (FINAL)
========================================================= */

/* Reduce header height */
.drawer-header {
  padding: 12px 16px;
}

/* Tighten section spacing */
.section {
  padding: 6px 0;
}

/* Reduce label spacing */
.section label,
.form-group label {
  margin-bottom: 4px;
}

/* Reduce gap below inputs */
.form-group {
  margin-bottom: 8px;
}

/* Reduce explanatory text spacing */
.drawer-body p {
  margin-top: 4px;
  margin-bottom: 6px;
}

/* Owners list should size to content, not air */
.owners-list {
  max-height: 140px;   /* was 180 */
  padding: 6px;
}

/* Owners rows slightly tighter */
.owner-item {
  padding: 5px 8px;
}
/* Ensure drawer footer is always visible */
 .drawer-footer {
  flex-shrink: 0;
}

.notes-content {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  max-height: 180px;
  overflow: auto;
}

.reveal-inline{
  margin-top:8px;
  display:flex;
  align-items:center;
  gap:8px;
  background: var(--input-bg);
  border:1px solid var(--input-border);
  border-radius:10px;
  padding:8px 10px;
}
.reveal-input{
  min-width:160px;
  max-width:260px;
  padding:8px 10px;
  border-radius:8px;
  border:1px solid var(--input-border);
  background: var(--card);
  color: var(--text);
}
.actions-cell{
  white-space: nowrap;
}

.actions-inline{
  display:flex;
  justify-content:flex-end;
  gap:8px;
}
.secret-cell{
  display:flex;
  align-items:center;
  gap:8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.icon-btn svg{
  display:block;pointer-events: none;
}

.auth-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg);
}

.auth-card{
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}


.auth-title{
  font-size:20px;
  font-weight:600;
  margin-bottom:6px;
}

.auth-subtitle{
  font-size:13px;
  color:var(--muted);
  margin-bottom:20px;
}

.auth-actions{
  margin-top:20px;
  display:flex;
  gap:10px;
}
.auth-card::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.auth-icon{
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--muted);
}
.auth-card .footer{
  margin-top:16px;
  padding-top:12px;
  border-top:1px solid var(--border);
  text-align:center;
  font-size:12px;
  color:var(--muted);
}

/* ================================
   SHARE DRAWER — LARGE VARIANT
================================ */

.drawer.drawer-share {
  width: 520px;
  max-width: 92vw;
}
/* HISTORY (wide) */
.drawer.drawer-share.wide {
  width: 820px;
  max-width: 96vw;
}
.drawer.drawer-share .drawer-body {
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}
 .drawer {
  transition: width 0.25s ease;
}
/* =========================
   SHARE TABS
========================= */

.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-muted);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
}

.tab.active {
  background: var(--primary);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.auth-error {
  background: rgba(220, 38, 38, 0.15);
  color: #fecaca;
  border: 1px solid rgba(220, 38, 38, 0.4);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
  text-align: center;
}
