@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@700;800;900&family=Karla:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root{
  --bg: #F5F0E6;
  --surface: #FFFFFF;
  --surface-2: #ECE2CD;
  --line: #DCD0B8;
  --text: #2B2318;
  --text-muted: #7A6C56;
  --accent: #B8862E;
  --accent-strong: #96690F;
  --accent-2: #A1462A;
  --good: #4C6B3C;
  --bad: #A23F2A;
  --font-display: 'Big Shoulders Display', 'Oswald', sans-serif;
  --font-body: 'Karla', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

*{ box-sizing: border-box; }
html, body{ margin: 0; padding: 0; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a{ color: var(--accent-strong); }
h1, h2, h3{ font-family: var(--font-display); text-transform: uppercase; font-weight: 800; letter-spacing: 0.01em; margin: 0 0 12px; }
h1{ font-size: 30px; }
h2{ font-size: 22px; }
h3{ font-size: 17px; }
p{ margin: 0 0 12px; }

.container{ max-width: 900px; margin: 0 auto; padding: 20px 18px 80px; min-width: 0; }

/* ---------- layout: menu lateral fixo à esquerda no desktop ---------- */
.app-layout{ display: flex; align-items: flex-start; min-height: 100vh; }
.main-content{ flex: 1; min-width: 0; overflow-x: hidden; }

.sidebar{
  width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 20px 0;
}
.sidebar .brand{
  font-family: var(--font-display); font-weight: 900; text-transform: uppercase; font-size: 20px;
  color: var(--text); text-decoration: none; padding: 0 20px 18px; display: block;
}
.sidebar .brand span{ color: var(--accent); }
.sidebar nav{ display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a{
  font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); text-decoration: none; padding: 11px 20px;
}
.sidebar nav a:hover, .sidebar nav a.active{ color: var(--text); background: var(--surface-2); }
.sidebar-user{
  font-size: 12px; color: var(--text-muted); padding: 16px 20px 0; margin-top: 12px;
  border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px;
}
.sidebar-user a{ color: var(--text-muted); }
.sidebar-user form{ margin: 0; }
.sidebar-user button.link{ background: none; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; font-family: var(--font-body); }

@media (max-width: 780px){
  .app-layout{ flex-direction: column; align-items: stretch; }
  .sidebar{
    width: 100%; height: auto; position: sticky; top: 0; z-index: 10;
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  }
  .sidebar .brand{ padding: 0 12px 0 0; }
  .sidebar nav{ flex-direction: row; flex-wrap: wrap; flex: 1; }
  .sidebar nav a{ padding: 8px 10px; }
  .sidebar-user{
    border-top: none; margin-top: 0; padding: 0; flex-direction: row; align-items: center; gap: 10px;
    width: 100%; order: 10;
  }
}

.artista-mobile{ display: none; }

@media (max-width: 480px){
  th, td{ padding: 8px 6px; font-size: 13px; }
  .table-wrap table{ min-width: 0 !important; }
  .input-posicao{ width: 34px !important; padding: 4px 2px !important; font-size: 12px; }
  .btn-play-mini{ width: 26px; height: 26px; font-size: 11px; }
  .col-secundaria{ display: none; }
  .table-setlist{ table-layout: fixed; width: 100%; }
  .table-setlist td, .table-setlist th{ overflow-wrap: break-word; }
  .table-setlist th:nth-child(1), .table-setlist td:nth-child(1){ width: 30px; }
  .table-setlist th:nth-child(2), .table-setlist td:nth-child(2){ width: 46px; }
  .table-setlist th:nth-child(3), .table-setlist td:nth-child(3){ width: 40px; }
  .artista-mobile{ display: block !important; font-size: 12px; font-weight: 700; color: var(--text); margin-top: 2px; }
}

/* ---------- cards / tables ---------- */
.card{ background: var(--surface); border: 1px solid var(--line); padding: 20px 22px; margin-bottom: 16px; }
.grid{ display: grid; gap: 14px; }
.grid.cols-2{ grid-template-columns: 1fr 1fr; }
.grid.cols-4{ grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px){ .grid.cols-2, .grid.cols-4{ grid-template-columns: 1fr 1fr; } }

.stat{ background: var(--surface); border: 1px solid var(--line); padding: 16px 18px; }
.stat .num{ font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat .num.bad{ color: var(--bad); }
.stat .num.good{ color: var(--good); }
.stat .label{ font-size: 12px; color: var(--text-muted); margin-top: 4px; }

table{ width: 100%; border-collapse: collapse; font-size: 14px; }
th, td{ text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
thead th{ font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); }
td.num{ font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table-wrap{ overflow-x: auto; border: 1px solid var(--line); }
.table-wrap table{ min-width: 480px; }

.genre-group{ border: 1px solid var(--accent); background: var(--surface-2); margin-bottom: 14px; }
.genre-group summary{
  cursor: pointer; padding: 14px 16px; font-family: var(--font-display); font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.03em; list-style: none; font-size: 17px; color: var(--accent-strong);
}
.genre-group summary::-webkit-details-marker{ display: none; }
.genre-group summary::before{ content: "▸ "; }
.genre-group[open] summary::before{ content: "▾ "; }
.genre-body{ padding: 0 12px 12px; }

.artist-group{ border: 1px solid var(--line); background: var(--surface); margin-bottom: 10px; }
.artist-group summary{
  cursor: pointer; padding: 12px 16px; font-family: var(--font-display); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.02em; list-style: none;
}
.artist-group summary::-webkit-details-marker{ display: none; }
.artist-group summary::before{ content: "▸ "; color: var(--accent); }
.artist-group[open] summary::before{ content: "▾ "; }
.artist-group .table-wrap{ border: none; border-top: 1px solid var(--line); }

.btn-play-mini{
  font-family: var(--font-mono); font-size: 13px; width: 30px; height: 30px; line-height: 1;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 50%; cursor: pointer;
}
.btn-play-mini:disabled{ opacity: 0.35; cursor: default; }

.tag-pill{
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid var(--line); color: var(--text-muted); border-radius: 3px; margin: 0 4px 4px 0;
}
.tag-pill.entrada{ border-color: var(--good); color: var(--good); }
.tag-pill.saida{ border-color: var(--bad); color: var(--bad); }
.status-pill{ font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; }
.status-pill.proposta{ background: var(--surface-2); color: var(--text-muted); }
.status-pill.confirmado{ background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent-strong); }
.status-pill.realizado{ background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.status-pill.cancelado{ background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }

/* ---------- forms ---------- */
label{ display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 5px; margin-top: 14px; }
label:first-child{ margin-top: 0; }
input, select, textarea{
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; font-family: var(--font-body); font-size: 15px; border-radius: 4px;
}
textarea{ min-height: 120px; resize: vertical; font-family: var(--font-mono); font-size: 14px; line-height: 1.6; }
input:focus, select:focus, textarea:focus{ outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=file]{ background: none; border: none; padding: 8px 0; }
.btn{
  display: inline-block; font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--accent); color: #1a1508; border: none; padding: 11px 18px; border-radius: 4px;
  cursor: pointer; text-decoration: none; margin-top: 18px; font-weight: 600;
}
.btn.secondary{ background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger{ background: var(--bad); color: #2a0f08; }
.btn-row{ display: flex; gap: 10px; flex-wrap: wrap; }
.checklist{ display: grid; gap: 6px; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); padding: 10px; background: var(--surface-2); }
.checklist label{ display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--text); }
.checklist input{ width: auto; }

.section-head{ display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.muted{ color: var(--text-muted); font-size: 13.5px; }
.empty{ color: var(--text-muted); font-size: 14px; padding: 24px; text-align: center; border: 1px dashed var(--line); }

.error-box{ background: color-mix(in srgb, var(--bad) 15%, var(--surface)); border: 1px solid var(--bad); color: var(--bad); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }

/* ---------- login ---------- */
.login-wrap{ min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box{ width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); padding: 32px 28px; }
.login-box h1{ font-size: 26px; margin-bottom: 4px; }
.login-box .sub{ color: var(--text-muted); font-size: 13px; margin-bottom: 20px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- telão ---------- */
.telao-body{ background: #000; color: #fff; margin: 0; height: 100vh; overflow: hidden; }
.telao-wrap{ height: 100vh; display: flex; flex-direction: column; padding: 4vh 5vw; }
.telao-top{ display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-mono); font-size: 3.2vw; color: #a8a8a8; margin-bottom: 2vh; }
.telao-title{ font-family: var(--font-display); font-weight: 900; text-transform: uppercase; font-size: 5.5vw; color: #E0AC4F; margin-bottom: 3vh; line-height: 1.02; }
.telao-lyrics{ flex: 1; overflow-y: auto; font-size: 5.6vw; line-height: 1.5; white-space: pre-wrap; font-weight: 600; }
.telao-lyrics.modo-cifra{ font-family: var(--font-mono); font-weight: 400; }
.linha-acorde{ color: #E0AC4F; font-weight: 700; }
.telao-nav{ display: flex; justify-content: space-between; margin-top: 2vh; }
.telao-nav a, .telao-nav button{
  font-family: var(--font-mono); text-transform: uppercase; font-size: 3vw; color: #a8a8a8;
  background: #1a1a1a; border: 1px solid #333; padding: 12px 22px; text-decoration: none; border-radius: 6px;
}
.telao-controls-group{ transition: opacity 0.4s ease; }
.telao-controls-group.escondido{ opacity: 0; pointer-events: none; }
.telao-play-controls{ display: flex; align-items: center; justify-content: center; gap: 2.5vw; margin-top: 1.5vh; flex-wrap: wrap; }
.telao-play-controls button{
  font-family: var(--font-mono); font-size: 4vw; color: #fff;
  background: #1a1a1a; border: 1px solid #333; padding: 10px 16px; border-radius: 6px; line-height: 1;
}
.telao-play-controls #btnPlay{ background: #E0AC4F; color: #000; font-size: 5vw; padding: 10px 24px; border-color: #E0AC4F; }
.telao-play-controls span{ font-family: var(--font-mono); color: #a8a8a8; font-size: 3.2vw; min-width: 4ch; text-align: center; }
#durationLabel{ cursor: pointer; text-decoration: underline dotted; }
.telao-escolher{ background: var(--bg); min-height: 100vh; }

.home-hero{ padding: 40px 0 20px; }
.home-hero h1{ font-size: 34px; }
.tiles{ display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.tile{
  background: var(--surface); border: 1px solid var(--line); padding: 24px; text-decoration: none; color: var(--text);
  display: block;
}
.tile h3{ color: var(--accent-strong); margin-bottom: 6px; }
.tile p{ color: var(--text-muted); font-size: 13.5px; margin: 0; }
@media (max-width: 560px){ .tiles{ grid-template-columns: 1fr; } }

/* ---------- impressão de setlist (relatório / salvar como PDF) ---------- */
@media print{
  .sidebar, .no-print{ display: none !important; }
  .main-content{ margin: 0; }
  .container{ max-width: none; padding: 0; }
  body{ background: #fff; color: #000; }
  table{ font-size: 13px; }
  th, td{ border-bottom: 1px solid #ccc; }
  a{ color: #000; text-decoration: none; }
  .btn-play-mini{ display: none; }
}
