:root {
  --primary: #0052cc;
  --success: #00875a;
  --bg: #f4f5f7;
  --admin-color: #2c3e50;
  --accent: #2980b9;
  --error: #e74c3c;
  --sidebar-width: 240px;
  --whatsapp-color: #25d366;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ---------- Vista móvil (index.html) ---------- */
body.vista-movil {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}

body.vista-movil .container {
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
}

/* Escritorio: ensancha la tarjeta y mejora los botones */
@media (min-width: 769px) {
  body.vista-movil .container {
    max-width: 720px;
    padding: 20px;
  }
  body.vista-movil .card {
    padding: 32px;
  }
  body.vista-movil .title {
    font-size: 1.7rem;
  }
  body.vista-movil button {
    font-size: 17px;
    padding: 20px;
  }
}

.card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-top: 6px solid var(--primary);
}

.title {
  color: #172b4d;
  font-size: 1.4rem;
  margin-bottom: 15px;
  text-align: center;
  font-weight: bold;
  padding-top: 10px;
}

.data-box {
  background: #ebf0f7;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.label {
  font-size: 0.75rem;
  color: #5e6c84;
  text-transform: uppercase;
  font-weight: bold;
}

.value {
  font-size: 1.1rem;
  color: #091e42;
  font-weight: 600;
  margin-bottom: 8px;
}

button {
  width: 100%;
  padding: 18px;
  margin-bottom: 10px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

.btn-todo { background: var(--primary); color: white; }
.btn-done { background: #e3fcef; color: #006644; border: 1px solid var(--success); cursor: default; }
button:disabled { background: #f4f5f7; color: #a5adba; cursor: not-allowed; border: 1px solid #dfe1e6; }

.last-update {
  text-align: center;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 10px;
}

/* ---------- Vista despacho ---------- */
body.despacho {
  display: flex;
  overflow-x: hidden;
  width: 100vw;
}

.nav-toggle-state { display: none !important; }

.sidebar {
  width: var(--sidebar-width);
  background: #1e272e;
  height: 100vh;
  position: fixed;
  color: white;
  padding-top: 20px;
  transition: 0.3s;
  z-index: 99;
}
.sidebar h3 {
  text-align: center;
  font-size: 1rem;
  letter-spacing: 1px;
  color: #95a5a6;
  margin-bottom: 30px;
  text-transform: uppercase;
}
.sidebar-menu { list-style: none; padding: 0; margin: 0; }
.sidebar-menu label {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: bold;
  border-left: 4px solid transparent;
  transition: 0.2s;
  display: flex;
  align-items: center;
  color: #b8c2cc;
}
.sidebar-menu label:hover { background: #2c3e50; color: #fff; }

.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 20px;
  min-height: 100vh;
}
.section-page { display: none; }
.section-page.active { display: block; }

.container-despacho {
  max-width: 850px;
  margin: auto;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

h2 {
  color: var(--admin-color);
  text-align: center;
  border-bottom: 3px solid var(--accent);
  padding-bottom: 10px;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.grid-form { display: grid; grid-template-columns: 1fr; gap: 15px; }
@media (min-width: 600px) { .grid-form { grid-template-columns: 1fr 1fr; } }

.input-group { display: flex; flex-direction: column; }
label {
  font-size: 0.75rem;
  font-weight: bold;
  color: #576574;
  margin-bottom: 5px;
  text-transform: uppercase;
}
input, select {
  padding: 14px;
  border: 2px solid #dcdde1;
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
  text-transform: uppercase;
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent); outline: none; }
.invalid { border-color: var(--error) !important; background-color: #fdf2f2; }

.btn-save {
  width: 100%;
  padding: 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 15px;
}
.btn-save:active { background: #1a5276; transform: scale(0.98); }

#status {
  margin-top: 15px;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  display: none;
  font-weight: bold;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 15px;
  border-radius: 8px;
  border: 1px solid #dfe4ea;
}
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
th { background: var(--admin-color); color: white; padding: 14px 10px; font-size: 0.75rem; }
td { padding: 14px 10px; border-bottom: 1px solid #f1f2f6; color: #2f3542; font-weight: 500; text-transform: uppercase; }
tr:nth-child(even) { background: #f8f9fa; }

.badge-hours {
  background: #e3fcef;
  color: #006644;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.8rem;
  border: 1px solid #00875a;
}
.col-ancha { min-width: 140px; white-space: nowrap; }

.filtro-mes {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  background: #f8f9fa;
  padding: 10px;
  border-radius: 8px;
}
.filtro-mes input[type="month"] {
  padding: 10px;
  border: 2px solid #dcdde1;
  border-radius: 8px;
  font-size: 16px;
  flex: 1;
  text-transform: none;
}

.btn-copiar-pc {
  background: #34495e;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-copiar-pc.copiado { background: var(--success) !important; }

.btn-whatsapp-mobile {
  background: var(--whatsapp-color);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: bold;
  width: 100%;
  margin-top: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.mobile-cards-container { display: none; }

@media (max-width: 768px) {
  body.despacho { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding-top: 5px;
    padding-bottom: 5px;
  }
  .sidebar h3 { display: none; }
  .sidebar-menu { display: flex; justify-content: space-around; }
  .sidebar-menu label {
    padding: 10px 8px;
    font-size: 0.75rem;
    border-bottom: 3px solid transparent;
    flex: 1;
    justify-content: center;
  }
  .main-content { margin-left: 0; width: 100% !important; padding: 6px !important; }
  .container-despacho { padding: 10px !important; width: 100% !important; max-width: 100% !important; }
  .table-container { display: none !important; }
  .mobile-cards-container { display: block !important; }
  .mobile-card {
    background: white;
    border: 1px solid #dfe4ea;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    text-transform: uppercase;
  }
  .mobile-row { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 0.8rem; }
  .mobile-label { font-weight: bold; color: #7f8c8d; min-width: 95px; }
  .mobile-value { font-weight: 600; color: #2c3e50; text-align: right; flex: 1; }
}
