:root {
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-primary: #1f6feb;
  --color-primary-hover: #1858bf;
  --color-text: #1f2937;
  --color-text-soft: #6b7280;
  --color-border: #e5e7eb;
  --color-error-bg: #fdecea;
  --color-error-text: #b71c1c;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card .logo {
  width: 140px;
  height: auto;
  margin-bottom: 16px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0.5px;
}

.login-card .subtitle {
  margin: 0 0 28px;
  color: var(--color-text-soft);
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-primary:disabled {
  background: #93b6ee;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: #f0f2f7;
}

.ms-icon {
  width: 18px;
  height: 18px;
}

.alert {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  text-align: left;
}

.alert-error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

.hidden {
  display: none !important;
}

/* Home */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header .brand img {
  height: 44px;
  width: auto;
}

.app-header .brand .app-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.home-header {
  justify-content: flex-end;
}

.menu-staffing-logo {
  display: flex;
  justify-content: center;
  margin: 10px 0 12px;
}

.menu-staffing-logo img {
  height: 176px;
  width: auto;
}

.header-center-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.header-center-logo img {
  height: 44px;
  width: auto;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-indicator {
  font-size: 20px;
  line-height: 1;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.user-info .user-name {
  font-weight: 600;
  font-size: 14px;
}

.user-info .user-email {
  font-size: 12px;
  color: var(--color-text-soft);
}

.user-photo,
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #d6e4ff;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.app-main {
  padding: 32px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.placeholder-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 32px;
  text-align: center;
  color: var(--color-text-soft);
}

.placeholder-card h2 {
  margin: 0 0 8px;
  color: var(--color-text);
}

.menu-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.menu-card h2 {
  margin: 0 0 8px;
}

.menu-card p {
  margin: 0 0 18px;
  color: var(--color-text-soft);
}

.menu-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.menu-item {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  background: #fafcff;
  text-decoration: none;
  color: var(--color-text);
  display: block;
}

.menu-item:hover {
  border-color: #b7cdf5;
  background: #f3f8ff;
}

.menu-item-title {
  display: block;
  font-weight: 600;
}

.menu-item-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--color-text-soft);
  font-size: 13px;
}

.app-main.recursos-layout {
  display: grid;
  gap: 18px;
  max-width: none;
  width: calc(100vw - 24px);
  margin: 0 auto;
  padding: 20px 0;
}

.panel {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.panel h3 {
  margin-top: 0;
}

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

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.form-grid input,
.form-grid select {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.multi-select {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
}

.multi-select summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 14px;
}

.multi-select summary::-webkit-details-marker {
  display: none;
}

.multi-select-options {
  border-top: 1px solid var(--color-border);
  max-height: 180px;
  overflow: auto;
  padding: 6px 8px;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
}

.gap-alert {
  background: #fdecea;
}

#recursos-tbody tr:nth-child(even),
#proyectos-tbody tr:nth-child(even),
#asignaciones-tbody tr:nth-child(even) {
  background: #f3f8ff;
}

.data-table a,
.data-table a:visited,
.data-table a:hover,
.data-table a:active {
  color: #000;
}

.data-table a.icon-link,
.data-table a.icon-link:visited,
.data-table a.icon-link:hover,
.data-table a.icon-link:active {
  text-decoration: none;
}

#user-photo:not(.hidden) + #user-avatar {
  display: none !important;
}

.disponibilidad-high {
  background: #fff4d6;
}

.disponibilidad-over {
  background: #fdecea;
}

.form-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  max-height: 60vh;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 8px;
  text-align: left;
  white-space: nowrap;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--color-surface);
}

.data-table th button {
  border: none;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  font-size: 12px;
  padding: 6px 8px;
}

.btn-danger {
  background: #fbe7e7;
  color: #8f1e1e;
  border-color: #f1c7c7;
}

.timeline-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.timeline-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.timeline-controls input {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.timeline-wrap {
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  max-height: 70vh;
}

.timeline-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 12px;
  background: #fff;
}

.timeline-table th,
.timeline-table td {
  border: 1px solid var(--color-border);
  text-align: center;
  padding: 4px;
}

.timeline-project-header,
.timeline-project {
  position: sticky;
  left: 0;
  background: #fff;
  min-width: 280px;
  text-align: left !important;
  z-index: 2;
}

.timeline-project {
  font-size: 12px;
  line-height: 1.25;
}

.timeline-meta-small {
  color: var(--color-text-soft);
  font-size: 11px;
}

.timeline-month {
  background: #f6f8fd;
  font-weight: 600;
}

.timeline-day {
  background: #fbfcff;
  width: 26px;
  min-width: 26px;
}

.timeline-cell {
  width: 26px;
  min-width: 26px;
  height: 24px;
  background: #fff;
}

.timeline-cell.active {
  border-color: rgba(0, 0, 0, 0.08);
}
