:root{
  --navy:#262a33;
  --navy-light:#3a3f4b;
  --gold:#d9a520;
  --gold-dark:#b8850f;
  --gold-light:#f0c94a;
  --red:#7a1f1f;
  --red-light:#9c2b2b;
  --bg:#faf8f3;
  --card:#ffffff;
  --text:#232323;
  --muted:#6b6b6b;
  --border:#e5ddc8;
  --slot-off:#f3f1ea;
  --slot-off-border:#e2ddcc;
  --slot-on:var(--gold);
  --slot-on-border:var(--gold-dark);
  --ok:#2f7a3d;
  --err:#a32020;
}

*{box-sizing:border-box;}

body{
  margin:0;
  padding:24px 16px 60px;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}

.wrap{
  max-width:920px;
  margin:0 auto;
}

.header{
  display:flex;
  align-items:center;
  gap:16px;
  margin-bottom:8px;
  flex-wrap:wrap;
}

.header img{
  width:64px;
  height:64px;
  object-fit:contain;
  flex-shrink:0;
}

.header h1{
  margin:0;
  font-size:1.5rem;
  color:var(--navy);
  letter-spacing:0.02em;
}

.header .banner{
  display:inline-block;
  background:var(--navy);
  color:var(--gold-light);
  font-size:0.7rem;
  font-weight:700;
  letter-spacing:0.08em;
  text-transform:uppercase;
  padding:3px 10px;
  border-radius:3px;
  margin-top:4px;
}

.subtitle{
  color:var(--muted);
  margin:4px 0 24px;
  font-size:0.95rem;
  line-height:1.4;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  padding:20px;
  margin-bottom:20px;
  box-shadow:0 1px 3px rgba(0,0,0,0.04);
}

.fields{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-bottom:4px;
}

@media (max-width:560px){
  .fields{grid-template-columns:1fr;}
}

label{
  display:block;
  font-size:0.82rem;
  font-weight:600;
  color:var(--navy);
  margin-bottom:6px;
}

input[type=text],input[type=email]{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:8px;
  font-size:0.95rem;
  background:#fffdf9;
  color:var(--text);
}

input[type=text]:focus,input[type=email]:focus{
  outline:none;
  border-color:var(--gold-dark);
  box-shadow:0 0 0 3px rgba(217,165,32,0.18);
}

.grid-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
  margin:18px 0 10px;
}

.grid-toolbar .hint{
  font-size:0.82rem;
  color:var(--muted);
}

.btn-mini{
  background:none;
  border:1px solid var(--border);
  color:var(--navy);
  font-size:0.78rem;
  padding:6px 10px;
  border-radius:6px;
  cursor:pointer;
}

.btn-mini:hover{background:var(--slot-off);}

.table-scroll{
  overflow-x:auto;
  border:1px solid var(--border);
  border-radius:10px;
  -webkit-overflow-scrolling:touch;
}

table.grid{
  border-collapse:collapse;
  table-layout:fixed;
  width:100%;
  min-width:420px;
  user-select:none;
}

.col-hour{width:58px;}

table.grid th, table.grid td{
  border:1px solid var(--slot-off-border);
  text-align:center;
  padding:0;
}

table.grid thead th{
  background:var(--navy);
  color:#fff;
  font-size:0.78rem;
  padding:9px 4px;
  position:sticky;
  top:0;
  z-index:2;
}

table.grid thead th:first-child{
  background:var(--navy);
  z-index:3;
}

table.grid tbody th{
  background:#fbf9f4;
  font-size:0.72rem;
  color:var(--muted);
  font-weight:600;
  padding:0 4px;
  white-space:nowrap;
  position:sticky;
  left:0;
  z-index:1;
}

td.slot{
  height:30px;
  background:var(--slot-off);
  cursor:pointer;
  transition:background 0.08s;
  touch-action:none;
}

td.slot:hover{
  background:#e9e4d4;
}

td.slot.on{
  background:var(--slot-on);
  border-color:var(--slot-on-border);
}

td.slot.on:hover{
  background:var(--gold-dark);
}

/* Linha em negrito separando manhã / tarde / noite */
tr.period-start th,
tr.period-start td.slot{
  border-top:2px solid var(--navy);
}

.legend{
  display:flex;
  gap:16px;
  flex-wrap:wrap;
  margin-top:12px;
  font-size:0.78rem;
  color:var(--muted);
}

.legend span{display:inline-flex;align-items:center;gap:6px;}

.swatch{
  width:14px;height:14px;border-radius:3px;display:inline-block;border:1px solid var(--slot-off-border);
}
.swatch.on{background:var(--slot-on);border-color:var(--slot-on-border);}
.swatch.off{background:var(--slot-off);}

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

button.primary{
  background:var(--red);
  color:#fff;
  border:none;
  padding:12px 24px;
  border-radius:8px;
  font-size:0.95rem;
  font-weight:700;
  cursor:pointer;
  letter-spacing:0.01em;
}

button.primary:hover{background:var(--red-light);}
button.primary:disabled{background:#c9b7b7;cursor:not-allowed;}

.status{
  margin-top:16px;
  padding:12px 14px;
  border-radius:8px;
  font-size:0.9rem;
  display:none;
}

.status.show{display:block;}
.status.ok{background:#eaf5ec;color:var(--ok);border:1px solid #bfe3c6;}
.status.err{background:#fbeaea;color:var(--err);border:1px solid #f1c4c4;}

.footer-note{
  text-align:center;
  color:var(--muted);
  font-size:0.78rem;
  margin-top:28px;
}

.hp-field{
  position:absolute;
  left:-9999px;
  top:-9999px;
  opacity:0;
  height:0;
  width:0;
}
