:root{
  --bg:#f6f7fb;
  --panel:#fff;
  --text:#121723;
  --muted:#6d7280;
  --border:#e7e9f0;
  --dark:#101620;
  --dark2:#151b27;
  --purple:#6d4aff;
  --purple2:#8b5cf6;
  --green:#16a34a;
  --shadow:0 18px 45px rgba(16,22,32,.10);
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

a{
  text-decoration:none;
  color:inherit;
}

.main-action-card {
  border: 2px solid rgba(124, 58, 237, 0.15);
  background: linear-gradient(180deg, #fff, #fafafa);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge.success {
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
}

.btn.big {
  padding: 14px 20px;
  font-size: 15px;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.card.clickable {
  cursor: pointer;
  transition: .2s;
}

.card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 35px rgba(18,23,35,.08);
}

.dashboard-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
}

.dashboard-summary h2 {
  margin: 6px 0;
}

.dashboard-stats {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.dashboard-stats span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.dashboard-stats strong {
  color: var(--text);
}

.dashboard-title{
  margin-bottom:18px;
}

.dashboard-quick-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.dashboard-hero{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:22px;
  padding:24px;
  margin-bottom:18px;
  border-radius:20px;
  background:linear-gradient(135deg,#111827,#1f2937 58%,#312e81);
  color:#fff;
  box-shadow:var(--shadow);
}

.dashboard-hero .muted{
  color:#cbd5e1;
}

.dashboard-hero h2{
  margin:6px 0 14px;
  font-size:32px;
  line-height:1.08;
}

.dashboard-hero-meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.dashboard-hero-meta span{
  border:1px solid rgba(255,255,255,.12);
  border-radius:999px;
  background:rgba(255,255,255,.08);
  color:#e5e7eb;
  padding:7px 10px;
  font-size:13px;
  font-weight:700;
}

.dashboard-hero-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  min-width:250px;
}

.dashboard-layout{
  display:grid;
  grid-template-columns:minmax(0,1.55fr) minmax(320px,.75fr);
  gap:18px;
  align-items:start;
}

.dashboard-setlist-card{
  padding:0;
  overflow:hidden;
}

.dashboard-setlist-card > .card-header{
  padding:20px 20px 12px;
}

.dashboard-setlist-card h2,
.dashboard-side h2{
  margin:0;
}

.dashboard-setlist-card .card-header p{
  margin:4px 0 0;
}

.setlist-preview{
  display:flex;
  flex-direction:column;
}

.setlist-preview-row{
  display:grid;
  grid-template-columns:42px minmax(0,1fr) 100px;
  gap:12px;
  align-items:center;
  padding:13px 20px;
  border-top:1px solid var(--border);
}

.setlist-preview-row:hover{
  background:#f8f7ff;
}

.setlist-order{
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:#eee9ff;
  color:#4a2bb2;
  font-weight:900;
}

.setlist-song,
.setlist-keys,
.compact-list a span{
  min-width:0;
}

.setlist-song strong,
.compact-list strong{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.setlist-song small,
.setlist-keys small,
.compact-list small{
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-size:12px;
}

.setlist-keys{
  text-align:right;
}

.setlist-keys strong{
  display:block;
  font-size:20px;
}

.dashboard-side{
  display:grid;
  gap:18px;
}

.dashboard-action-list,
.compact-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.dashboard-action-list a,
.compact-list a{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:11px 0;
  border-top:1px solid var(--border);
}

.dashboard-action-list a:first-child,
.compact-list a:first-child{
  border-top:0;
}

.dashboard-action-list strong,
.compact-list b{
  border-radius:999px;
  background:#f1efff;
  color:#4a2bb2;
  padding:5px 9px;
  font-size:12px;
  white-space:nowrap;
}

.app-shell{
  display:flex;
  min-height:100vh;
}

/* SIDEBAR */
.sidebar{
  width:264px;
  background:linear-gradient(180deg,#111824,#161827 60%,#24194a);
  color:#fff;
  padding:18px 14px;
  position:fixed;
  inset:0 auto 0 0;
  box-shadow:var(--shadow);
  z-index:5;
  transition:.25s;

  height:100vh;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
}

.sidebar::-webkit-scrollbar{
  width:6px;
}

.sidebar::-webkit-scrollbar-track{
  background:transparent;
}

.sidebar::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.18);
  border-radius:999px;
}

.sidebar::-webkit-scrollbar-thumb:hover{
  background:rgba(255,255,255,.28);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  margin:8px 4px 26px;
}

.brand-icon{
  width:44px;
  height:44px;
  border-radius:18px;
  background:linear-gradient(135deg,var(--purple),#311e9a);
  display:grid;
  place-items:center;
  font-size:25px;
}

.brand-text strong{
  display:block;
  font-size:21px;
}

.brand-text span,
.profile-mini span{
  font-size:12px;
  color:#b7bdca;
}

.profile-mini{
  display:flex;
  align-items:center;
  gap:11px;
  padding:12px;
  margin:0 2px 18px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  background:rgba(255,255,255,.04);
}

.avatar{
  width:38px;
  height:38px;
  border-radius:50%;
  background:#fff;
  color:#151827;
  display:grid;
  place-items:center;
  font-weight:800;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding-bottom:28px;
}

.nav-label{
  font-size:11px;
  color:#8d95a6;
  text-transform:uppercase;
  letter-spacing:.12em;
  margin:18px 10px 4px;
}

.nav a{
  display:flex;
  align-items:center;
  gap:13px;
  padding:12px 14px;
  border-radius:14px;
  color:#e7e9f4;
  font-weight:600;
}

.nav a:hover{
  background:rgba(255,255,255,.09);
}

.nav a.active{
  background:linear-gradient(135deg,var(--purple),#4a2bb2);
  color:#fff;
}

/* MAIN */
.main{
  margin-left:264px;
  padding:26px;
  flex:1;
}

.mobile-toggle{
  display:none;
}

.page-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:15px;
  margin-bottom:22px;
}

.page-title h1{
  margin:0;
  font-size:30px;
}

.page-title p{
  margin:6px 0 0;
  color:var(--muted);
}

/* GRID */
.grid{
  display:grid;
  gap:18px;
}

.grid-4{
  grid-template-columns:repeat(4,minmax(0,1fr));
}

.grid-2{
  grid-template-columns:repeat(2,minmax(0,1fr));
}

/* CARDS */
.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:20px;
  box-shadow:0 12px 30px rgba(18,23,35,.04);
  padding:20px;
}

.kpi{
  min-height:120px;
}

.kpi .icon{
  width:38px;
  height:38px;
  border-radius:12px;
  background:#eee9ff;
  color:var(--purple);
  display:grid;
  place-items:center;
  margin-bottom:12px;
  font-size:20px;
}

.kpi strong{
  font-size:30px;
  display:block;
}

.muted{
  color:var(--muted);
}

/* BUTTONS */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:0;
  border-radius:12px;
  background:var(--purple);
  color:#fff;
  padding:11px 15px;
  font-weight:700;
  cursor:pointer;
}

.btn.secondary{
  background:#f1efff;
  color:#4a2bb2;
}

.btn.danger{
  background:#fee2e2;
  color:#991b1b;
}

.btn.small{
  padding:7px 10px;
  font-size:13px;
}

/* TABLES */
.table{
  width:100%;
  border-collapse:collapse;
}

.table th,
.table td{
  padding:13px 10px;
  border-bottom:1px solid var(--border);
  text-align:left;
  font-size:14px;
}

.table th{
  color:#697082;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.06em;
}

.badge{
  display:inline-block;
  border-radius:999px;
  padding:5px 9px;
  background:#eee9ff;
  color:#4a2bb2;
  font-size:12px;
  font-weight:700;
}

/* FORMS */
.form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.field label{
  display:block;
  font-weight:700;
  margin-bottom:7px;
}

.field input,
.field select,
.field textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:13px;
  padding:12px 13px;
  font:inherit;
  background:#fff;
}

.field textarea{
  min-height:230px;
  font-family:"Courier New", Courier, monospace !important;
}

.field.full{
  grid-column:1/-1;
}

/* SONG VIEW */
.song-view{
  background:radial-gradient(circle at top,#152236,#070b11 55%);
  color:#fff;
  border-radius:24px;
  min-height:calc(100vh - 70px);
  padding:24px;
  box-shadow:var(--shadow);
}

.song-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  border-bottom:1px solid rgba(255,255,255,.08);
  padding-bottom:16px;
  margin-bottom:20px;
}

.transpose{
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap:wrap;
}

.transpose a,
.pill{
  background:rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.08);
  border-radius:10px;
  padding:8px 12px;
  color:#fff;
}

.transpose a.active{
  background:var(--purple);
}

.song-content{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:18px;
  line-height:1.75;
  white-space:pre-wrap;
}

.song-line{
  white-space:pre-wrap;
}

.chord-line{
  color:#a78bfa;
  font-weight:900;
  letter-spacing:1px;
  font-size:16px;
  display:block;
  margin-bottom:2px;
}

.song-section{
  display:block !important;
  width:max-content;
  background:rgba(109,74,255,.35);
  border:1px solid rgba(139,92,246,.7);
  padding:6px 12px;
  border-radius:8px;
  margin:18px 0 8px 0 !important;
  font-family:inherit;
  text-align:left !important;
}

.song-content,
.song-line{
  text-align:left !important;
}

.chord{
  display:inline-block;
  color:#fff;
  font-weight:800;
  margin-right:8px;
  transform:translateY(-12px);
  font-size:.9em;
}

.song-layout{
  display:grid;
  grid-template-columns:minmax(0,1fr) 260px;
  gap:18px;
}

.side-panel{
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  padding:16px;
  color:#fff;
}

.side-panel a{
  display:block;
  padding:10px;
  border-radius:10px;
  color:#dce1ee;
}

.side-panel a:hover{
  background:rgba(255,255,255,.08);
}

/* SONG LINKS */
.song-links {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
  margin-bottom:18px;
}

.song-links a {
  display:inline-flex;
  align-items:center;
  gap:8px;
  border-radius:12px;
  padding:9px 13px;
  background:rgba(255,255,255,.08);
  color:#fff;
  border:1px solid rgba(255,255,255,.10);
  font-weight:800;
}

.song-links a:hover {
  background:rgba(109,74,255,.35);
}

/* LOGIN */
.login-screen{
  min-height:100vh;
  display:grid;
  place-items:center;
  background:radial-gradient(circle at top,#25354a,#111824 55%,#24194a);
}

.login-card{
  width:min(420px,92vw);
  background:#fff;
  border-radius:24px;
  padding:30px;
  box-shadow:var(--shadow);
}

.login-card h1{
  margin-top:0;
}

/* RESPONSIVE */
@media (max-width:1000px){
  .grid-4{
    grid-template-columns:repeat(2,1fr);
  }

  .grid-2,
  .song-layout{
    grid-template-columns:1fr;
  }

  .form-grid{
    grid-template-columns:1fr;
  }

  .field.full{
    grid-column:auto;
  }
}

@media (max-width:760px){
  .sidebar{
    transform:translateX(-102%);
    width:min(86vw,360px);
    padding-bottom:calc(26px + env(safe-area-inset-bottom));
    z-index:15;
  }

  .sidebar-open .sidebar{
    transform:none;
  }

  body.sidebar-open::before{
    content:"";
    position:fixed;
    inset:0;
    background:rgba(2,6,23,.55);
    backdrop-filter:blur(3px);
    z-index:4;
  }

  .main{
    margin-left:0;
    padding:18px;
  }

  .mobile-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    position:fixed;
    right:18px;
    bottom:calc(18px + env(safe-area-inset-bottom));
    z-index:20;
    border:1px solid rgba(255,255,255,.18);
    border-radius:18px;
    width:54px;
    height:54px;
    background:linear-gradient(135deg,var(--purple),#4a2bb2);
    color:#fff;
    font-size:0;
    box-shadow:0 14px 35px rgba(79,70,229,.35);
    cursor:pointer;
  }

  .mobile-toggle::before{
    content:"☰";
    font-size:24px;
    line-height:1;
  }

  .sidebar-open .mobile-toggle::before{
    content:"×";
    font-size:28px;
  }

  .page-title{
    align-items:flex-start;
    flex-direction:column;
  }

  .grid-4{
    grid-template-columns:1fr;
  }

  .song-content{
    font-size:15px;
  }

  .song-toolbar{
    align-items:flex-start;
    flex-direction:column;
  }

  .table{
    min-width:720px;
  }

  .card{
    overflow-x:auto;
  }
  
  .dashboard-summary {
      flex-direction: column;
      align-items: flex-start;
    }
    
    .dashboard-stats {
      flex-direction: column;
      gap: 10px;
    }
  
  .table-actions{
      display:flex;
      flex-wrap:wrap;
      gap:8px;
    }
    
    @media (max-width:760px){
      .table{
        min-width:unset !important;
      }
    
      .card{
        overflow-x:visible !important;
      }
    
      .table-mobile-cards thead{
        display:none;
      }
    
      .table-mobile-cards,
      .table-mobile-cards tbody,
      .table-mobile-cards tr,
      .table-mobile-cards td{
        display:block;
        width:100%;
      }
    
      .table-mobile-cards tr{
        background:#fff;
        border:1px solid var(--border);
        border-radius:18px;
        padding:14px 16px;
        margin-bottom:14px;
        box-shadow:0 8px 20px rgba(18,23,35,.05);
      }
    
      .table-mobile-cards td{
        border:0 !important;
        padding:10px 0 !important;
        display:flex;
        justify-content:space-between;
        align-items:flex-start;
        gap:16px;
      }
    
      .table-mobile-cards td:not(:last-child){
        border-bottom:1px solid var(--border) !important;
      }
    
      .table-mobile-cards td::before{
        content:attr(data-label);
        min-width:84px;
        font-size:12px;
        font-weight:800;
        color:var(--muted);
        text-transform:uppercase;
        letter-spacing:.05em;
        flex-shrink:0;
      }
    
      .table-mobile-cards td > *{
        text-align:right;
      }
    
      .table-mobile-cards td[data-label="Acciones"] .table-actions{
        justify-content:flex-end;
        width:100%;
      }

      .setlist-songs-table tr{
        display:grid;
        grid-template-columns:34px minmax(0,1fr);
        align-items:center;
        gap:10px;
        padding:10px 12px;
        margin-bottom:8px;
        border-radius:12px;
        box-shadow:none;
      }

      .setlist-songs-table td{
        display:block;
        padding:0 !important;
        border:0 !important;
      }

      .setlist-songs-table td::before{
        content:none;
      }

      .setlist-songs-table td[data-label="#"]{
        width:30px;
        height:30px;
        display:grid;
        place-items:center;
        border-radius:9px;
        background:#eee9ff;
        color:#4a2bb2;
        font-size:13px;
      }

      .setlist-songs-table td[data-label="Cancion"] a{
        display:block;
        min-width:0;
        text-align:left;
      }

      .setlist-songs-table td[data-label="Cancion"] strong{
        display:block;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
        font-size:15px;
      }

      .setlist-songs-table td[data-label="Cancion"] .muted,
      .setlist-songs-table td[data-label="Tono"],
      .setlist-songs-table td[data-label="Duracion"],
      .setlist-songs-table td[data-label="Notas"]{
        display:none;
      }
    }
}

/* FIX FINAL: fuente fija y alineación de acordes */
.song-content,
.song-line,
.chord-line,
.live-content,
.live-content .song-line,
.live-content .chord-line {
  white-space: pre-wrap !important;
  font-family: "Courier New", Courier, monospace !important;
}

.chord-line,
.live-content .chord-line {
  display: block !important;
  color: #c4b5fd !important;
  font-weight: 900 !important;
  font-size: 13px !important;
  line-height: 1.05 !important;
  margin: 0 0 -2px 0 !important;
  letter-spacing: 0 !important;
}

.song-line,
.live-content .song-line {
  margin: 0 !important;
  line-height: 1.25 !important;
}

@media (max-width:760px){
  .song-content,
  .live-content {
    font-size: 15px !important;
    line-height: 1.22 !important;
  }

  .chord-line,
  .live-content .chord-line {
    font-size: 12px !important;
    margin-bottom: -3px !important;
  }
}

/* Mobile polish: overrides only below tablet width. Desktop remains unchanged. */
@media (max-width:760px){
  html,
  body{
    max-width:100%;
    overflow-x:hidden;
  }

  .main{
    padding:14px;
    padding-bottom:calc(92px + env(safe-area-inset-bottom));
  }

  .page-title{
    gap:10px;
    margin-bottom:14px;
  }

  .page-title h1{
    font-size:24px;
    line-height:1.15;
  }

  .page-title p{
    font-size:14px;
  }

  .page-title > .btn,
  .page-title > div + .btn{
    width:100%;
  }

  .card{
    border-radius:16px;
    padding:14px;
    overflow-x:auto !important;
    -webkit-overflow-scrolling:touch;
  }

  .card-header{
    align-items:flex-start;
    flex-direction:column;
    gap:10px;
  }

  .card-header .btn{
    width:100%;
  }

  .card-actions{
    width:100%;
  }

  .card-actions .btn{
    flex:1 1 160px;
  }

  .grid{
    gap:14px;
  }

  .kpi{
    min-height:auto;
  }

  .dashboard-summary{
    gap:12px;
  }

  .dashboard-quick-actions,
  .dashboard-hero,
  .dashboard-hero-actions{
    width:100%;
  }

  .dashboard-quick-actions .btn,
  .dashboard-hero-actions .btn{
    flex:1 1 100%;
  }

  .dashboard-hero{
    align-items:flex-start;
    flex-direction:column;
    border-radius:16px;
    padding:18px;
  }

  .dashboard-hero h2{
    font-size:26px;
  }

  .dashboard-hero-actions{
    min-width:0;
    justify-content:stretch;
  }

  .dashboard-layout{
    grid-template-columns:1fr;
    gap:14px;
  }

  .dashboard-setlist-card{
    padding:0;
  }

  .dashboard-setlist-card > .card-header{
    padding:16px 14px 10px;
  }

  .setlist-preview-row{
    grid-template-columns:34px minmax(0,1fr) 72px;
    gap:9px;
    padding:12px 14px;
  }

  .setlist-order{
    width:28px;
    height:28px;
    border-radius:9px;
  }

  .setlist-keys strong{
    font-size:18px;
  }

  .dashboard-side{
    gap:14px;
  }

  .dashboard-stats{
    width:100%;
  }

  .btn{
    min-height:42px;
    text-align:center;
  }

  .table:not(.table-mobile-cards){
    min-width:640px !important;
  }

  .table th,
  .table td{
    padding:11px 9px;
  }

  .table-actions{
    align-items:stretch;
  }

  .table-actions .btn,
  td > .btn{
    margin:2px 0;
  }

  .form-grid{
    gap:12px;
  }

  .field textarea{
    min-height:170px;
  }

  #setlist-items > div{
    grid-template-columns:1fr !important;
    gap:10px !important;
    padding:12px;
    border:1px solid var(--border);
    border-radius:14px;
    background:#fafbff;
  }

  #setlist-items > div button{
    width:100%;
  }

  .song-view{
    min-height:auto;
    border-radius:16px;
    padding:14px;
  }

  .song-toolbar{
    gap:14px;
  }

  .song-toolbar h1{
    font-size:24px;
    line-height:1.15;
  }

  .transpose{
    width:100%;
  }

  .transpose a{
    flex:1 1 48px;
    padding:9px 8px;
    text-align:center;
  }

  .transpose form{
    width:100%;
    margin-left:0 !important;
  }

  .transpose form .btn{
    width:100%;
  }

  .pill{
    display:inline-flex;
    margin:2px 0;
  }

  .song-links a{
    flex:1 1 100%;
    justify-content:center;
  }

  .song-content{
    font-size:14px !important;
    line-height:1.35 !important;
  }

  .side-panel{
    padding:14px;
  }

  .login-card{
    width:min(100% - 28px,420px);
    border-radius:18px;
    padding:22px;
  }
}
