/* ACCOUNT VAULT — UI POLISH 2026 V6
   Non-destructive enhancement layered after V5. No access to credentials or JS.
   UX: consistent rhythm, readable contrast, keyboard focus, fluid layout. */

:root {
  --av6-ring: #7d72f8;
  --av6-glow: rgba(99, 85, 232, .11);
  --av6-line: #e5e9f2;
  --av6-radius: 13px;
}
:root[data-theme="dark"] {
  --av6-ring: #aca4ff;
  --av6-glow: rgba(143, 132, 255, .12);
  --av6-line: #354258;
}

/* Page rhythm: consistent edges and readable cards */
body { letter-spacing: -.008em; }
.content { width: 100%; max-width: 1540px; margin-inline: auto; }
.page-head { min-height: 66px; }
.page-head h1 { font-weight: 780; line-height: 1.22; letter-spacing: -.035em; }
.page-head p { line-height: 1.65; }
.panel, .service-card, .stat-card { border: 1px solid var(--border); border-radius: 16px; }
.panel { background: var(--surface); }
.panel-head { gap: 12px; }
.panel-head h3 { letter-spacing: -.025em; }
.stat-value { font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.stat-card, .service-card { transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
@media (hover: hover) and (pointer: fine) {
  .service-card:hover, .stat-card:hover { border-color: color-mix(in srgb, var(--border) 65%, var(--primary) 35%); }
  .service-card:hover { transform: translateY(-2px); }
}

/* Sidebar: unified spacing; lock and logout now share EXACT text/icon alignment */
.sidebar { row-gap: 0; }
.sidebar-head { min-height: 72px; align-items: center; }
.nav-block { gap: 4px; }
.nav-label { padding: 10px 13px 5px; margin: 0 0 4px; }
.nav-label.sublabel { margin-top: clamp(17px, 2.1vh, 25px); }
.sidebar .nav-link, .sidebar .service-nav-link {
  min-height: 42px; border-radius: 10px;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; transition: background-color .16s ease, color .16s ease;
}
.sidebar .nav-link > svg, .sidebar .service-nav-link > svg { width: 18px; height: 18px; flex: none; }
.sidebar .nav-link.active { box-shadow: none; font-weight: 680; }
.sidebar .service-nav { gap: 3px; }
.sidebar .service-nav-link { padding: 7px 12px; min-height: 43px; }
.sidebar .service-nav-link .service-icon { flex: none; }
.sidebar .service-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.sidebar .add-nav {
  margin: 8px 8px 0; min-height: 41px;
  display: flex; align-items: center; gap: 10px;
  border-radius: 10px; padding: 10px 12px;
}
.sidebar-bottom { margin-top: 24px; display: grid; gap: 5px; }
.sidebar-bottom .vault-status { min-height: 58px; border-radius: 11px; padding: 11px 12px; }
.sidebar-bottom .sidebar-lock,
.sidebar-bottom button[data-action="logout"] {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  align-items: center !important;
  align-content: center !important;
  width: 100% !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 10px 13px !important;
  gap: 12px !important;
  font: inherit; font-size: 12px !important; font-weight: 600 !important;
  line-height: 20px !important;
  text-align: left !important;
  white-space: nowrap;
  border: 0 !important; border-radius: 10px !important;
  background: transparent !important;
  color: #bdcae0 !important;
  box-sizing: border-box !important;
}
.sidebar-bottom .sidebar-lock > svg,
.sidebar-bottom button[data-action="logout"] > svg {
  display: block !important; flex: 0 0 18px !important;
  width: 18px !important; height: 18px !important;
  margin: 0 !important;
}
.sidebar-bottom .sidebar-lock:hover,
.sidebar-bottom button[data-action="logout"]:hover {
  background: rgba(255,255,255,.085) !important;
  color: #ffffff !important;
}
.sidebar-bottom button[data-action="logout"]:hover { background: rgba(255,115,139,.105) !important; }

/* Header, toolbar, common buttons: equal heights and predictable icon alignment */
.topbar { border-bottom-color: var(--border); }
.topbar-right { gap: clamp(5px, .85vw, 12px); }
.topbar .avatar { flex: none; }
.btn, .icon-button, .mini-btn, .av-top-action, .av-username-copy,
.table-actions button, .table-secret-controls button {
  align-items: center; justify-content: center; vertical-align: middle;
  transition: color .15s ease, background-color .15s ease,
              border-color .15s ease, box-shadow .15s ease;
}
.btn { display: inline-flex; gap: 8px; min-height: 42px; border-radius: 10px; font-weight: 690; line-height: 1.3; }
.btn svg, .icon-button svg, .mini-btn svg { flex: none; }
.page-actions { gap: 9px; }
.page-actions .btn { min-width: 112px; }
.icon-button, .mini-btn { border-radius: 9px; }
.icon-button { min-width: 36px; min-height: 36px; }
.mini-btn, .table-actions .mini-btn, .table-secret-controls .mini-btn, .av-username-copy {
  display: inline-flex; min-width: 34px; min-height: 34px; flex: none;
  padding: 7px; border-radius: 9px;
}
.av-top-action { display: inline-flex; gap: 7px; min-height: 36px; border-radius: 9px; }
button:disabled { opacity: .56; cursor: not-allowed; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--av6-ring); outline-offset: 2px;
}

/* Tables: aligned columns, comfortable account rows, all copy/eye buttons retained */
.table-panel { border-radius: 16px; }
.table-toolbar { min-height: 74px; gap: 11px; }
.table-toolbar .search-input { border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
.table-toolbar .search-input:focus-within {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--av6-glow);
}
.table-toolbar .search-input input { min-height: 40px; }
.table-toolbar select { min-height: 40px; border-radius: 10px; }
.table-wrap { scrollbar-gutter: stable; }
.data-table { border-collapse: separate; border-spacing: 0; }
.data-table thead th {
  background: var(--surface-alt); color: var(--subtle);
  font-weight: 740; border-bottom: 1px solid var(--border);
  letter-spacing: .012em; vertical-align: middle;
}
.data-table tbody td { height: 60px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
@media (hover: hover) {
  .data-table tbody tr:hover td { background: var(--surface-alt); }
}
.data-table th:first-child, .data-table td:first-child { width: 52px; }
.data-table th:last-child, .data-table td:last-child { min-width: 92px; }
.data-table td:last-child { text-align: right; }
.data-table .table-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.data-table .cell-entry { min-height: 34px; gap: 9px; }
.data-table .entry-title { line-height: 1.5; font-weight: 680; }
.av-username-cell { display: flex; align-items: center; gap: 7px; max-width: 390px; }
.av-username-cell .cell-entry { min-width: 0; max-width: 100%; }
.av-username-cell .av-username-copy { margin-inline-start: 2px; }
.table-secret-cell {
  display: flex; align-items: center; justify-content: flex-start;
  gap: 10px; min-width: 170px; max-width: 380px;
}
.table-secret-value {
  display: inline-block; min-width: 65px; max-width: min(220px, 35vw);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--subtle); font-variant-ligatures: none;
}
.table-secret-controls { display: flex; flex: none; align-items: center; gap: 3px; }
.table-footer { min-height: 51px; border-top: 1px solid var(--border); }
.pagination { display: inline-flex; align-items: center; gap: 6px; }

/* Forms, dynamic field builder, dialogs */
:where(label input:not([type="checkbox"]), label select, label textarea) {
  border-radius: 10px; transition: border-color .16s ease, box-shadow .16s ease;
}
:where(label input:not([type="checkbox"]), label select, label textarea):focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--av6-glow);
}
input[type="checkbox"] { accent-color: var(--primary); }
.modal { box-shadow: 0 28px 92px rgba(11, 22, 48, .22); }
.modal-top { gap: 16px; }
.modal-footer { gap: 10px; border-top: 1px solid var(--border); padding-top: 17px; }
.builder-row { align-items: center; }
.builder-row input.builder-label, .builder-row select, .field-options { min-height: 40px; }
.builder-moves button { border-radius: 8px; }
.drawer-head { gap: 14px; }
.detail-item { min-width: 0; }
.detail-buttons { display: inline-flex; align-items: center; gap: 3px; }

/* Small laptops */
@media (max-width: 1280px) {
  .content { padding-inline: clamp(17px, 2.2vw, 28px); }
  .sidebar-bottom { margin-top: 20px; }
}
/* Tablet: sidebar remains an off-canvas overlay, table scrolls independently */
@media (max-width: 900px) {
  .sidebar { box-shadow: 8px 0 35px rgba(7, 17, 40, .13); }
  .sidebar.mobile-open { z-index: 70; }
  .mobile-scrim { z-index: 69; }
  .table-wrap { max-width: 100%; overflow-x: auto; }
  .page-head { min-height: 0; }
  .topbar-right .av-top-action { min-width: 35px; }
}
/* Phone layout: controls remain finger-friendly */
@media (max-width: 700px) {
  .content { padding: 20px 13px 45px; }
  .page-head { gap: 15px; }
  .page-actions { flex-wrap: wrap; justify-content: stretch; }
  .page-actions .btn { flex: 1 1 120px; min-width: 0; }
  .table-toolbar { min-height: 0; gap: 9px; }
  .table-toolbar .search-input { width: 100%; }
  .table-toolbar select { min-height: 42px; }
  .data-table { min-width: 760px; }
  .data-table tbody td { height: 58px; }
  .data-table th, .data-table td { padding: 11px 12px; }
  .table-secret-cell { min-width: 175px; }
  .table-secret-value { max-width: 135px; }
  .table-footer { gap: 9px; }
  .sidebar-bottom .sidebar-lock,
  .sidebar-bottom button[data-action="logout"] { min-height: 44px !important; }
  .modal { border-radius: 20px 20px 0 0; }
  .modal-footer .btn { flex: 1 1 110px; }
  .builder-row { gap: 8px; }
  .auth-content { padding-inline: 18px; }
}
@media (max-width: 430px) {
  .topbar-right { gap: 4px; }
  .page-actions .btn { min-height: 42px; }
  .stat-card { padding: 14px; }
  .data-table th, .data-table td { padding: 10px 11px; }
  .table-toolbar { padding: 12px; }
  .modal-footer .btn { min-width: 0; }
}
@media (max-width: 360px) {
  .topbar .breadcrumbs { font-size: 12px; }
  .page-head h1 { font-size: 22px; }
  .sidebar { max-width: calc(100vw - 30px); }
}
@media (pointer: coarse) {
  .sidebar .nav-link, .sidebar .service-nav-link, .sidebar-bottom .sidebar-lock,
  .sidebar-bottom button[data-action="logout"] { min-height: 44px !important; }
  .mini-btn, .table-actions .mini-btn, .table-secret-controls .mini-btn, .av-username-copy {
    min-height: 38px; min-width: 38px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
