/* ─── RESET & BASE ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Aliases → Design System V2 Mídia (shared.css).
   Os tokens base (--bg, --border, --text, --green, --red, --blue, --accent,
   --radius, --font, --mono…) são definidos no shared.css e trocam de tema
   (dark/light) automaticamente. Aqui apenas mapeamos os nomes locais do
   módulo para esses tokens, mantendo as classes existentes intactas. */
:root {
  --bg2:          var(--bg-surface);
  --bg3:          var(--bg-card);
  --bg4:          var(--bg-card-hover);
  --border-hi:    var(--border-md);

  --text2:        var(--text-dim);
  --text3:        var(--text-muted);

  --amber:        var(--orange);
  --amber-dim:    var(--orange-dim);

  --accent-glow:  var(--accent-dim);

  --font-display: var(--font);
  --font-body:    var(--font);
  --font-mono:    var(--mono);

  --radius-lg:    var(--radius);
  --shadow:       0 4px 24px rgba(0,0,0,.4);
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  min-height: 100vh;
}

/* ─── HEADER ────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: .9rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.25rem;
  color: var(--accent);
  line-height: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: .04em;
  color: var(--text);
}

.nav {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .4rem .85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.nav-btn:hover { color: var(--text); background: var(--bg3); }

.nav-btn.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* ─── MAIN ──────────────────────────────────────────────── */
.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ─── VIEWS ─────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; animation: fadeIn .25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── PAGE HEADER ───────────────────────────────────────── */
.page-header { margin-bottom: 2rem; }

.page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
}

.page-sub {
  color: var(--text2);
  font-size: .9rem;
  margin-top: .3rem;
}

/* ─── STATS ─────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--text);
}

.stat-value.accent-green { color: var(--green); }
.stat-value.accent-amber { color: var(--amber); }

/* ─── SECTION TITLE ─────────────────────────────────────── */
.section-title {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  margin-bottom: .9rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}

/* ─── DOC LIST ──────────────────────────────────────────── */
.doc-list { display: flex; flex-direction: column; gap: .6rem; }

.doc-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color .15s;
  cursor: default;
}

.doc-item:hover { border-color: var(--border-hi); }

.doc-item-icon {
  width: 36px;
  height: 36px;
  background: var(--bg3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  color: var(--accent);
}

.doc-item-info { flex: 1; min-width: 0; }

.doc-item-name {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-item-meta {
  font-size: .75rem;
  color: var(--text3);
  margin-top: .1rem;
}

.doc-item-badge {
  font-size: .65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .25rem .65rem;
  border-radius: 99px;
  flex-shrink: 0;
}

.badge-signed   { background: var(--green-dim);  color: var(--green); }
.badge-key      { background: var(--amber-dim);  color: var(--amber); }
.badge-valid    { background: var(--green-dim);  color: var(--green); }
.badge-invalid  { background: var(--red-dim);    color: var(--red);   }
.badge-pending  { background: var(--amber-dim);  color: var(--amber); }
.badge-viewed   { background: var(--blue-dim);   color: var(--blue);  }
.badge-expired  { background: var(--bg3);        color: var(--text3); }

/* ─── EMPTY STATE ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text3);
}

.empty-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: .75rem;
  opacity: .4;
}

.empty-state p { font-size: .9rem; line-height: 1.7; }
.empty-state strong { color: var(--text2); font-weight: 500; }

/* ─── CARD ──────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

/* ─── FORM ELEMENTS ─────────────────────────────────────── */
.field-label {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: .5rem;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: .9rem;
  padding: .7rem 1rem;
  outline: none;
  transition: border-color .15s;
  appearance: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
}

.textarea {
  resize: vertical;
  line-height: 1.6;
}

.textarea.mono {
  font-family: var(--font-mono);
  font-size: .8rem;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234e5668'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.hint {
  font-size: .78rem;
  color: var(--text3);
  margin-top: .75rem;
  line-height: 1.5;
}

/* ─── BUTTONS ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.4rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: .03em;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
}

.btn:active { transform: scale(.97); }

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

.btn-primary:hover { opacity: .88; }

.btn-ghost {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
}

.btn-ghost:hover { border-color: var(--border-hi); color: var(--text); }

.btn-icon { font-size: .8rem; }

/* ─── RESULT PANEL ──────────────────────────────────────── */
.result-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  animation: fadeIn .3s ease;
}

.result-panel.hidden { display: none; }

.result-header { margin-bottom: 1.25rem; }

.result-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .3rem .75rem;
  border-radius: 99px;
}

.result-badge.success { background: var(--green-dim); color: var(--green); }
.result-badge.error   { background: var(--red-dim);   color: var(--red);   }

/* ─── MONO BLOCK ─────────────────────────────────────────── */
.mono-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mono-block.wrap {
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

.mono-block.small { font-size: .7rem; max-height: 120px; overflow-y: auto; }

/* ─── VERIFY RESULT ─────────────────────────────────────── */
.verify-valid, .verify-invalid {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius);
}

.verify-valid   { background: var(--green-dim); border: 1px solid rgba(61,202,122,.2); }
.verify-invalid { background: var(--red-dim);   border: 1px solid rgba(232,80,96,.2);  }

.verify-icon { font-size: 1.5rem; line-height: 1; }

.verify-title {
  font-weight: 500;
  font-size: .95rem;
  margin-bottom: .2rem;
}

.verify-valid   .verify-title { color: var(--green); }
.verify-invalid .verify-title { color: var(--red); }

.verify-desc { font-size: .82rem; color: var(--text2); }

/* ─── MODAL ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow);
  animation: fadeIn .2s ease;
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1rem;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}

.modal-close:hover { color: var(--text); background: var(--bg3); }

.modal-body { padding: 1.5rem; }

.modal-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
}

.redacted {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text3);
  letter-spacing: .05em;
}

/* ─── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row .stat-card:last-child { grid-column: span 2; }
  .main { padding: 1.5rem 1rem 3rem; }
}
