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

:root {
  --gold: #C9A84C;
  --gold-light: #E2C46E;
  --bg: #0F0F0F;
  --bg2: #161616;
  --bg3: #1E1E1E;
  --bg4: #252525;
  --border: #2A2A2A;
  --text: #F0F0F0;
  --text2: #A0A0A0;
  --text3: #666;
  --danger: #E05555;
  --success: #4CAF7D;
  --warning: #E0A855;
  --sidebar-w: 220px;
  --radius: 10px;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* LOGIN */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a1500 0%, #0F0F0F 70%);
}
.login-box {
  width: 360px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 48px 40px; display: flex; flex-direction: column; gap: 16px;
}
.login-logo { display: flex; justify-content: center; }
.login-logo svg { width: 56px; height: 56px; }
.login-title { text-align: center; font-size: 20px; font-weight: 700; color: var(--gold); }
.login-sub { text-align: center; font-size: 13px; color: var(--text2); margin-top: -8px; }
.login-error { background: rgba(224,85,85,.12); border: 1px solid rgba(224,85,85,.3); color: var(--danger); font-size: 13px; padding: 10px 14px; border-radius: 8px; }
.login-input {
  width: 100%; padding: 12px 16px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; outline: none; transition: border-color .2s;
}
.login-input:focus { border-color: var(--gold); }
.login-btn {
  width: 100%; padding: 13px; background: var(--gold); color: #000; font-size: 14px; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer; transition: background .2s; margin-top: 4px;
}
.login-btn:hover { background: var(--gold-light); }

/* APP LAYOUT */
.app { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 10;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title { font-size: 14px; font-weight: 600; color: var(--gold); }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: var(--text2); font-size: 13px; font-weight: 500;
  text-decoration: none; transition: all .15s; cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(201,168,76,.12); color: var(--gold); }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.admin-info { display: flex; align-items: center; justify-content: space-between; }
.admin-name { font-size: 13px; font-weight: 500; color: var(--text2); }
.logout-btn { font-size: 12px; color: var(--text3); text-decoration: none; }
.logout-btn:hover { color: var(--danger); }

/* MAIN */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 56px; border-bottom: 1px solid var(--border); background: var(--bg2);
  display: flex; align-items: center; padding: 0 28px; position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.content { padding: 28px; flex: 1; }

/* CARDS MÉTRICAS */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.metric-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 8px;
}
.metric-label { font-size: 12px; color: var(--text2); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.metric-value { font-size: 28px; font-weight: 700; color: var(--text); }
.metric-value.gold { color: var(--gold); }
.metric-value.danger { color: var(--danger); }
.metric-value.warning { color: var(--warning); }
.metric-value.success { color: var(--success); }

/* SECTION HEADER */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h2 { font-size: 16px; font-weight: 600; }

/* BTN */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: all .15s; text-decoration: none;
}
.btn-primary { background: var(--gold); color: #000; }
.btn-primary:hover { background: var(--gold-light); }
.btn-ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg4); }
.btn-danger { background: rgba(224,85,85,.12); color: var(--danger); border: 1px solid rgba(224,85,85,.2); }
.btn-danger:hover { background: rgba(224,85,85,.22); }
.btn-success { background: rgba(76,175,125,.12); color: var(--success); border: 1px solid rgba(76,175,125,.2); }
.btn-success:hover { background: rgba(76,175,125,.22); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* TABLE */
.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); background: var(--bg3); }
td { padding: 13px 16px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }
.td-actions { display: flex; gap: 6px; }

/* BADGE */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-ativo    { background: rgba(76,175,125,.15); color: var(--success); }
.badge-bloqueado{ background: rgba(224,85,85,.15);  color: var(--danger);  }
.badge-inativo  { background: rgba(160,160,160,.15);color: var(--text2);   }
.badge-expiring { background: rgba(224,168,85,.15); color: var(--warning); }

/* TIPO BADGE */
.badge-flip    { background: rgba(201,168,76,.15); color: var(--gold); }
.badge-cota    { background: rgba(100,160,220,.15);color: #6AA0DC; }
.badge-empr    { background: rgba(120,200,140,.15);color: #78C88C; }
.badge-evento  { background: rgba(180,100,220,.15);color: #B464DC; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[style*="flex"] { display: flex; }
.modal-box {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* FORM */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text2); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; outline: none; font-family: inherit;
  transition: border-color .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); }
.form-select option { background: var(--bg3); }
.form-textarea { resize: vertical; min-height: 80px; }

/* COTAS */
.cotas-list { display: flex; flex-direction: column; gap: 8px; }
.cota-row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 8px; align-items: center; }

/* EMPTY */
.empty-state { padding: 48px; text-align: center; color: var(--text3); font-size: 14px; }

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(8px); transition: all .25s; pointer-events: none; z-index: 200;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(224,85,85,.4); color: var(--danger); }
.toast.success { border-color: rgba(76,175,125,.4); color: var(--success); }

/* SEARCH */
.search-input {
  padding: 9px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; outline: none; width: 240px;
}
.search-input:focus { border-color: var(--gold); }
.toolbar { display: flex; align-items: center; gap: 10px; }

/* FOTO DROP */
.opp-foto-drop {
  width: 100%; height: 160px; border: 1.5px dashed var(--border); border-radius: 10px;
  cursor: pointer; position: relative; overflow: hidden; transition: border-color .2s;
  display: flex; align-items: center; justify-content: center;
}
.opp-foto-drop:hover { border-color: var(--gold); }
.opp-foto-ph { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text3); font-size: 13px; pointer-events: none; }
.opp-foto-ph svg { width: 32px; height: 32px; }

/* GALERIA */
.opp-galeria-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.opp-galeria-thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.opp-galeria-thumb img { width: 100%; height: 100%; object-fit: cover; }
.opp-galeria-thumb button {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  background: rgba(0,0,0,.7); color: #fff; border: none; border-radius: 50%;
  font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* COTAS */
.opp-cotas-list { display: flex; flex-direction: column; gap: 8px; }
.opp-cota-row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 8px; align-items: center; }

/* SEARCHABLE SELECT */
.ss-wrap { position: relative; }
.ss-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text2); transition: border-color .2s;
}
.ss-trigger:hover, .ss-trigger.ss-open { border-color: var(--gold); }
.ss-trigger.ss-disabled { opacity: .5; cursor: not-allowed; }
.ss-value.selected { color: var(--text); }
.ss-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; display: none; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.ss-dropdown.open { display: block; }
.ss-input {
  width: 100%; padding: 10px 14px; background: var(--bg4); border: none;
  border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px;
  outline: none; font-family: inherit;
}
.ss-list { list-style: none; max-height: 180px; overflow-y: auto; }
.ss-list li { padding: 9px 14px; font-size: 13px; cursor: pointer; color: var(--text2); }
.ss-list li:hover, .ss-list li.ss-selected { background: rgba(201,168,76,.1); color: var(--gold); }
.ss-hint { cursor: default !important; color: var(--text3) !important; font-style: italic; }

/* RADIO GROUP */
.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-opt {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--text2); transition: all .15s; user-select: none;
}
.radio-opt input[type="radio"] { display: none; }
.radio-opt:hover { border-color: var(--gold); color: var(--text); }
.radio-opt.active { border-color: var(--gold); background: rgba(201,168,76,.1); color: var(--gold); font-weight: 600; }

/* INFO BOX */
.ev-info-box {
  background: rgba(201,168,76,.08); border: 1px solid rgba(201,168,76,.2);
  border-radius: 8px; padding: 12px 16px; font-size: 13px; color: var(--text2);
  margin-bottom: 4px;
}

/* SETTINGS */
.settings-section { margin-bottom: 24px; }
.settings-section-title { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }
.settings-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.settings-row:last-of-type { border-bottom: none; }
.settings-row + .form-group { padding: 0 20px 16px; }
.settings-row-label { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.settings-row-sub { font-size: 12px; color: var(--text2); }

/* TOGGLE */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--bg4); border-radius: 24px;
  cursor: pointer; transition: background .2s;
  border: 1px solid var(--border);
}
.toggle-slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: var(--text3); top: 2px; left: 2px; transition: all .2s;
}
.toggle input:checked + .toggle-slider { background: rgba(201,168,76,.2); border-color: var(--gold); }
.toggle input:checked + .toggle-slider::before { background: var(--gold); transform: translateX(20px); }

/* DIAS RESTANTES */
.dias { font-size: 12px; }
.dias.ok { color: var(--success); }
.dias.warn { color: var(--warning); }
.dias.late { color: var(--danger); }
