/* tm-base.css — Central Thiago Marques · Base compartilhada v2 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --gold: #D4AF37; --gold2: #C9922A; --gold-dim: rgba(212,175,55,.12);
  --bg: #0B0B0B; --bg2: #111111; --bg3: #161616; --bg4: #1c1c1c;
  --border: #222222; --text: #e8e8e8; --muted: rgba(255,255,255,.4);
  --green: #2ecc71; --red: #e05555; --yellow: #f0a500;
  --radius: 10px; --shadow: 0 4px 24px rgba(0,0,0,.55);
}

body {
  background: var(--bg); color: var(--text);
  font-family: 'Montserrat', sans-serif;
  min-height: 100vh; font-size: 14px; line-height: 1.5;
  padding-top: 48px;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── PAGE HEADER ── */
.page-header {
  padding: 32px 24px 24px;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse at 50% 0%, rgba(212,175,55,.05) 0%, transparent 60%);
}
.page-title { font-family: 'Bebas Neue', sans-serif; font-size: clamp(26px,4vw,40px); letter-spacing: 4px; color: var(--gold); line-height: 1; }
.page-sub { font-size: 11px; color: var(--muted); margin-top: 5px; letter-spacing: 1px; }

/* ── CONTAINER ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.section { padding: 28px 0; }
.section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--gold);
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── KPI CARDS ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.kpi-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px; transition: border-color .2s; }
.kpi-card.highlight { border-color: rgba(212,175,55,.25); background: linear-gradient(135deg, rgba(212,175,55,.07) 0%, var(--bg2) 70%); }
.kpi-label { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--gold); line-height: 1; }
.kpi-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* ── GENERIC CARD ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.card-sub { font-size: 12px; color: var(--muted); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: .5px; transition: all .15s; cursor: pointer; font-family: inherit; }
.btn-primary { background: var(--gold); color: #111; border: 1px solid var(--gold); }
.btn-primary:hover { background: var(--gold2); border-color: var(--gold2); }
.btn-secondary { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); border-color: #444; }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(224,85,85,.3); }
.btn-danger:hover { background: rgba(224,85,85,.1); }
.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-ghost { padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid transparent; transition: all .15s; }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

/* ── FORMS ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--muted); text-transform: uppercase; }
.form-input, .form-select, .form-textarea {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 13px; color: var(--text); font-family: inherit; font-size: 13px;
  outline: none; transition: border-color .2s; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold2); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }
.form-select { appearance: none; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); background: var(--bg2); white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg3); }
.data-table tr:last-child td { border-bottom: none; }
.td-actions { display: flex; gap: 6px; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.78); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-title { font-size: 15px; font-weight: 700; color: var(--gold); }
.modal-close { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 18px; cursor: pointer; transition: color .15s; }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 12px; font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }
.badge-green { background: rgba(46,204,113,.15); color: #2ecc71; }
.badge-yellow { background: rgba(240,165,0,.15); color: var(--yellow); }
.badge-red { background: rgba(224,85,85,.15); color: var(--red); }
.badge-gold { background: var(--gold-dim); color: var(--gold); }
.badge-gray { background: rgba(255,255,255,.07); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: var(--green); } .dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); } .dot-gold { background: var(--gold); }

/* ── ACTION BAR ── */
.action-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.search-input { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 9px 14px; color: var(--text); font-family: inherit; font-size: 13px; outline: none; transition: border-color .2s; }
.search-input:focus { border-color: var(--gold2); }
.search-input::placeholder { color: var(--muted); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); font-size: 13px; }
.empty-icon { font-size: 36px; margin-bottom: 12px; }

/* ── FOOTER ── */
.site-footer { border-top: 1px solid var(--border); padding: 22px 24px; text-align: center; font-size: 11px; color: var(--muted); margin-top: 60px; }

/* ── BUTTONS — LOADING STATE ── */
.btn[disabled], .btn.loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn.loading::after {
  content: '';
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .6s linear infinite;
  display: inline-block; margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SKELETON LOADER ── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 1200px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 4px;
}
.skeleton-line { height: 12px; border-radius: 3px; margin-bottom: 8px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }

/* ── TOAST NOTIFICATIONS ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; font-size: 13px; color: var(--text);
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px;
  animation: toastIn .25s ease; max-width: 320px;
}
.toast.toast-success { border-color: rgba(46,204,113,.4); }
.toast.toast-error   { border-color: rgba(224,85,85,.4); }
.toast.toast-out     { animation: toastOut .25s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(10px); } }

/* ── LOADING OVERLAY ── */
.page-loading {
  position: fixed; inset: 0; background: var(--bg); z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
}
.page-loading .spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--gold);
  animation: spin .7s linear infinite;
}
.page-loading p { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  body { padding-top: 48px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { padding: 20px 16px; }
  .container { padding: 0 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .modal { padding: 20px; }
}
/* Viewport 384px (TWA / celular no show) */
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }
  .modal { padding: 16px; }
  #toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { max-width: 100%; }
}
