@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,500&display=swap');

:root {
  --primary: #0056a4;
  --primary-dark: #003d75;
  --primary-light: #1a7fd4;
  --primary-soft: #e8f2fb;
  --accent: #439539;
  --accent-dark: #2d6b26;
  --accent-light: #d4edd1;
  --accent-soft: #f0faf0;
  --surface: #f0f5fa;
  --surface-elevated: #ffffff;
  --text: #152535;
  --text-muted: #5c7088;
  --danger: #dc2626;
  --warning: #d97706;
  --border: #d4e0ec;
  --border-light: #e8eff6;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 3px rgba(0, 56, 117, 0.06), 0 4px 12px rgba(0, 56, 117, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 56, 117, 0.1), 0 2px 8px rgba(0, 56, 117, 0.06);
  --shadow-lg: 0 20px 50px rgba(0, 56, 117, 0.14);
  --header-h: 4rem;
  --desktop-nav-h: 2.75rem;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 10% -5%, rgba(0, 86, 164, 0.09), transparent 55%),
    radial-gradient(ellipse 70% 50% at 95% 5%, rgba(67, 149, 57, 0.07), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(0, 86, 164, 0.04), transparent);
  pointer-events: none;
  z-index: -1;
}

body.body-login::before { display: none; }

a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--primary-dark); }

/* —— Header —— */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem;
  min-height: var(--header-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  min-width: 0;
  flex-shrink: 0;
  transition: opacity var(--transition);
}
.header-brand:hover { opacity: 0.88; }

.header-logo {
  height: 2.75rem;
  width: auto;
  max-width: min(58vw, 240px);
  object-fit: contain;
  object-position: left center;
}

@media (min-width: 480px) {
  .header-logo { height: 3rem; max-width: 260px; }
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.header-user-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  border-radius: 999px;
  padding: 0.15rem 0.5rem 0.15rem 0.15rem;
  transition: background var(--transition);
}

.header-user-profile:hover {
  background: var(--primary-soft);
}

.header-user-profile .header-avatar {
  cursor: pointer;
}

.header-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0, 86, 164, 0.25);
}

.header-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .header-name { display: none; }
}

/* —— Desktop nav —— */
.desktop-nav {
  display: none;
  flex: 1;
  justify-content: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  padding: 0 0.5rem;
}

.desktop-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  border-radius: 999px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.desktop-nav-item:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.desktop-nav-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(0, 86, 164, 0.3);
}

.desktop-nav-icon {
  width: 1rem;
  height: 1rem;
  opacity: 0.85;
  flex-shrink: 0;
}
.desktop-nav-item.active .desktop-nav-icon { opacity: 1; }

@media (min-width: 768px) {
  .desktop-nav { display: flex; }
  .bottom-nav--mobile { display: none !important; }
  .app-header {
    flex-wrap: wrap;
    padding-bottom: 0;
  }
  .desktop-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    padding: 0.4rem 0 0.55rem;
    border-top: 1px solid var(--border-light);
    margin-top: 0.15rem;
    gap: 0.25rem;
  }
  .app-main {
    max-width: 1140px;
    padding-bottom: 2.5rem;
    min-height: calc(100vh - var(--header-h) - var(--desktop-nav-h));
  }
}

/* —— Main —— */
.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.15rem 2rem;
  min-height: calc(100vh - var(--header-h) - 4rem);
}

.app-main--login {
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.page {
  animation: page-in 0.35s ease-out;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 767px) {
  .app-main:not(.app-main--login) {
    padding-bottom: calc(5.85rem + env(safe-area-inset-bottom, 0px));
  }
}

/* —— Bottom nav —— */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -8px 32px rgba(0, 56, 117, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 50;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.5rem 0.15rem 0.55rem;
  font-size: 0.62rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  transition: color var(--transition);
  position: relative;
}

.nav-icon {
  width: 1.35rem;
  height: 1.35rem;
  opacity: 0.65;
  transition: opacity var(--transition), transform var(--transition);
}

.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active .nav-icon {
  opacity: 1;
  transform: scale(1.08);
}

.bottom-nav-item.active::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* —— Typography —— */
.page-title {
  margin: 0 0 0.25rem;
  font-size: clamp(1.45rem, 4vw, 1.85rem);
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-subtitle {
  margin: 0 0 1.35rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 52ch;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.page-header-row .page-title { margin: 0; }

.page-hero {
  margin: -0.25rem 0 1.5rem;
  padding: 1.15rem 1.25rem;
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--accent-soft) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
}

/* —— Cards —— */
.card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-highlight {
  border-color: rgba(67, 149, 57, 0.35);
  background: linear-gradient(145deg, var(--accent-soft) 0%, #fff 55%);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.card-highlight::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(67, 149, 57, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.card-link {
  display: block;
  text-decoration: none;
  color: var(--primary);
  text-align: center;
  font-weight: 600;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-nested {
  background: var(--surface);
  border: 1px dashed var(--border);
  box-shadow: none;
  margin: 0.75rem 0;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.68rem 1.15rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, box-shadow var(--transition), background var(--transition), color var(--transition);
  letter-spacing: 0.01em;
}

.btn:active { transform: scale(0.97); }
.btn:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 86, 164, 0.32);
}

.btn-primary:hover {
  box-shadow: 0 6px 22px rgba(0, 86, 164, 0.42);
  filter: brightness(1.03);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #52b848 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(67, 149, 57, 0.3);
}

.btn-accent:hover {
  box-shadow: 0 6px 22px rgba(67, 149, 57, 0.38);
  filter: brightness(1.04);
}

.btn-ghost {
  background: var(--surface-elevated);
  border: 1.5px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--primary-light);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn-sm { padding: 0.42rem 0.8rem; font-size: 0.82rem; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 0.95rem 1.2rem; font-size: 1.05rem; border-radius: 12px; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; }

/* —— Forms —— */
.input,
select.input,
textarea.input,
input[type="date"].input,
input[type="time"].input {
  width: 100%;
  padding: 0.72rem 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 0.35rem;
  font-family: inherit;
  font-size: 16px;
  background: #fff;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input::placeholder { color: #9aabb8; }

.input:focus,
select.input:focus,
textarea.input:focus,
input[type="date"].input:focus,
input[type="time"].input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(0, 86, 164, 0.12);
}

/* Fecha/hora: mismo “cuadrado” que el resto de inputs (Safari/Chrome móvil) */
input[type="date"].input,
input[type="time"].input {
  display: block;
  max-width: 100%;
  min-width: 0;
  height: 3.05rem;
  min-height: 3.05rem;
  line-height: 1.25;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: light;
}

input[type="date"].input::-webkit-date-and-time-value,
input[type="time"].input::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.25em;
}

input[type="date"].input::-webkit-datetime-edit,
input[type="time"].input::-webkit-datetime-edit {
  display: inline-flex;
  align-items: center;
  padding: 0;
  margin: 0;
  overflow: visible;
}

input[type="date"].input::-webkit-datetime-edit-fields-wrapper,
input[type="time"].input::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

input[type="date"].input::-webkit-calendar-picker-indicator,
input[type="time"].input::-webkit-calendar-picker-indicator {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  padding: 0;
  opacity: 0.55;
  cursor: pointer;
  flex-shrink: 0;
}

.input-sm { padding: 0.48rem 0.65rem; font-size: 0.875rem; }

.input-search {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%235c7088' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.85rem center;
  padding-left: 2.5rem;
}

label {
  display: block;
  margin-bottom: 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.form-stack { display: flex; flex-direction: column; gap: 0.1rem; }

/* —— Alerts —— */
.alert {
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-danger {
  background: linear-gradient(90deg, #fef2f2 0%, #fff 100%);
  color: var(--danger);
  border-color: var(--danger);
}

.alert-warning {
  background: linear-gradient(90deg, #fffbeb 0%, #fff 100%);
  color: #92400e;
  border-color: var(--warning);
}

.alert-success {
  background: linear-gradient(90deg, var(--accent-soft) 0%, #fff 100%);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }

.label-sm {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  font-weight: 800;
  margin: 0 0 0.4rem;
}

/* —— Login (partes de trabajo) —— */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  background:
    linear-gradient(180deg, rgba(0, 86, 164, 0.06) 0%, transparent 28%),
    var(--surface);
}

.login-wrap {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.login-logo {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto 1.5rem;
  object-fit: contain;
}

.login-form {
  margin-top: 0;
}

.login-footer {
  margin-top: 1.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-light);
  text-align: center;
  line-height: 1.35;
}

.login-footer-brand {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary-dark);
}

.login-footer-tagline {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* —— Chips & lists —— */
.chip-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }

.chip {
  padding: 0.55rem 1rem;
  background: var(--surface-elevated);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
}

.chip:hover {
  border-color: var(--primary-light);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.chip.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(0, 86, 164, 0.15);
}

.client-list {
  margin: 0.5rem 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

button.client-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

.client-item {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition), padding-left var(--transition);
}

.client-item-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.client-search-empty {
  padding: 0.85rem 1rem;
  margin: 0;
}

.client-selected {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  margin: 0.25rem 0 0.85rem;
  background: var(--primary-soft);
  border: 1.5px solid rgba(0, 86, 164, 0.18);
  border-radius: var(--radius-sm);
}

.client-selected-main {
  min-width: 0;
  flex: 1;
}

.client-selected-main strong {
  display: block;
  font-size: 1.02rem;
  color: var(--primary-dark);
  line-height: 1.3;
}

.client-selected-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.client-selected-meta:empty { display: none; }

.chip.is-hidden { display: none !important; }

.work-client-adhoc {
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  background: #fdf2f8;
  border: 1px solid #f9a8d4;
  border-radius: var(--radius-sm);
}

/* —— Modal sheet (scroll body + sticky footer) —— */

.modal-sheet-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.modal-sheet-header {
  flex-shrink: 0;
  padding: 1.1rem 1.15rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-sheet-header h3 {
  margin: 0 0 0.5rem;
}

.modal-sheet-header .alert {
  margin-bottom: 0;
}

.modal-sheet-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.15rem 0.5rem;
}

.modal-sheet-footer {
  flex-shrink: 0;
  padding: 0.85rem 1.15rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -6px 24px rgba(0, 56, 117, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-section {
  margin-bottom: 1.1rem;
  padding-bottom: 0.25rem;
  min-width: 0;
}

.form-section-title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.field-hint {
  display: block;
  margin: 0.15rem 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.own-work-schedule {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.own-work-schedule > label {
  margin-bottom: 0;
}

.own-work-times {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
  min-width: 0;
}

.own-work-times label {
  margin-bottom: 0;
  min-width: 0;
}

@media (min-width: 520px) {
  .own-work-times {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

.client-list--modal {
  max-height: min(36vh, 220px);
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 0.5rem;
}

.client-list--modal .client-item:hover {
  padding-left: 1.1rem;
}

.modal-content.modal-sheet .input,
.modal-content.modal-sheet select.input,
.modal-content.modal-sheet textarea.input {
  max-width: 100%;
  min-width: 0;
}

.modal-content.modal-sheet label {
  min-width: 0;
}

.modal-content.modal-sheet .client-selected {
  min-width: 0;
  overflow: hidden;
}

.modal-content.modal-sheet .client-selected-main strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 480px) {
  .modal-content.modal-sheet {
    max-height: 96vh;
    max-height: 96dvh;
  }

  .modal-sheet-header,
  .modal-sheet-body,
  .modal-sheet-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .modal-sheet .client-selected {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .modal-sheet .client-selected .link-action {
    align-self: flex-end;
  }

  .modal-sheet-body label {
    margin-bottom: 0.75rem;
  }

  .modal-sheet-footer .btn-lg {
    min-height: 3rem;
    font-size: 1rem;
  }
}

.work-client-adhoc-name {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: #9d174d;
  line-height: 1.35;
}

.client-item:last-child { border-bottom: none; }

.client-item:hover {
  background: var(--primary-soft);
  padding-left: 1.25rem;
}

.client-item strong {
  font-weight: 700;
  color: var(--primary-dark);
}

/* —— Timer —— */
.timer-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}

.timer {
  font-size: clamp(2.5rem, 10vw, 3.25rem);
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 0.5rem 0;
  text-shadow: 0 2px 12px rgba(0, 86, 164, 0.15);
}

.timer-inline {
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* —— Modal —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  animation: modal-bg 0.2s ease;
}

@keyframes modal-bg {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 35, 55, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--surface-elevated);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: modal-up 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

@keyframes modal-up {
  from { transform: translateY(100%); opacity: 0.5; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-content h3 {
  margin: 0 0 1.15rem;
  color: var(--primary-dark);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .modal { align-items: center; padding: 1rem; }
  .modal-content {
    border-radius: var(--radius-lg);
    animation: modal-scale 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
  }
  @keyframes modal-scale {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
}

.modal-lg { max-width: 580px; }

.modal-content.modal-sheet {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
  overflow: hidden;
  overflow-x: hidden;
  padding: 0;
  min-width: 0;
  width: 100%;
}

@media (max-width: 639px) {
  .modal-content.modal-sheet {
    max-width: 100%;
  }
}

/* —— Tables —— */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th, td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  vertical-align: middle;
}

th {
  background: linear-gradient(180deg, var(--primary-soft) 0%, #f5f9fd 100%);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: rgba(0, 86, 164, 0.04); }

.stack > * + * { margin-top: 0.9rem; }

.filters {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  align-items: flex-end;
  padding: 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.filters label {
  margin-bottom: 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.filter-label { margin-bottom: 0; font-size: 0.78rem; }

.filters-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filters--toolbar .filters-actions {
  margin-left: auto;
}

@media (max-width: 767px) {
  .filters--toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters--toolbar .filters-actions {
    margin-left: 0;
    width: 100%;
  }

  .filters--toolbar .filters-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* —— Metrics —— */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.85rem;
  margin: 1.15rem 0;
}

.metric {
  text-align: center;
  padding: 1.15rem 0.85rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric strong {
  display: block;
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  color: var(--primary);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.metric span {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.link-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }

/* —— Badges —— */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-open { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-closed { background: var(--accent-light); color: var(--accent-dark); border: 1px solid #b8ddb4; }

.badge-muted {
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.badge-adhoc {
  background: #fce7f3;
  color: #9d174d;
  border: 1px solid #f9a8d4;
}
.badge-ok { background: var(--accent-light); color: var(--accent-dark); }
.badge-pending { background: #fef3c7; color: #92400e; }

.adhoc-hint {
  margin: 0.35rem 0 0.65rem;
  text-align: right;
}

.link-action {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-action:hover { color: var(--primary); }

.link-action.is-active {
  color: var(--primary);
  font-weight: 600;
}

.day-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.day-toggle button {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.day-toggle button:hover {
  border-color: var(--primary-light);
  color: var(--primary-dark);
}

.day-toggle button.on {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(0, 86, 164, 0.25);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
}

.status-pill.yes { background: var(--accent-light); color: var(--accent-dark); }
.status-pill.no { background: #f1f5f9; color: #64748b; }

/* —— Live cards —— */
.live-card {
  border-left: 4px solid var(--warning);
  background: linear-gradient(105deg, #fffbeb 0%, #fff 40%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.live-card .card-title { margin: 0; flex: 1; min-width: 140px; }

.live-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.5); }
  50% { opacity: 0.8; transform: scale(1.1); box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); }
}

/* —— Hoy (admin dashboard) —— */
.page-hoy-header {
  align-items: flex-start;
}

.hoy-refresh-btn {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.4rem 0.65rem;
}

.hoy-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .hoy-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.hoy-stat {
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  text-align: center;
}

.hoy-stat--live {
  border-color: rgba(217, 119, 6, 0.35);
  background: linear-gradient(160deg, #fffbeb 0%, var(--surface-elevated) 70%);
}

.hoy-stat-value {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.1;
}

.hoy-stat--live .hoy-stat-value {
  color: #b45309;
}

.hoy-stat-label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hoy-section {
  margin-bottom: 1.25rem;
}

.hoy-section-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.hoy-section-pulse {
  width: 8px;
  height: 8px;
}

.hoy-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.hoy-work-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.hoy-work-card--closed {
  border-left: 4px solid var(--accent);
}

.hoy-work-main {
  flex: 1;
  min-width: 0;
}

.hoy-work-main .card-title {
  margin: 0 0 0.15rem;
  font-size: 1rem;
}

.hoy-work-client {
  margin: 0;
  font-weight: 600;
}

.hoy-work-meta {
  margin: 0.2rem 0 0;
}

.hoy-work-time {
  text-align: right;
  flex-shrink: 0;
}

.hoy-work-duration {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.empty-state--compact {
  padding: 1.5rem 1rem;
}

@media (min-width: 900px) {
  .page-hoy {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.25rem;
    align-items: start;
  }

  .page-hoy .page-hoy-header,
  .page-hoy .hoy-stats,
  .page-hoy .card-ticar-cta {
    grid-column: 1 / -1;
  }

  .page-hoy .hoy-section {
    margin-bottom: 0;
  }
}

.client-recent-visits {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.client-recent-title {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.client-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.client-recent-item {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-light);
}

.client-recent-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.client-recent-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.client-recent-date {
  color: var(--primary-dark);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  background: var(--surface-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.profit-table table { font-size: 0.78rem; }
.profit-table th, .profit-table td { white-space: nowrap; }
.margin-negative { color: var(--danger); font-weight: 700; }
.margin-positive { color: var(--accent-dark); font-weight: 700; }
.profit-warn { color: var(--warning); font-size: 0.72rem; }

/* —— Confirm / alert dialog —— */
.modal-confirm-wrap {
  z-index: 200;
}

.modal-confirm {
  max-width: 400px;
  padding: 1.35rem 1.25rem 1.15rem;
}

.modal-confirm h3 {
  margin: 0 0 0.65rem;
  text-align: center;
}

.confirm-message {
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
}

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.modal-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.modal-sheet-actions:empty {
  display: none;
}

.modal-sheet-actions:not(:empty) + .btn {
  margin-top: 0.15rem;
}

.modal-content.modal-lg.modal-sheet {
  max-width: 580px;
}

.modal-content.modal-content--finish.modal-sheet {
  max-width: 420px;
}

.modal-content.modal-qm.modal-sheet {
  max-width: 520px;
}

.modal-content.modal-qm.modal-sheet .modal-sheet-header.qm-modal-head {
  padding-bottom: 0.75rem;
}

.modal-content.modal-qm.modal-sheet .qm-modal-head {
  margin-bottom: 0;
}

.modal-content.modal-qm.modal-sheet .modal-sheet-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 0.5rem;
}

.modal-content.modal-qm.modal-sheet .qm-list {
  flex: 1;
  min-height: 8rem;
}

/* —— Toast —— */
.toast-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 35, 55, 0.45);
  backdrop-filter: blur(6px);
  padding: 1rem;
  animation: modal-bg 0.15s ease;
}

.toast-overlay.hidden { display: none !important; }

.toast-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.75rem 2.25rem;
  min-width: 240px;
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.toast-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.9rem;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: toast-spin 0.7s linear infinite;
}

.toast-spinner.hidden { display: none; }

.toast-text {
  margin: 0;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.98rem;
}

.toast-box--ok .toast-text { color: var(--accent-dark); }

.toast-box--ok .toast-ok-icon {
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 0.7rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-soft) 100%);
  color: var(--accent-dark);
  font-size: 1.4rem;
  line-height: 2.75rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(67, 149, 57, 0.2);
}

@keyframes toast-spin {
  to { transform: rotate(360deg); }
}

code {
  background: var(--primary-soft);
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  font-size: 0.84em;
  color: var(--primary-dark);
  font-weight: 600;
}

/* —— Holiday cards inline —— */
.holiday-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.1rem !important;
  margin-bottom: 0.5rem;
}

/* —— Horarios / avisos —— */
.card-schedule {
  border-left: 4px solid var(--warning);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}

.schedule-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin: 1rem 0;
}

@media (min-width: 640px) {
  .schedule-grid { grid-template-columns: 1fr 1fr; }
}

.schedule-block {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.schedule-block--accent {
  background: linear-gradient(145deg, #fffbeb 0%, #fff 100%);
  border-color: #fde68a;
}

.schedule-block-title {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-dark);
}

.schedule-filters {
  margin: 0.5rem 0 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.schedule-margin-label {
  margin-bottom: 0 !important;
  margin-top: 0.35rem;
}

.alert-preview {
  margin: 0.85rem 0 1rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--primary-soft) 0%, #fff 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}

.alert-preview strong {
  color: var(--primary-dark);
  font-weight: 800;
}

.alert-preview--compact {
  margin-top: 0.75rem;
  margin-bottom: 0;
  font-size: 0.82rem;
}

/* —— Trabajos: tarjetas móvil —— */
.works-mobile-hint {
  display: none;
  margin: -0.5rem 0 1rem;
}

@media (max-width: 1023px) {
  .works-mobile-hint { display: block; }
  .works-table-desktop { display: none !important; }
}

@media (min-width: 1024px) {
  .works-card-list { display: none !important; }

  .app-main:has(.page--admin-works) {
    max-width: 1440px;
  }

  .works-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    align-items: end;
    padding: 0.75rem;
  }

  .works-filters label {
    min-width: 0;
  }

  .works-filters .input {
    width: 100%;
  }

  .works-filter-actions {
    display: flex;
    gap: 0.45rem;
    justify-content: flex-end;
  }
}

.works-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.work-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 1rem 2.5rem 1rem 1.1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  position: relative;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}

.work-card:active {
  transform: scale(0.99);
}

.work-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.work-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.work-card-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.3;
}

.work-card-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.work-card-details {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border-light);
}

.work-card-detail {
  display: grid;
  gap: 0.15rem;
}

.work-card-detail-label {
  color: var(--primary-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.work-card-detail-value,
.work-list-detail {
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.work-card-detail-value {
  font-size: 0.82rem;
}

.work-list-note {
  display: block;
}

.work-list-note + .work-list-note {
  margin-top: 0.25rem;
}

.works-admin-table {
  table-layout: fixed;
}

.works-admin-table .work-list-detail {
  vertical-align: top;
}

.works-admin-table th,
.works-admin-table td {
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.works-admin-table th:nth-child(1) { width: 8%; }
.works-admin-table th:nth-child(2),
.works-admin-table th:nth-child(3) { width: 6%; }
.works-admin-table th:nth-child(4) { width: 12%; }
.works-admin-table th:nth-child(5) { width: 13%; }
.works-admin-table th:nth-child(6),
.works-admin-table th:nth-child(7) { width: 18%; }
.works-admin-table th:nth-child(8) { width: 9%; }
.works-admin-table th:nth-child(9) { width: 10%; }

.works-admin-table td {
  overflow-wrap: anywhere;
}

.works-admin-table .work-list-detail {
  line-height: 1.35;
}

.works-admin-table .work-list-detail-content {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.works-admin-table .work-status-cell {
  text-align: center;
}

.works-admin-table th:nth-child(8) {
  text-align: center;
}

.works-admin-table .work-actions-cell .btn-row {
  align-items: stretch;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.works-admin-table .work-actions-cell .btn {
  justify-content: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  width: 100%;
}

.work-card-chevron {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.35rem;
  color: var(--primary-light);
  font-weight: 700;
}

.work-row-desktop {
  cursor: pointer;
}

.detail-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.detail-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  align-items: start;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child { border-bottom: none; padding-bottom: 0; }

.detail-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.detail-value {
  font-size: 0.92rem;
  color: var(--text);
  word-break: break-word;
}

/* —— Ticar CTA admin —— */
.card-ticar-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  margin-bottom: 1.25rem;
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, var(--accent-soft) 0%, #fff 100%);
}

.card-ticar-cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-ticar-cta strong {
  display: block;
  color: var(--primary-dark);
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.card-ticar-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #52b848 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(67, 149, 57, 0.3);
}

/* —— Hub admin (Más) —— */
.admin-hub {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .admin-hub { grid-template-columns: repeat(3, 1fr); }
}

.admin-hub-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.25rem 0.75rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.88rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.admin-hub-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--primary-dark);
}

.admin-hub-item--accent {
  border-color: rgba(67, 149, 57, 0.35);
  background: linear-gradient(145deg, var(--accent-soft) 0%, #fff 100%);
}

.admin-hub-icon {
  font-size: 1.65rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-hub-icon svg {
  width: 1.65rem;
  height: 1.65rem;
  color: var(--primary);
}

.admin-hub-label { line-height: 1.25; }

/* —— Cerrar parte: materiales —— */
.modal-content--finish:not(.modal-sheet) {
  max-width: 420px;
  padding: 1.35rem 1.25rem 1.25rem;
}

.finish-step.hidden { display: none !important; }

.finish-lead {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.4;
}

.material-examples {
  margin: 0.85rem 0 1.15rem;
  padding: 0.75rem 0.9rem;
  background: var(--accent-soft);
  border: 1px solid rgba(67, 149, 57, 0.25);
  border-radius: var(--radius-sm);
}

.material-examples-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
  margin-bottom: 0.25rem;
}

/* —— Materiales rápidos (admin) —— */
.modal-qm:not(.modal-sheet) {
  max-width: 520px;
  padding: 1.25rem 1.2rem 1.1rem;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.modal-qm h3 { margin: 0 0 0.35rem; }

.qm-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.qm-modal-lead { margin: 0; max-width: 34ch; line-height: 1.45; }

.qm-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 0 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}

.qm-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
}

.qm-item:last-child { border-bottom: none; }

.qm-item--inactive { opacity: 0.55; }

.qm-item-main {
  flex: 1;
  min-width: 0;
}

.qm-item-chip {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: var(--surface-elevated);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-dark);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qm-item-meta {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.qm-item-meta strong {
  font-weight: 600;
  color: var(--text);
}

.qm-item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
}

.qm-item-actions .btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
  min-width: 4.5rem;
}

.qm-item-actions .qm-delete {
  color: #b42318;
}

.qm-item-actions .qm-delete:hover {
  background: #fef3f2;
  border-color: #fecdca;
}

.qm-form-panel {
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
  margin-bottom: 0.65rem;
}

.qm-form-panel.hidden { display: none !important; }

.qm-form-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.qm-form-grid {
  display: grid;
  grid-template-columns: 1fr 5.5rem;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.qm-field { display: block; margin: 0; }
.qm-field--wide { grid-column: 1 / -1; }

.qm-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.qm-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.88rem;
}

.qm-form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.qm-close { margin-top: 0.25rem; }

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-icon { font-size: 1rem; line-height: 1; }

@media (max-width: 480px) {
  .qm-form-grid { grid-template-columns: 1fr; }
  .qm-item-actions { flex-direction: row; flex-wrap: wrap; }
}

.material-chips {
  margin: 0.65rem 0 0.85rem;
}

.material-chip {
  font-size: 0.78rem;
  padding: 0.45rem 0.75rem;
}

.finish-actions--stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

#finish-error {
  margin-bottom: 0.85rem;
}

/* —— Admin: listas móvil + ajustes generales —— */
.entity-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.entity-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 1rem 2.5rem 1rem 1.1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  position: relative;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}

.entity-card:active { transform: scale(0.99); }

.entity-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.entity-card--muted {
  opacity: 0.82;
  background: var(--surface);
}

.client-filters {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.client-filters-row {
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

.client-filters-row label {
  min-width: 7.5rem;
}

.client-review-tool {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-elevated);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
}

.client-review-tool summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-dark);
  list-style: none;
}

.client-review-tool summary::-webkit-details-marker {
  display: none;
}

.client-review-tool summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}

.client-review-tool[open] summary::before {
  transform: rotate(90deg);
}

.client-review-tool-body {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.client-review-tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
}

.client-review-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.9rem;
  background: rgba(0, 86, 164, 0.08);
  border: 1px solid rgba(0, 86, 164, 0.18);
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--primary-dark);
}

.client-review-banner.hidden {
  display: none;
}

.table-wrap tr.row-muted td {
  color: var(--text-muted);
}

.text-danger {
  color: var(--danger);
}

.btn.text-danger:hover {
  color: #b91c1c;
}

.table-actions {
  white-space: nowrap;
}

.table-actions .btn {
  margin-left: 0.15rem;
}

.entity-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.entity-card-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.3;
  min-width: 0;
  overflow-wrap: anywhere;
}

.entity-card-sub {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.entity-card-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.entity-card-chevron {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.35rem;
  color: var(--primary-light);
  font-weight: 700;
}

@media (max-width: 767px) {
  .admin-table-desktop { display: none !important; }
  .admin-mobile-list { display: flex; }

  .page-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .page-header-actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
  }

  .page-header-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .page-header-row > .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .filters--dates {
    flex-direction: column;
    align-items: stretch;
  }

  .filters--dates .input,
  .filters--dates .btn {
    width: 100%;
    flex: 1 1 auto;
  }

  .filters--inline {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
  }

  .filters--inline label {
    width: 100%;
    margin-bottom: 0.65rem;
  }

  .table-wrap {
    border-radius: var(--radius-sm);
    margin-left: -0.15rem;
    margin-right: -0.15rem;
  }

  th, td {
    padding: 0.65rem 0.55rem;
    font-size: 0.8rem;
  }

  .app-main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 768px) {
  .admin-mobile-list { display: none !important; }
}

/* —— Logout POST en cabecera —— */
.header-logout-form {
  display: inline;
  margin: 0;
}

/* —— Historial auditoría partes —— */
.audit-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.audit-title {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.audit-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.84rem;
  line-height: 1.45;
}

.audit-item:last-child { border-bottom: none; }

.audit-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.2rem;
}

.audit-item-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
}

.audit-old {
  color: var(--text-muted);
  text-decoration: line-through;
}

.audit-arrow {
  color: var(--text-muted);
  font-weight: 700;
}

.audit-new {
  font-weight: 700;
  color: var(--primary-dark);
}

.audit-reason {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.audit-meta {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

/* —— Materiales: tarjetas móvil —— */
@media (max-width: 767px) {
  .materials-table-desktop { display: none !important; }
}

@media (min-width: 768px) {
  .materials-card-list { display: none !important; }
}

.materials-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.material-card {
  padding: 1rem 1.1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.material-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.material-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.material-card-title {
  margin: 0 0 0.25rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.material-card-meta,
.material-card-text {
  margin: 0 0 0.45rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.material-card-text { color: var(--text); }

.material-notes-label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.65rem;
}

.material-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* —— Costes: tarjetas móvil —— */
@media (max-width: 767px) {
  .profit-table-desktop { display: none !important; }
}

@media (min-width: 768px) {
  .profit-card-list { display: none !important; }
}

.profit-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profit-card {
  padding: 1rem 1.1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.profit-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.profit-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  min-width: 0;
  overflow-wrap: anywhere;
}

.profit-card-total {
  font-size: 1rem;
  color: var(--primary);
  white-space: nowrap;
}

.profit-card-labels {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.profit-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.75rem;
  margin: 0;
}

.profit-card-stats div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.profit-card-stats dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.profit-card-stats dd {
  margin: 0;
  font-weight: 600;
}

.must-change-banner {
  margin-bottom: 1rem;
}
