:root {
  /* Design system Tauri — preto, branco, dourado */
  --bg: #0a0a0a;
  --bg-2: #111111;
  --surface: #151515;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --border: #2a2a2a;
  --border-bright: #3a3a3a;
  --text: #f5f5f5;
  --text-dim: #a8a8a8;
  --text-faint: #6b6b6b;

  --gold: #c9a961;
  --gold-bright: #d4b876;
  --gold-dark: #a68a4a;
  --gold-soft: rgba(201, 169, 97, 0.1);
  --gold-softer: rgba(201, 169, 97, 0.05);
  --gold-border: rgba(201, 169, 97, 0.25);

  /* Status colors derivados do dourado */
  --ok: #4a8a4a;
  --ok-soft: rgba(74, 138, 74, 0.12);
  --warn: var(--gold);
  --warn-soft: var(--gold-soft);
  --err: #c25050;
  --err-soft: rgba(194, 80, 80, 0.12);

  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Menlo', 'Consolas', monospace;
  --radius: 8px;
  --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at top, rgba(201,169,97,0.04), transparent 55%),
    radial-gradient(ellipse at bottom, rgba(201,169,97,0.02), transparent 55%);
  pointer-events: none; z-index: 0;
}

a { color: var(--gold); text-decoration: none; transition: color .15s; }
a:hover { color: var(--gold-bright); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10,10,10,0.85); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 22px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 14px; color: var(--text); }
.brand-logo {
  height: 30px; width: auto;
  filter: invert(1) brightness(1.05);
  transition: filter .2s;
}
.brand:hover .brand-logo {
  filter: invert(79%) sepia(34%) saturate(462%) hue-rotate(5deg) brightness(92%) contrast(86%);
}
.brand-sep { width: 1px; height: 20px; background: var(--border); }
.brand-app {
  font-size: 12px; font-weight: 500; letter-spacing: 1.8px;
  text-transform: uppercase; color: var(--gold);
  font-family: var(--sans);
}
.topbar-links { display: flex; align-items: center; gap: 22px; font-size: 14px; flex-wrap: wrap; }
.topbar-links a { color: var(--text-dim); font-weight: 500; transition: color .15s; }
.topbar-links a:hover { color: var(--text); }
.topbar-links a.active { color: var(--gold); }
.topbar-links a.admin-link { color: var(--gold); font-weight: 600; }
.topbar-sep { width: 1px; height: 14px; background: var(--border); }
.topbar-user { font-size: 13px; color: var(--text-faint); font-weight: 500; }
.topbar-logout { color: var(--text-faint) !important; font-size: 13px; }
.topbar-logout:hover { color: var(--err) !important; }

/* ---------- Layout ---------- */
.app { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; padding: 44px 28px 100px; }
.app-wide { max-width: 1120px; }

.flash {
  padding: 12px 18px; border-radius: 10px; margin-bottom: 20px;
  font-size: 14px; font-weight: 500;
  border: 1px solid;
}
.flash-ok  { background: var(--ok-soft); color: var(--ok); border-color: rgba(74,138,74,.3); }
.flash-err { background: var(--err-soft); color: var(--err); border-color: rgba(194,80,80,.3); }

/* ---------- Header ---------- */
.header { text-align: center; margin-bottom: 44px; }
.header-tag {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--gold); padding: 7px 18px;
  background: var(--gold-soft); border: 1px solid var(--gold-border);
  border-radius: 100px; margin-bottom: 22px;
  animation: fadeD 0.5s ease;
}
.header-tag::before {
  content: ''; width: 6px; height: 6px; background: var(--gold);
  border-radius: 50%; animation: pulse 2.2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.header h1 {
  font-size: 38px; font-weight: 800; letter-spacing: -1.2px;
  color: var(--text);
  margin-bottom: 10px;
  animation: fadeD .5s ease .1s both;
  line-height: 1.1;
}
.header p {
  color: var(--text-dim); font-size: 15px; font-weight: 400;
  animation: fadeD .5s ease .15s both;
}
@keyframes fadeD {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Progress ---------- */
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; }
.progress-label span {
  font-size: 11px; color: var(--text-faint);
  font-weight: 500; letter-spacing: 1.2px; text-transform: uppercase;
}
.progress-track { display: flex; gap: 4px; margin-bottom: 28px; }
.progress-seg { flex: 1; height: 3px; border-radius: 2px; background: var(--border); transition: background .4s; }
.progress-seg.done   { background: var(--gold-dark); }
.progress-seg.active { background: var(--gold); box-shadow: 0 0 10px rgba(201,169,97,.4); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 14px;
  animation: cardIn .4s ease;
  position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-border), transparent);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0; margin-bottom: 18px;
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid var(--gold-border);
  font-family: var(--sans);
}
.card-icon.alt { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }

.card-title {
  font-size: 19px; font-weight: 700; margin-bottom: 6px; letter-spacing: -.4px; color: var(--text);
}
.card-desc {
  font-size: 13.5px; color: var(--text-dim);
  margin-bottom: 14px; line-height: 1.6; font-weight: 400;
}
.card-hint {
  font-size: 13px; color: var(--text-dim);
  background: var(--gold-softer); border: 1px solid var(--gold-border);
  padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; line-height: 1.6;
}
.card-hint strong { color: var(--gold); font-weight: 700; }
.card-hint em { color: var(--text); font-style: italic; }

/* ---------- Forms ---------- */
label.fl {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--text-faint); margin-bottom: 10px;
}
input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea, select {
  width: 100%; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: var(--sans); font-size: 14.5px;
  padding: 12px 14px; transition: all .2s; outline: none; font-weight: 500;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
  background: var(--surface-3);
}
input::placeholder, textarea::placeholder {
  color: var(--text-faint); font-weight: 400;
}
textarea { resize: vertical; min-height: 48px; line-height: 1.55; }
select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c9a961' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
.fg { margin-bottom: 20px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- List items (wizard) ---------- */
.items { display: flex; flex-direction: column; gap: 10px; }
.item-row { display: flex; gap: 10px; align-items: center; animation: cardIn .2s ease; }
.item-row input { flex: 1; }
.item-row .sub { flex: .55; }
.ib { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--gold); opacity: .6; }

.bd {
  width: 36px; height: 36px; background: none;
  border: 1px solid transparent; color: var(--text-faint);
  font-size: 17px; border-radius: 8px; cursor: pointer;
  flex-shrink: 0; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.bd:hover { color: var(--err); background: var(--err-soft); border-color: rgba(194,80,80,.25); }
.bd:disabled { opacity: .3; cursor: not-allowed; }

.ba {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; margin-top: 12px;
  background: none; border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--text-faint); font-family: var(--sans); font-size: 13.5px;
  font-weight: 600; cursor: pointer; transition: all .15s; user-select: none;
}
.ba:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-softer); }
.ba:disabled { opacity: .5; cursor: wait; }

.bg {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 10px; position: relative;
}
.bg input { background: var(--surface-3); }
.bgd {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none; color: var(--text-faint);
  cursor: pointer; font-size: 15px; transition: color .15s;
}
.bgd:hover { color: var(--err); }
.bgd:disabled { opacity: .3; cursor: not-allowed; }

.inherited { border-left: 2px solid var(--gold); padding-left: 8px; }
.inherited-badge {
  display: inline-block; font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--gold); background: var(--gold-soft);
  padding: 2px 10px; border-radius: 100px; margin-left: 6px;
  border: 1px solid var(--gold-border); font-weight: 700;
}
.item-check {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text-faint); cursor: pointer; user-select: none; white-space: nowrap;
  font-weight: 600;
}
.item-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--gold); cursor: pointer; }

/* ---------- Buttons ---------- */
.nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 32px; padding-top: 22px; gap: 12px;
}
.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 12px 26px; border-radius: 10px; cursor: pointer; border: none;
  transition: all .2s; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; letter-spacing: .2px;
}
.btn-gh { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-gh:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-softer); }
.btn-primary { background: var(--gold); color: #0a0a0a; font-weight: 700; }
.btn-primary:hover { background: var(--gold-bright); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(201,169,97,.3); }
.btn-white { background: #fff; color: #0a0a0a; font-weight: 700; }
.btn-white:hover { background: #f0f0f0; transform: translateY(-1px); }
.btn-ghost-gold { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-border); font-weight: 600; }
.btn-ghost-gold:hover { background: var(--gold); color: #0a0a0a; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #5aa25a; transform: translateY(-1px); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Legados (mantém retrocompatibilidade com nomes antigos) */
.btn-bl { background: var(--gold); color: #0a0a0a; font-weight: 700; }
.btn-bl:hover { background: var(--gold-bright); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(201,169,97,.3); }
.btn-gr { background: var(--ok); color: #fff; }
.btn-gr:hover { background: #5aa25a; transform: translateY(-1px); }

.save-status { font-size: 11.5px; color: var(--text-faint); min-height: 14px; font-weight: 500; letter-spacing: .3px; }
.save-status.ok     { color: var(--ok); }
.save-status.err    { color: var(--err); }
.save-status.saving { color: var(--gold); }

/* ---------- Output (email preview) ---------- */
.ow { animation: cardIn .5s ease; }
.otabs { display: flex; gap: 2px; padding-left: 14px; }
.otab {
  font-family: var(--mono); font-size: 12px; padding: 9px 18px;
  background: var(--surface-2); color: var(--text-faint);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 10px 10px 0 0; cursor: pointer; transition: all .15s;
  font-weight: 500;
}
.otab.act { background: var(--surface); color: var(--gold); border-color: var(--gold-border); border-bottom-color: transparent; }
.obox {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg); overflow: hidden;
}
.otbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.otbar-l { font-family: var(--mono); font-size: 11px; color: var(--text-faint); letter-spacing: .3px; }
.bc {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  padding: 7px 16px; border-radius: 7px; cursor: pointer; transition: all .15s;
  border: 1px solid var(--gold-border); background: var(--gold-soft); color: var(--gold);
  text-transform: uppercase; letter-spacing: 1px;
}
.bc:hover { background: var(--gold); color: #0a0a0a; }
.bc.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.obody {
  padding: 26px; font-family: var(--mono); font-size: 12.5px; line-height: 1.95;
  white-space: pre-wrap; word-wrap: break-word; max-height: 580px;
  overflow-y: auto; color: var(--text);
}
.obody::-webkit-scrollbar { width: 6px; }
.obody::-webkit-scrollbar-track { background: transparent; }
.obody::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--surface-3); color: var(--gold); font-weight: 700;
  font-size: 13px; padding: 12px 24px; border-radius: 10px;
  border: 1px solid var(--gold-border); opacity: 0; transition: all .3s;
  z-index: 999; pointer-events: none;
  letter-spacing: .3px;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- Auth ---------- */
.auth-wrapper { min-height: calc(100vh - 40px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { max-width: 440px; width: 100%; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo img { height: 86px; width: auto; filter: invert(1) brightness(1.05); }

.auth-links {
  margin-top: 20px; text-align: center; font-size: 13.5px;
  color: var(--text-dim); font-weight: 500;
}

/* ---------- Tables ---------- */
.list-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.list-table th, .list-table td {
  padding: 14px 18px; text-align: left; font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.list-table th {
  background: var(--bg-2); font-size: 11px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 1.3px; font-weight: 700;
}
.list-table tr:last-child td { border-bottom: none; }
.list-table tr:hover td { background: var(--surface-2); }
.list-table td .mono { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }

.badge {
  display: inline-block; font-size: 10.5px; padding: 3px 11px;
  border-radius: 100px; border: 1px solid; letter-spacing: 1.3px;
  text-transform: uppercase; font-weight: 700;
}
.badge-gold  { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-border); }
.badge-draft { background: var(--warn-soft); color: var(--gold); border-color: var(--gold-border); }
.badge-done  { background: var(--ok-soft); color: var(--ok); border-color: rgba(74,138,74,.3); }
.badge-seen  { background: rgba(255,255,255,0.06); color: #fff; border-color: rgba(255,255,255,0.15); }
.badge-neutral { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 28px; }
.dash-kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  position: relative; overflow: hidden;
}
.dash-kpi::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--gold); opacity: .5;
}
.dash-kpi-l {
  font-size: 11px; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 1.5px; margin-bottom: 8px; font-weight: 700;
}
.dash-kpi-v { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -.5px; }
.dash-kpi-v small { color: var(--text-faint); font-weight: 500; font-size: 15px; margin-left: 4px; }

.dash-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }

/* ---------- Admin report view ---------- */
.seen-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold-softer));
  border: 1px solid var(--gold-border);
  padding: 16px 22px; border-radius: var(--radius-lg);
  margin-bottom: 22px; flex-wrap: wrap;
}
.seen-banner .seen-label {
  font-size: 13px; color: var(--text-dim); font-weight: 500;
}
.seen-banner .seen-stamp {
  font-size: 16px; font-weight: 700; color: var(--gold);
  display: flex; align-items: center; gap: 10px;
}
.seen-banner .seen-stamp::before {
  content: '✓'; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold); color: #0a0a0a; font-size: 14px; font-weight: 900;
}

/* ---------- Audit timeline ---------- */
.audit-list { display: flex; flex-direction: column; gap: 0; }
.audit-row {
  display: grid; grid-template-columns: 150px 1fr auto; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  font-size: 13.5px; align-items: center;
}
.audit-row:last-child { border-bottom: none; }
.audit-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
.audit-who { color: var(--text); font-weight: 600; }
.audit-who .small { color: var(--text-faint); font-weight: 400; font-size: 12px; margin-left: 4px; }
.audit-action { color: var(--text-dim); }
.audit-action .dot { color: var(--gold); }

/* ---------- Misc ---------- */
.empty-state {
  text-align: center; color: var(--text-dim); padding: 40px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.section-title {
  font-size: 18px; font-weight: 700; margin: 36px 0 16px;
  color: var(--text); letter-spacing: -.3px;
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.info-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-faint); font-weight: 500;
  padding: 5px 10px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 100px;
}

@media (max-width: 720px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .g2 { grid-template-columns: 1fr; }
  .item-row { flex-wrap: wrap; }
  .item-row .sub { flex: 1 1 100%; }
  .app { padding: 28px 18px 80px; }
  .header h1 { font-size: 28px; }
  .list-table th, .list-table td { padding: 11px 14px; font-size: 13px; }
  .audit-row { grid-template-columns: 1fr; gap: 4px; }
  .audit-time { order: 2; }
}
