:root {
  --black:     #111111;
  --white:     #ffffff;
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-400:  #9ca3af;
  --gray-600:  #6b7280;
  --amber-bg:  #fffbeb;
  --amber:     #f59e0b;
  --amber-dk:  #b45309;
  --blue-bg:   #eff6ff;
  --blue:      #3b82f6;
  --blue-dk:   #1d4ed8;
  --green-bg:  #f0fdf4;
  --green:     #16a34a;
  --red:       #ef4444;
  --red-dk:    #b91c1c;
  --radius:    6px;
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12);
}

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

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--black);
  background: var(--white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--black);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

/* ── Page ── */
.page-body { padding: 24px 0 48px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--black);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: .875rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { opacity: .87; text-decoration: none; }
.btn:active { opacity: .75; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary  { background: var(--black); color: var(--white); }
.btn-secondary{ background: var(--white); color: var(--black); border-color: var(--gray-200); }
.btn-danger   { background: var(--red);   color: var(--white); }
.btn-ghost    { background: transparent;  color: var(--gray-600); border-color: transparent; }
.btn-sm       { padding: 5px 10px; font-size: .8rem; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-amber  { background: var(--amber-bg);  color: var(--amber-dk); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-dk);  }
.badge-green  { background: var(--green-bg);  color: var(--green);    }
.badge-gray   { background: var(--gray-100);  color: var(--gray-600); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }

label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .03em;
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: .9375rem;
  color: var(--black);
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  transition: border-color .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--black);
}
input::placeholder, textarea::placeholder { color: var(--gray-400); }
textarea { resize: vertical; min-height: 80px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
}
.form-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-400);
  margin-bottom: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  justify-content: flex-end;
}

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar select { width: auto; min-width: 180px; }

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-600);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

.td-actions { display: flex; gap: 6px; align-items: center; }
.td-name    { font-weight: 600; }
.td-sub     { font-size: .8rem; color: var(--gray-600); margin-top: 1px; }

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--gray-400);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 8px; }
.empty p    { font-size: .9rem; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  padding: 28px;
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--black); }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: #fef2f2; color: var(--red-dk); border: 1px solid #fecaca; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.alert-info    { background: var(--blue-bg); color: var(--blue-dk); border: 1px solid #bfdbfe; }

/* ── Detail card ── */
.detail-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}
.detail-card-header {
  background: var(--gray-50);
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
}
.detail-row {
  display: flex;
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-100);
  font-size: .9rem;
  gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  width: 160px;
  flex-shrink: 0;
  color: var(--gray-600);
  font-size: .8rem;
}
.detail-value { font-weight: 500; }

/* ── Status hero ── */
.status-hero {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-hero.amber { background: var(--amber-bg); color: var(--amber-dk); }
.status-hero.blue  { background: var(--blue-bg);  color: var(--blue-dk);  }
.status-hero.green { background: var(--green-bg); color: var(--green);    }
.status-hero.gray  { background: var(--gray-100); color: var(--gray-600); }
.status-hero-icon  { font-size: 1.4rem; }
.status-hero-text  { font-weight: 700; font-size: 1rem; }

/* ── Link box (pós-assinatura) ── */
.link-box {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 8px;
}
.link-input {
  flex: 1;
  font-size: .8rem;
  background: var(--gray-50);
  color: var(--gray-600);
}
.link-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ── Action bar ── */
.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--gray-50);
}
.login-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}
.login-logo-name { font-size: 1.15rem; font-weight: 800; }
.login-logo-sub  { font-size: .8rem; color: var(--gray-400); }

/* ── Responsive ── */
@media (min-width: 480px) {
  .form-grid-2 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
  .td-actions  { flex-direction: column; align-items: flex-start; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .detail-row  { flex-direction: column; gap: 2px; }
  .detail-label{ width: auto; }
  .login-card  { padding: 28px 20px; }
}

@media (min-width: 640px) {
  .container { padding: 0 24px; }
  .page-body { padding: 32px 0 64px; }
}
