:root {
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --bg: #f5f3fa;
  --card: #fff;
  --text: #1f1b2e;
  --muted: #6b6880;
  --border: #e6e2f0;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }

/* layout admin */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #1f1b2e; color: #fff; padding: 20px 12px; flex-shrink: 0; }
.sidebar .brand { font-weight: 700; font-size: 18px; padding: 0 10px 20px; }
.sidebar a { display: block; color: #cfc9e6; text-decoration: none; padding: 10px 12px; border-radius: 8px; margin-bottom: 2px; }
.sidebar a:hover, .sidebar a.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar form button { width: 100%; text-align: left; background: none; border: 0; color: #cfc9e6; padding: 10px 12px; cursor: pointer; font: inherit; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { flex: 1; padding: 28px; min-width: 0; }
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  /* menu vira barra superior fixa com rolagem horizontal */
  .sidebar { width: 100%; height: auto; display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; padding: 8px 10px;
    overflow-x: auto; overflow-y: hidden; z-index: 10; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .brand { width: auto; padding: 0 8px 0 4px; font-size: 15px; white-space: nowrap; flex-shrink: 0; }
  .sidebar a, .sidebar form button { white-space: nowrap; flex-shrink: 0; margin: 0; padding: 8px 10px; font-size: 14px; }
  .sidebar form { flex-shrink: 0; }
  .main { padding: 16px; }
}

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }

label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: #fff; color: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 160px; }
.row > .shrink { flex: 0 0 auto; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; background: var(--primary); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--primary-dark); }
.btn.sec { background: #fff; color: var(--text); border-color: var(--border); }
.btn.sec:hover { background: #f3f0fa; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--err); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
form.inline { display: inline; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.b-confirmado, .b-pago { background: #dcfce7; color: #166534; }
.b-recusado { background: #fee2e2; color: #991b1b; }
.b-pendente { background: #fef3c7; color: #92400e; }
.b-nenhuma { background: #f1f0f5; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 6px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 13px; }
.tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.progress { height: 10px; background: #eee; border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress > div { height: 100%; background: var(--primary); transition: width .3s; }
.preview { white-space: pre-wrap; background: #e7f8e3; border-radius: 10px; padding: 12px; font-size: 14px; }

/* celular: tabelas .stack viram cartões, cada célula com o rótulo da coluna (data-label) */
@media (max-width: 720px) {
  h1 { font-size: 21px; }
  .card { padding: 14px; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px; }
  .stat .n { font-size: 22px; }
  .actions .btn, .head-actions .btn { flex: 1; justify-content: center; }
  .btn { white-space: normal; text-align: center; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr:first-child:has(th) { display: none; }
  table.stack tr { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: #fff; }
  table.stack td { border: 0; padding: 5px 0; display: flex; gap: 10px; align-items: flex-start; }
  table.stack td[data-label]::before { content: attr(data-label); flex: 0 0 96px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
  table.stack td > * { min-width: 0; }
  table.stack td.cell-full { display: block; }
  table.stack td:empty { display: none; }
  .table-wrap:has(table.stack) { overflow: visible; }
  .card.table-wrap:has(table.stack) { background: none; border: 0; padding: 0; }
}

/* login */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 360px; }

td.contact { white-space: nowrap; }
@media (max-width: 720px) {
  td.contact { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 720px) {
  .page-head > .shrink { flex: 1 1 100%; }
  .page-head > .shrink > .btn { width: 100%; justify-content: center; }
}
