:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #dbe3ef;
  --line-soft: #edf2f7;
  --text: #111827;
  --muted: #64748b;
  --primary: #1454b8;
  --primary-2: #0d3f8d;
  --primary-soft: #e8f0ff;
  --green: #15803d;
  --green-soft: #e8f7ee;
  --amber: #b45309;
  --amber-soft: #fff3d7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --violet: #6d28d9;
  --violet-soft: #f0e9ff;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  background: var(--surface);
}

.login-brand {
  background: #0e3474;
  color: white;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* El logo lleva el "Go" en azul, que se perderia contra el azul oscuro del
   panel: va sobre una tarjeta blanca para que la marca se lea completa. */
.brand-logo {
  display: block;
  width: 260px;
  max-width: 100%;
  height: auto;
  padding: 16px 22px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(2, 20, 51, 0.28);
  margin-bottom: 26px;
}

/* La base del pin es azul y se perderia contra el azul de la barra lateral:
   va sobre una baldosa blanca para que se lea el pin completo. */
.side-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 6px;
  box-sizing: border-box;
  border-radius: 12px;
  background: #ffffff;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(2, 20, 51, 0.3);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #f4c430;
  color: #0e3474;
  font-weight: 900;
  margin-bottom: 20px;
}

.login-brand h1 {
  margin: 0;
  max-width: 330px;
  font-size: 34px;
  line-height: 1.06;
}

.login-brand p {
  max-width: 340px;
  color: #dbeafe;
  line-height: 1.6;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 28px;
}

.login-box {
  width: min(420px, 100%);
}

.login-box h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-box .muted {
  margin-bottom: 28px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  color: #334155;
  font-weight: 700;
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 84, 184, 0.14);
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0e2c5c 0%, #102a55 100%);
  color: white;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 272px;
  overflow-y: auto;
  z-index: 40;
}

.main {
  margin-left: 272px;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 20px;
}

.side-head strong {
  display: block;
  font-size: 17px;
}

.side-head span {
  display: block;
  color: #bfdbfe;
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav button {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #dbeafe;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 900;
}

.nav-count {
  color: #bfdbfe;
  font-size: 12px;
}

.side-footer {
  margin-top: auto;
  padding: 14px 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  width: 100%;
  padding: 24px 28px 40px;
}

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

.toolbar .search {
  flex: 1 1 260px;
}

.view-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.search,
.select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 11px 12px;
  min-height: 42px;
  outline: none;
}

.search:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 84, 184, 0.12);
}

.btn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 38px;
  padding: 9px 12px;
  background: white;
  color: #1f2937;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:hover {
  border-color: #b7c4d7;
  background: #f8fafc;
}

.btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn.primary:hover {
  background: var(--primary-2);
}

.btn.danger {
  color: var(--red);
  border-color: #fecaca;
  background: #fff7f7;
}

.btn.success {
  color: var(--green);
  border-color: #bbf7d0;
  background: #f3fcf6;
}

.btn.small {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 16px;
}

.kpi {
  padding: 16px;
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 900;
  color: #0f172a;
}

.kpi-foot {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: #475569;
  background: #f8fafc;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover td {
  background: #fbfdff;
}

td.actions {
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.strong {
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.blue {
  color: var(--primary);
  background: var(--primary-soft);
}

.badge.green {
  color: var(--green);
  background: var(--green-soft);
}

.badge.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.red {
  color: var(--red);
  background: var(--red-soft);
}

.badge.violet {
  color: var(--violet);
  background: var(--violet-soft);
}

.badge.gray {
  color: #64748b;
  background: #eef2f7;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
}

/* Texto que se comporta como enlace: abre la ficha de la llave, el cliente
   o el punto sin tener que copiar y pegar el nombre en el buscador. */
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: #1e4fa3;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.link-btn:hover {
  border-bottom-color: #1e4fa3;
}

.link-btn.big {
  font-size: 15px;
}

.section-title {
  margin: 20px 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.section-title .muted {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.code-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.code-big {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #0f172a;
}

.check-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #1e4fa3;
  cursor: pointer;
}

.hours-grid {
  display: grid;
  gap: 8px;
  max-width: 520px;
}

.hours-row {
  display: grid;
  grid-template-columns: 150px 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.hours-day {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  color: #334155;
}

.hours-day input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.hours-row input[type="time"] {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: white;
}

.store-title {
  font-size: 19px;
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.info-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fbfdff;
}

.info-item > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.info-item .big {
  font-size: 22px;
}

.pass-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.info-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.store-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #f8fafc;
  margin: 12px 0 4px;
}

.alert-banner {
  background: var(--red-soft);
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.info-item.danger {
  border-color: #fca5a5;
  background: var(--red-soft);
}

.info-item.danger .big {
  color: var(--red);
}

.detail-item.danger {
  border-color: #fca5a5;
  background: var(--red-soft);
}

.split {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfdff;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.modal {
  position: relative;
  width: min(1120px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
  border: 1px solid var(--line);
}

.modal-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 18px 0;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  overflow-x: auto;
}

.tab {
  border: 0;
  background: transparent;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab:hover {
  color: var(--primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.modal.compact {
  width: min(520px, 100%);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.section-title {
  margin: 24px 0 10px;
  font-size: 14px;
  font-weight: 900;
  color: #334155;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  background: #0f172a;
  color: white;
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  max-width: 360px;
  font-size: 13px;
}

.toast.error {
  background: var(--red);
}

.toast.success {
  background: var(--green);
}

.loading {
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

@media (max-width: 980px) {
  .login-shell,
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
    width: auto;
  }

  .main {
    margin-left: 0;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.cols-4,
  .grid.cols-3,
  .form-grid,
  .detail-list,
  .info-strip,
  .info-cols {
    grid-template-columns: 1fr;
  }

  .info-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hours-row {
    grid-template-columns: 130px 1fr auto 1fr;
  }

  .topbar,
  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .content,
  .topbar {
    padding: 16px;
  }

  .login-brand {
    padding: 28px;
  }

  .login-brand h1 {
    font-size: 28px;
  }

  .nav {
    grid-template-columns: 1fr;
  }
}

