/* ---------------------------------------------------------------------------
   Cofre de Senhas — design system.
   Mesmos tokens do tema anterior (Tailwind), agora como CSS próprio.
--------------------------------------------------------------------------- */

:root {
  --bg-base: #0f0f14;
  --bg-surface: #1a1a24;
  --bg-elevated: #22222f;
  --accent: #6366f1;
  --accent-hover: #7c7ef5;

  --line: rgba(255, 255, 255, 0.05);
  --line-strong: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-70: rgba(255, 255, 255, 0.7);
  --text-60: rgba(255, 255, 255, 0.6);
  --text-50: rgba(255, 255, 255, 0.5);
  --text-40: rgba(255, 255, 255, 0.4);
  --text-30: rgba(255, 255, 255, 0.3);

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  flex-shrink: 0;
}

/* ----------------------------------------------------------------- tipografia */

.page-title {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
  margin: 0;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-50);
  margin: 0.25rem 0 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-70);
  margin: 0 0 0.75rem;
}

.muted {
  color: var(--text-50);
  font-size: 0.875rem;
}

.item-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.icon-success {
  color: #34d399;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.break-all {
  word-break: break-all;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ----------------------------------------------------------------- botões */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: #fff;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-70);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-block {
  width: 100%;
}

.btn-compact {
  padding: 0.25rem 0.5rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-60);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.btn-icon.is-accent:hover {
  color: var(--accent);
}

.btn-icon.is-danger:hover {
  color: #f87171;
}

.text-danger {
  color: #f87171;
}

/* ----------------------------------------------------------------- formulário */

.input {
  width: 100%;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: #fff;
}

.input::placeholder {
  color: var(--text-40);
}

.input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
  border-color: transparent;
}

textarea.input {
  min-height: 80px;
  resize: vertical;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='0.5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  padding-right: 2rem;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-60);
  margin-bottom: 0.25rem;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.input-affix {
  position: relative;
}

.input-affix .input {
  padding-right: 2.75rem;
}

.input-affix-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  padding: 0.375rem;
  border: 0;
  background: transparent;
  color: var(--text-60);
  cursor: pointer;
}

.input-affix-btn:hover {
  color: #fff;
}

/* ----------------------------------------------------------------- superfícies */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.card-pad {
  padding: 1.25rem;
}

.card-list > * + * {
  border-top: 1px solid var(--line);
}

.card-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-50);
  font-size: 0.875rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-60);
}

.badge-accent {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.dot-sm {
  width: 0.5rem;
  height: 0.5rem;
}

.dot-lg {
  width: 1rem;
  height: 1rem;
}

.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-sm {
  width: 1.25rem;
  height: 1.25rem;
}

.avatar-xs {
  width: 1rem;
  height: 1rem;
}

.avatar-md {
  width: 2rem;
  height: 2rem;
}

.avatar-lg {
  width: 2.5rem;
  height: 2.5rem;
}

/* ----------------------------------------------------------------- layout */

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main {
  flex: 1;
  overflow-y: auto;
}

.container {
  padding: 1.5rem;
  max-width: 72rem;
  margin: 0 auto;
}

.container-narrow {
  max-width: 56rem;
}

.container-tight {
  max-width: 48rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.centered-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.centered-card {
  width: 100%;
  max-width: 24rem;
  padding: 2rem;
  text-align: center;
}

.icon-badge {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
}

.icon-badge.is-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.icon-badge.is-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.row-gap-3 {
  gap: 0.75rem;
}

.grow {
  flex: 1;
  min-width: 0;
}

.spacer {
  flex: 1;
}

.stack-sm > * + * {
  margin-top: 0.5rem;
}

/* ----------------------------------------------------------------- sidebar */

.sidebar {
  width: 16rem;
  flex-shrink: 0;
  height: 100%;
  background: var(--bg-surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-lg);
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand-name {
  font-weight: 600;
  line-height: 1.2;
}

.sidebar-brand-tag {
  font-size: 0.75rem;
  color: var(--text-40);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.sidebar-group {
  padding-top: 0.75rem;
}

.sidebar-group-label {
  padding: 0 0.75rem 0.25rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-30);
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: var(--radius-lg);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-70);
  transition: background-color 0.15s, color 0.15s;
}

.nav-link + .nav-link {
  margin-top: 0.25rem;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-link.is-active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.nav-link.is-category {
  gap: 0.625rem;
  font-weight: 400;
}

.nav-link.is-category.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-link-tag {
  font-size: 10px;
  color: var(--text-30);
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.sidebar-user-mail {
  font-size: 0.75rem;
  color: var(--text-40);
}

/* ----------------------------------------------------------------- barra de filtros */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
  .toolbar {
    flex-direction: row;
    align-items: center;
  }
}

.tabs {
  display: flex;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 0.25rem;
}

.tab {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-60);
  transition: background-color 0.15s, color 0.15s;
}

.tab:hover {
  color: #fff;
}

.tab.is-active {
  background: var(--accent);
  color: #fff;
}

.search {
  position: relative;
  flex: 1;
}

.search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-40);
  pointer-events: none;
}

.search .input {
  padding-left: 2.25rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.filter-chip a {
  display: inline-flex;
  color: var(--text-40);
}

.filter-chip a:hover {
  color: #fff;
}

/* ----------------------------------------------------------------- cards de credencial */

.vault-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .vault-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .vault-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cred-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cred-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.cred-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

.cred-title:hover {
  color: var(--accent);
}

.cred-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.25rem;
}

.cred-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-40);
  margin-top: 0.375rem;
}

.cred-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.cred-secret {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cred-secret-value {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cred-note {
  font-size: 0.75rem;
  color: var(--text-50);
}

.confirm-hint {
  font-size: 0.75rem;
  color: #facc15;
}

/* ----------------------------------------------------------------- detalhe */

.field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  padding: 0.5rem 0.75rem;
}

.field-caption {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-40);
  margin-bottom: 0.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-60);
  margin-bottom: 1rem;
}

.back-link:hover {
  color: #fff;
}

.timeline {
  position: relative;
  border-left: 1px solid var(--line-strong);
  margin: 0 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

.timeline li {
  margin-left: 1.25rem;
}

.timeline li + li {
  margin-top: 1.25rem;
}

.timeline-dot {
  position: absolute;
  left: -9px;
  display: flex;
  width: 1rem;
  height: 1rem;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--bg-surface);
  box-shadow: 0 0 0 2px var(--line-strong);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-40);
  margin-top: 0.125rem;
}

.action-created { color: #34d399; }
.action-updated { color: #60a5fa; }
.action-copied  { color: #fbbf24; }
.action-shared  { color: var(--accent); }
.action-viewed  { color: var(--text-50); }

/* ----------------------------------------------------------------- força da senha */

.strength {
  margin-top: 0.5rem;
}

.strength-track {
  height: 0.5rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, 0.1);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s;
}

.strength-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-50);
  margin-top: 0.25rem;
}

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: modal-in 0.18s ease-out;
}

.modal.is-closing {
  animation: modal-out 0.18s ease-in forwards;
}

.modal-panel {
  width: 100%;
  max-width: 32rem;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  animation: panel-in 0.18s ease-out;
}

.modal.is-closing .modal-panel {
  animation: panel-out 0.18s ease-in forwards;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--text-60);
  cursor: pointer;
  display: inline-flex;
}

.modal-close:hover {
  color: #fff;
}

.modal-caption {
  margin: -0.5rem 0 0.25rem;
}

.modal-body p {
  font-size: 0.875rem;
  color: var(--text-70);
  margin: 0;
}

.modal-foot {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

@keyframes modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes panel-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(16px) scale(0.98); }
}

/* ----------------------------------------------------------------- compartilhamento */

.share-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 18rem;
  overflow-y: auto;
}

.share-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.share-list li + li {
  border-top: 1px solid var(--line);
}

/* ----------------------------------------------------------------- paleta de cores */

.color-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.color-swatch {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  border: 0;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.color-swatch.is-active {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px #fff;
}

input[type='color'].color-swatch {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
}

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.2s ease-out;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease-in forwards;
}

.toast-mark {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: #34d399;
}

.toast.is-error .toast-mark {
  background: #f87171;
}

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

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(16px); }
}

/* ----------------------------------------------------------------- utilidades */

.hidden {
  display: none !important;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.pt-1 { padding-top: 0.25rem; }
