:root {
  --bg: #f4f1ec;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(249, 247, 243, 0.96);
  --line: rgba(20, 20, 20, 0.1);
  --text: #141414;
  --muted: #6d6d6d;
  --accent: #f2762e;
  --accent-strong: #f2913d;
  --accent-soft: #fff1e7;
  --accent-ink: #9c4a10;
  --slate: #3b3b3b;
  --ok: #24714f;
  --warn: #9b5a15;
  --danger: #a43b34;
  --shadow: 0 24px 60px rgba(20, 20, 20, 0.12);
  --radius-xl: 30px;
  --radius-md: 18px;
  --sidebar: rgba(20, 20, 20, 0.96);
  --sidebar-soft: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Aptos", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #faf7f2 0%, #eeebe5 100%);
}
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(242, 118, 46, 0.18), transparent 22%),
    radial-gradient(circle at right 18%, rgba(242, 145, 61, 0.12), transparent 18%),
    linear-gradient(135deg, rgba(20, 20, 20, 0.03) 0%, transparent 42%);
}
.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(120deg, rgba(20, 20, 20, 0.05) 0 2px, transparent 2px 28px);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 82%);
}
.auth-screen { position: relative; z-index: 1; display: grid; place-items: center; min-height: 100vh; padding: 32px; }
.auth-panel, .app-shell, .metric-grid, .content-grid.two-up, .content-grid.three-up, .demo-accounts, .stack-list, .form-grid, .nav { display: grid; }
.auth-panel { grid-template-columns: 1.25fr 430px; gap: 28px; width: min(1240px, 100%); }
.auth-copy, .login-card, .sidebar, .panel, .metric-card, .toast { backdrop-filter: blur(14px); }
.auth-copy {
  position: relative;
  overflow: hidden;
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(160deg, rgba(20, 20, 20, 0.96), rgba(38, 38, 38, 0.94));
  color: #f7f2ec;
  box-shadow: var(--shadow);
}
.auth-copy::before {
  content: "";
  position: absolute;
  inset: auto -80px -90px auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 118, 46, 0.28) 0%, transparent 70%);
}
.auth-copy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0 62%, rgba(242, 118, 46, 0.08) 62% 100%);
  pointer-events: none;
}
.eyebrow { margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; opacity: 0.76; }
.auth-copy h1, .login-card h2, .topbar h1, .panel h3, .sidebar h2 { margin: 0; font-family: "Bahnschrift", "Segoe UI Semibold", sans-serif; letter-spacing: 0.01em; }
.auth-copy h1 { font-size: clamp(2.5rem, 4.2vw, 4.4rem); line-height: 0.95; max-width: 11ch; position: relative; z-index: 1; }
.lead { max-width: 56ch; color: rgba(247, 242, 236, 0.84); line-height: 1.7; position: relative; z-index: 1; }
.hero-brand { position: relative; z-index: 1; display: flex; align-items: center; margin-bottom: 26px; }
.hero-logo { width: min(460px, 100%); height: auto; display: block; filter: drop-shadow(0 22px 34px rgba(0, 0, 0, 0.22)); }
.auth-highlights { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 28px 0 26px; }
.highlight-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
}
.highlight-card strong { color: #fff; font-size: 1rem; }
.highlight-card span { color: rgba(247, 242, 236, 0.74); line-height: 1.5; }
.demo-accounts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.demo-card { display: grid; gap: 6px; padding: 16px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.05); position: relative; z-index: 1; }
.demo-card span { color: rgba(247, 242, 236, 0.75); }
.login-card { padding: 32px; border: 1px solid rgba(20, 20, 20, 0.08); border-radius: var(--radius-xl); background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow); }
.login-card-header { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.login-logo { width: 112px; height: auto; display: block; }
.login-copy { margin: 0 0 18px; color: var(--muted); line-height: 1.6; }
.login-card label, .form-grid label { display: grid; gap: 8px; color: var(--muted); font-size: 0.95rem; }
input, select, textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.98); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(242, 118, 46, 0.18); border-color: rgba(242, 118, 46, 0.42); }
textarea { resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; border: 0; border-radius: 14px; cursor: pointer; transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease; font-weight: 600; }
.btn:hover { transform: translateY(-1px); filter: brightness(0.98); }
.btn-primary { background: linear-gradient(145deg, var(--accent), var(--accent-strong)); color: #fff; box-shadow: 0 12px 24px rgba(242, 118, 46, 0.24); }
.btn-secondary { background: rgba(20, 20, 20, 0.06); color: var(--text); }
.btn-danger { background: rgba(164, 59, 52, 0.12); color: var(--danger); }
.form-note { margin: 12px 0 0; color: var(--muted); line-height: 1.55; }
.form-error { margin: 14px 0 0; color: var(--danger); }
.form-mode { margin: 0; color: var(--accent-ink); font-size: 0.9rem; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.app-shell { position: relative; z-index: 1; grid-template-columns: 300px 1fr; gap: 28px; max-width: 1580px; margin: 0 auto; padding: 24px; }
.sidebar { position: sticky; top: 24px; align-self: start; padding: 24px; border-radius: var(--radius-xl); background: linear-gradient(180deg, var(--sidebar) 0%, #242424 100%); color: #f7f2ec; border: 1px solid rgba(255, 255, 255, 0.04); box-shadow: var(--shadow); }
.brand { display: grid; gap: 16px; align-items: start; margin-bottom: 24px; }
.sidebar-brand-logo-button { background: transparent; border: 0; padding: 0; margin: 0; cursor: pointer; display: block; width: fit-content; }
.sidebar-brand-logo-button:hover .sidebar-brand-logo { transform: scale(1.02); }
.sidebar-brand-logo { width: 168px; max-width: 100%; height: auto; display: block; mix-blend-mode: screen; transition: transform 0.15s ease; }
.hero-logo, .login-logo { mix-blend-mode: multiply; }
.brand-copy { display: grid; gap: 6px; }
.brand-copy small { color: rgba(247, 242, 236, 0.62); }
.nav { gap: 8px; }
.nav-link { position: relative; min-height: 48px; padding: 0 16px 0 18px; border: 0; border-radius: 14px; background: transparent; color: rgba(247, 242, 236, 0.82); text-align: left; cursor: pointer; transition: background 160ms ease, transform 160ms ease, padding 160ms ease; }
.nav-link::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 999px; background: transparent; }
.nav-link:hover, .nav-link.active { background: rgba(255, 255, 255, 0.08); color: #fff; padding-left: 22px; }
.nav-link.active::before { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); }
.nav-link:hover { transform: translateX(3px); }
.sidebar-note { margin-top: 24px; padding: 16px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.06); color: rgba(247, 242, 236, 0.8); line-height: 1.6; border: 1px solid rgba(255, 255, 255, 0.05); }
.main-content { display: grid; gap: 20px; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 8px 4px; }
.topbar h1 { font-size: clamp(2rem, 3vw, 3rem); }
.topbar-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: rgba(242, 118, 46, 0.12);
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.notification-wrap { position: relative; }
.notification-button { position: relative; min-width: 48px; padding: 0 14px; }
.notification-icon { font-size: 1.05rem; }
.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(242, 118, 46, 0.3);
}
.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 32px));
  max-height: 72vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  z-index: 1200;
}
.notification-panel h3,
.notification-panel h4 { margin: 0; }
.notification-list { display: grid; gap: 10px; }
.notification-section { display: grid; gap: 10px; }
.notification-section + .notification-section { margin-top: 14px; }
.notification-section-header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.notification-item {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  cursor: pointer;
}
.notification-item:hover { border-color: var(--accent); }
.notification-item small,
.notification-item p { margin: 0; color: var(--muted); }
.notification-item--warn { border-left: 3px solid var(--warn); }
.notification-item--danger { border-left: 3px solid var(--danger); }
.notification-item--ok { border-left: 3px solid var(--ok); }
.user-chip { display: grid; gap: 4px; min-width: 220px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.user-chip small { color: var(--muted); text-transform: capitalize; }
.screen { display: none; gap: 20px; }
.screen.active { display: grid; }
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.content-grid.two-up { grid-template-columns: 1.1fr 1fr; gap: 18px; }
.content-grid.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.metric-card { display: grid; gap: 10px; padding: 22px; background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(249, 245, 239, 0.92)); position: relative; overflow: hidden; }
.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}
.metric-card strong { font-size: 2rem; }
.metric-card span, .metric-card small { color: var(--muted); }
.metric-card.highlight { background: linear-gradient(150deg, var(--accent-soft), #fff8f2); }
.panel { padding: 22px; background: var(--surface); }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.panel-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-field { display: grid; gap: 8px; min-width: min(100%, 360px); color: var(--muted); font-size: 0.95rem; }
.stack-list { gap: 12px; }
.stack-item { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.stack-item small, .stack-item p { margin: 0; color: var(--muted); }
.stack-item p { line-height: 1.55; }
.segmented-control { display: inline-flex; gap: 6px; padding: 6px; border-radius: 999px; background: rgba(20, 20, 20, 0.05); }
.segmented-control button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.segmented-control button.is-active { background: #fff; color: var(--accent-ink); box-shadow: 0 8px 18px rgba(20, 20, 20, 0.08); }
.stack-item.clickable, .metric-card.clickable { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.stack-item.clickable:hover, .metric-card.clickable:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 28px rgba(242, 118, 46, 0.18); }
.metric-card .metric-chevron { position: absolute; top: 18px; right: 20px; font-size: 0.85rem; color: var(--muted); }
.metric-card.is-open { border-color: var(--accent); box-shadow: 0 12px 32px rgba(242, 118, 46, 0.22); }
.metric-drawer { max-height: 0; overflow: hidden; transition: max-height 0.35s ease, margin 0.35s ease; margin-top: 0; }
.metric-drawer.open { max-height: 1400px; margin-top: 18px; }
.metric-drawer-panel { padding: 22px 26px; }
.metric-drawer-total { font-size: 1.4rem; color: var(--accent-ink); }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.compact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.top-gap { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.status-tag { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: 0.8rem; }
.status-ok { color: var(--ok); background: rgba(36, 113, 79, 0.12); }
.status-warn { color: var(--warn); background: rgba(163, 88, 26, 0.14); }
.status-pending { color: var(--accent-ink); background: rgba(242, 118, 46, 0.14); }
.status-danger { color: var(--danger); background: rgba(164, 59, 52, 0.14); }
.empty-state { padding: 14px; border: 1px dashed rgba(20, 20, 20, 0.16); border-radius: 16px; color: var(--muted); background: rgba(255, 255, 255, 0.62); }
.document-link { color: var(--accent-ink); text-decoration: none; font-weight: 600; }
.document-link:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-button { min-height: 34px; padding: 0 10px; border-radius: 10px; font-size: 0.84rem; }
.icon-button { min-width: 36px; padding: 0; }
.icon-button span { font-size: 1rem; line-height: 1; }
.toast { position: fixed; right: 26px; bottom: 24px; max-width: 360px; padding: 14px 16px; border: 1px solid rgba(20, 20, 20, 0.08); border-radius: 16px; background: rgba(20, 20, 20, 0.94); color: #fff; box-shadow: var(--shadow); }
.chart-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: end; min-height: 280px; }
.chart-group { display: grid; gap: 10px; }
.chart-bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; min-height: 220px; padding: 16px 12px 0; border-radius: 18px; background: linear-gradient(180deg, rgba(20, 20, 20, 0.03), rgba(20, 20, 20, 0)); }
.chart-bar { border-radius: 16px 16px 4px 4px; min-height: 14px; }
.chart-bar-income { background: linear-gradient(180deg, var(--accent-strong), var(--accent)); }
.chart-bar-expense { background: linear-gradient(180deg, #4a4a4a, #202020); }
.progress-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.progress-track { overflow: hidden; width: 100%; height: 12px; border-radius: 999px; background: rgba(20, 20, 20, 0.08); }
.progress-fill { display: block; height: 100%; border-radius: 999px; }
.progress-fill.status-ok { background: linear-gradient(90deg, rgba(36, 113, 79, 0.7), rgba(36, 113, 79, 1)); }
.progress-fill.status-warn { background: linear-gradient(90deg, rgba(163, 88, 26, 0.65), rgba(163, 88, 26, 1)); }
.progress-fill.status-danger { background: linear-gradient(90deg, rgba(164, 59, 52, 0.7), rgba(164, 59, 52, 1)); }
@media (max-width: 1280px) {
  .auth-highlights { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid.two-up, .content-grid.three-up, .auth-panel, .app-shell { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar { position: relative; top: 0; }
}
@media (max-width: 760px) {
  .hero-logo, .sidebar-brand-logo, .login-logo { width: min(100%, 180px); }
  .auth-screen, .app-shell { padding: 16px; }
  .form-grid, .compact-form, .metric-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar, .topbar-actions { flex-direction: column; align-items: stretch; }
  .user-chip { min-width: 0; }
  .notification-panel { left: 0; right: auto; width: min(100%, calc(100vw - 32px)); }
}

.due-date { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.due-date.due-soon { color: #d97706; font-weight: 600; }
.due-date.due-overdue { color: #dc2626; font-weight: 700; }
.alert-due-overdue { border-left: 3px solid #dc2626; }
.alert-due-soon { border-left: 3px solid #d97706; }

/* Obras */
.obra-card { margin-bottom: 16px; }
.obra-item { padding: 0; overflow: hidden; }
.obra-summary { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 20px 22px; cursor: pointer; list-style: none; }
.obra-summary::-webkit-details-marker { display: none; }
.obra-summary-main,
.obra-summary-meta { display: grid; gap: 6px; }
.obra-summary-meta { justify-items: end; text-align: right; }
.obra-content { display: grid; gap: 14px; padding: 0 22px 22px; border-top: 1px solid var(--line); }
.task-list { display: grid; gap: 12px; }
.task-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; }
.task-photo { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; margin-right: 8px; }
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: #e2e8f0; }
.status-badge.status-Finalizada { background: #dcfce7; }
.status-badge.status-Pausada { background: #fef3c7; }
.material-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 2px 0; }
.btn-xs { padding: 4px 8px; font-size: 12px; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.modal-overlay.hidden { display: none; }
.modal-content { background: #fff; border-radius: 12px; max-width: 900px; width: 92%; max-height: 90vh; overflow: auto; padding: 20px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; margin-bottom: 12px; }
.modal-body { font-size: 13px; }
.modal-close { background: none; border: none; font-size: 16px; cursor: pointer; }
.attendance-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.attendance-legend-item,
.attendance-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.attendance-legend-item { min-height: 32px; padding: 0 10px; font-size: 0.85rem; }
.attendance-calendar { display: grid; gap: 10px; }
.attendance-calendar-head,
.attendance-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.attendance-calendar-head span { text-align: center; font-size: 0.78rem; text-transform: uppercase; color: var(--muted); }
.attendance-day {
  min-height: 88px;
  padding: 10px 8px;
  background: var(--surface-soft);
  flex-direction: column;
  gap: 6px;
  text-align: center;
}
.attendance-day strong { font-size: 1rem; }
.attendance-day small { color: var(--muted); line-height: 1.2; }
.attendance-day.is-outside { opacity: 0.35; }
.attendance-day.is-today { outline: 2px solid var(--accent); }
.attendance-day.is-weekend { background: rgba(20, 20, 20, 0.03); }
.attendance-type-local { background: rgba(242, 118, 46, 0.18); color: var(--accent-ink); }
.attendance-type-viatico { background: rgba(107, 114, 128, 0.18); color: #374151; }
.attendance-type-lluvia_6hs { background: rgba(96, 165, 250, 0.18); color: #1d4ed8; }
.attendance-type-falta { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.attendance-type-licencia { background: rgba(168, 85, 247, 0.14); color: #7e22ce; }
.attendance-type-medico { background: rgba(236, 72, 153, 0.14); color: #be185d; }
.attendance-type-empty { background: rgba(148, 163, 184, 0.14); color: #475569; }
.attendance-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.attendance-summary-card { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.attendance-summary-card strong { display: block; font-size: 1.3rem; margin-top: 6px; }

/* Equipo */
.employee-card { margin-bottom: 16px; }
.employee-list--compact .employee-card { padding: 18px; }
.employee-list--expanded .employee-card { padding: 22px; }
.employee-compact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 10px; }
.employee-compact-grid small { color: var(--muted); }
.vehicle-card { margin-bottom: 16px; }
.vehicle-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.employee-sub { border-top: 1px solid #e2e8f0; padding-top: 8px; }
.attendance-chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; background: #e2e8f0; margin: 2px; }
.attendance-chip { border: 0; cursor: pointer; }
.attendance-chip.local { background: #dcfce7; }
.attendance-chip.viatico { background: #fef3c7; }
.attendance-chip.lluvia_6hs { background: #dbeafe; }
.attendance-chip.falta { background: #fee2e2; }
.attendance-chip.licencia { background: #e0e7ff; }
.attendance-chip.medico { background: #fce7f3; }
.rubro-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; background: #e2e8f0; margin-left: 6px; }
.sunca-badge { background: #fde68a; }
.dashboard-attendance-missing { border-left: 3px solid #d97706; }

@media print {
  body.printing-report .sidebar,
  body.printing-report .topbar,
  body.printing-report .nav-link,
  body.printing-report .modal-close,
  body.printing-report .app-shell > aside { display: none !important; }
  body.printing-report .modal-overlay { position: static; background: #fff; }
  body.printing-report .modal-content { position: static; box-shadow: none; max-height: none; width: 100%; }
}

@media (max-width: 760px) {
  .employee-compact-grid { grid-template-columns: 1fr; }
  .vehicle-card-grid { grid-template-columns: 1fr; }
  .obra-summary { flex-direction: column; align-items: flex-start; }
  .obra-summary-meta { justify-items: start; text-align: left; }
  .attendance-calendar-head,
  .attendance-calendar-grid,
  .attendance-summary-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Mobile UX pass — drawer sidebar, collapsible panels, table cards
   All changes scoped to <=900px so desktop stays untouched.
   ============================================================ */

html { -webkit-tap-highlight-color: transparent; }

/* Hover effects only on devices that actually have hover */
@media (hover: none) {
  .btn:hover { transform: none; filter: none; }
  .nav-link:hover { transform: none; padding-left: 18px; background: transparent; color: rgba(247, 242, 236, 0.82); }
  .nav-link.active:hover { background: rgba(255, 255, 255, 0.08); color: #fff; padding-left: 22px; }
  .stack-item.clickable:hover, .metric-card.clickable:hover { transform: none; border-color: var(--line); box-shadow: var(--shadow); }
  .notification-item:hover { border-color: var(--line); }
}

/* Mobile topbar + overlay are hidden on desktop */
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }

/* Panel collapse chevron — desktop optional, mobile required */
.panel-head { cursor: default; }
.panel-head .panel-toggle {
  background: transparent;
  border: 0;
  padding: 6px 8px;
  font-size: 1rem;
  color: var(--muted);
  cursor: pointer;
  transition: transform 200ms ease;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.panel.is-collapsible .panel-head { cursor: pointer; }
.panel.panel-collapsed > *:not(.panel-head) { display: none !important; }
.panel.panel-collapsed .panel-head { margin-bottom: 0; }
.panel.panel-collapsed .panel-toggle { transform: rotate(-90deg); }

/* Sidebar footer (Salir + notif + user) — solo visible en mobile */
.sidebar-footer-mobile { display: none; }

@media (max-width: 900px) {
  /* App layout: single column, sidebar becomes drawer */
  .app-shell { grid-template-columns: 1fr; padding: 12px; gap: 14px; padding-top: 70px; }

  .sidebar { display: flex; flex-direction: column; }
  .sidebar .nav { flex: 1 1 auto; }
  .sidebar-footer-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .sidebar-user-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #f7f2ec;
    font-size: 0.95rem;
  }
  .sidebar-user-chip small { color: rgba(247,242,236,0.62); font-size: 0.78rem; }
  .sidebar-footer-actions { display: flex; flex-direction: column; gap: 8px; }
  .sidebar-footer-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    position: relative;
  }
  #sidebar-notification-badge {
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7rem;
    margin-left: 6px;
  }
  #sidebar-notification-badge.hidden { display: none; }

  /* Mobile topbar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    padding: 0 12px;
    background: linear-gradient(180deg, var(--sidebar) 0%, #242424 100%);
    color: #f7f2ec;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    z-index: 1500;
  }
  .mobile-topbar.hidden { display: none; }
  .mobile-hamburger,
  .mobile-kebab {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .mobile-kebab { background: rgba(255,255,255,0.1); }
  .mobile-topbar-title {
    flex: 1;
    text-align: center;
    font-family: "Bahnschrift", "Segoe UI Semibold", sans-serif;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Sidebar as drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: min(82vw, 320px);
    height: 100vh;
    margin: 0;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    z-index: 1600;
    overflow-y: auto;
    padding-top: 70px;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1550;
  }

  /* Desktop topbar — hide on mobile, mobile-topbar replaces it */
  .topbar { display: none; }

  /* Hide kebab if no mobile actions populated */
  .mobile-kebab.is-empty { visibility: hidden; }
  .mobile-action-sheet {
    position: fixed;
    top: 60px;
    right: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 8px;
    display: none;
    z-index: 1700;
    min-width: 220px;
    max-width: calc(100vw - 16px);
  }
  .mobile-action-sheet.open { display: grid; gap: 6px; }
  .mobile-action-sheet .btn { width: 100%; justify-content: flex-start; }

  /* Dashboard metric grid: 2 columns on mobile */
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .metric-card { padding: 14px; }
  .metric-card strong { font-size: 1.4rem; }
  .content-grid.two-up,
  .content-grid.three-up { grid-template-columns: 1fr !important; gap: 12px; }
  .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Panels become tighter, all collapsible, chevron shown */
  .panel { padding: 16px; border-radius: 18px; }
  .panel-head { margin-bottom: 12px; align-items: center; }

  /* Forms — single column, big tap targets, no iOS zoom */
  .form-grid,
  .compact-form { grid-template-columns: 1fr !important; gap: 12px; }
  input, select, textarea {
    font-size: 16px;
    padding: 14px 12px;
    border-radius: 12px;
  }
  .btn { min-height: 48px; padding: 0 16px; }
  .form-actions .btn { width: 100%; }
  .form-actions { flex-direction: column; gap: 8px; }

  /* Sticky submit bar opt-in (forms can add .has-sticky-submit) */
  form.has-sticky-submit button[type="submit"] {
    position: sticky;
    bottom: 0;
    width: 100%;
    box-shadow: 0 -8px 20px rgba(0,0,0,0.08);
    background: linear-gradient(145deg, var(--accent), var(--accent-strong));
    color: #fff;
    z-index: 5;
  }

  /* Tables → cards */
  .table-wrap { overflow-x: visible; }
  .panel table thead { display: none; }
  .panel table,
  .panel table tbody,
  .panel table tr,
  .panel table td {
    display: block;
    width: 100%;
  }
  .panel table tr {
    background: var(--surface);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  }
  .panel table td {
    border: 0 !important;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    text-align: right;
    min-height: 32px;
  }
  .panel table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    text-align: left;
  }
  .panel table td:empty { display: none; }
  .panel table td .row-actions { justify-content: flex-end; flex-wrap: wrap; }

  /* Modales full-screen */
  .modal-overlay { align-items: stretch; justify-content: stretch; }
  .modal-content {
    width: 100vw !important;
    max-width: none !important;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0 !important;
    padding: 0;
    display: flex;
    flex-direction: column;
  }
  .modal-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 5;
    padding: 14px 16px;
    margin: 0;
    border-bottom: 1px solid var(--line);
  }
  .modal-close { min-width: 44px; min-height: 44px; font-size: 1.6rem; }
  .modal-body { padding: 16px; flex: 1; overflow: auto; }

  /* Notification panel anchored under topbar */
  .notification-panel {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 76px);
  }

  /* Icon buttons big enough */
  .icon-button { min-width: 44px; min-height: 44px; }
  .table-button { min-height: 40px; padding: 0 12px; }
  .nav-link { min-height: 52px; font-size: 1rem; }

  /* Topbar badge inside sidebar isn't shown — sidebar has its own brand block */
  .topbar-badge { display: none; }
}
