/* ========================================================
   ÉPICA — Taller de Mobiliario Rose & Carpintería
   Design System & Styling (Vanilla CSS)
   ======================================================== */

:root {
  /* Color Palette */
  --bg-dark: #0a0e17;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 52, 0.85);
  --bg-input: rgba(14, 19, 31, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #f59e0b;

  /* Rose & Amber Warm Wood Tones */
  --rose-primary: #e11d48;
  --rose-hover: #f43f5e;
  --amber-primary: #f59e0b;
  --amber-hover: #d97706;
  --copper-glow: rgba(245, 158, 11, 0.25);

  /* Traffic Light / Semáforo Status Colors */
  --status-pending: #94a3b8;
  --status-pending-bg: rgba(148, 163, 184, 0.15);
  --status-progress: #facc15;
  --status-progress-bg: rgba(250, 204, 21, 0.15);
  --status-partial: #38bdf8;
  --status-partial-bg: rgba(56, 189, 248, 0.15);
  --status-done: #10b981;
  --status-done-bg: rgba(16, 185, 129, 0.15);
  --status-blocked: #ef4444;
  --status-blocked-bg: rgba(239, 68, 68, 0.15);

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-heading: "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Elevation & Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.25);

  /* Transitions */
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(225, 29, 72, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 60%);
  background-attachment: fixed;
}

/* Glass Panel Styling */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

/* Helper Utilities */
.hidden { display: none !important; }
.active { display: block; }

/* ========================================================
   LOGIN VIEW
   ======================================================== */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.2), rgba(245, 158, 11, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--amber-primary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-title span {
  background: linear-gradient(135deg, var(--rose-hover), var(--amber-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.4rem;
  max-width: 480px;
}

.login-card {
  width: 100%;
  max-width: 460px;
  padding: 2.5rem;
  border-radius: 20px;
  animation: fadeInDown 0.4s ease-out;
}

.login-card-header {
  margin-bottom: 2rem;
  text-align: center;
}

.login-card-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-card-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.7;
}

.input-wrapper input,
textarea,
select {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

textarea {
  padding: 0.85rem 1rem;
}

.input-wrapper input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--amber-primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  background: rgba(22, 29, 46, 0.95);
}

.btn-toggle-pwd {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.btn-toggle-pwd:hover {
  opacity: 1;
}

.form-row.remember-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.825rem;
  margin-bottom: 1.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--amber-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.825rem;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber-primary), #ea580c);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
  filter: brightness(1.08);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-block {
  width: 100%;
}

.login-card-footer {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* ========================================================
   APP HEADER
   ======================================================== */
.app-header {
  position: sticky;
  top: 0.75rem;
  left: 0;
  right: 0;
  margin: 0.75rem 1.25rem;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 14px;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-logo {
  display: flex;
  flex-direction: column;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff, var(--amber-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tag {
  font-size: 0.65rem;
  color: var(--rose-primary);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-done);
  box-shadow: 0 0 8px var(--status-done);
  animation: pulse 2s infinite;
}

.status-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6ee7b7;
}

/* Nav Tabs */
.header-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-tab.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15);
}

.nav-tab .badge {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.7rem;
}

.nav-tab.active .badge {
  background: var(--amber-primary);
  color: #000;
  font-weight: 700;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: rotate(30deg);
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-color);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-primary), var(--amber-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  background: var(--rose-primary);
  color: #fff;
}

/* ========================================================
   MAIN WORKSPACE & TOOLBARS
   ======================================================== */
.app-main {
  max-width: 1540px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 3rem;
}

.toolbar-card {
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 300px;
}

.toolbar-search input {
  padding-left: 2.75rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.6;
}

.btn-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
}

.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-right: 0.2rem;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.filter-pill.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--amber-primary);
  font-weight: 600;
}

/* ========================================================
   OBRAS GRID & CARDS
   ======================================================== */
.obras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 1.5rem;
}

.obra-card {
  padding: 1.5rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.obra-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--rose-primary), var(--amber-primary));
  opacity: 0.8;
}

.obra-card:hover {
  transform: translateY(-4px);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.obra-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.obra-card-title-group h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.obra-partner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--amber-primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.obra-status-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.obra-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-chip.highlight {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

.meta-chip.attachments-chip {
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.08);
  font-weight: 600;
}

/* Progress bar inside card */
.obra-card-progress {
  margin-bottom: 1.25rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

.progress-pct {
  font-weight: 700;
  color: #10b981;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rose-primary), var(--amber-primary), #10b981);
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mini Semáforo Strip */
.mini-semaforo-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.mini-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  cursor: help;
}

.step-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
}

.step-indicator.pending { background: var(--status-pending); opacity: 0.5; }
.step-indicator.in_progress { background: var(--status-progress); box-shadow: 0 0 8px var(--status-progress); animation: pulse 1.5s infinite; }
.step-indicator.partial_done { background: var(--status-partial); box-shadow: 0 0 8px var(--status-partial); }
.step-indicator.done { background: var(--status-done); box-shadow: 0 0 8px var(--status-done); }
.step-indicator.blocked { background: var(--status-blocked); box-shadow: 0 0 8px var(--status-blocked); animation: pulse 1s infinite; }

.step-num {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 700;
}

/* Obra Card Footer */
.obra-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  gap: 0.75rem;
}

.btn-open-detail {
  flex: 1;
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-primary);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-open-detail:hover {
  background: var(--amber-primary);
  color: #000;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-view-planos {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-view-planos:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ========================================================
   SINGLE OBRA DETAILED WORKBENCH
   ======================================================== */
.detail-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.detail-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.detail-breadcrumbs .separator {
  color: var(--text-dim);
}

.detail-breadcrumbs .active {
  color: #fff;
  font-weight: 600;
}

.obra-header-card {
  padding: 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}

.header-main-info {
  flex: 1;
  min-width: 320px;
}

.header-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.header-title-row h2 {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
}

.status-badge {
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge.completada { background: var(--status-done-bg); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.status-badge.en_proceso { background: var(--status-progress-bg); color: #fde047; border: 1px solid rgba(253, 224, 71, 0.3); }
.status-badge.no_iniciada { background: var(--status-pending-bg); color: #cbd5e1; border: 1px solid rgba(203, 213, 225, 0.3); }

.type-badge {
  background: rgba(225, 29, 72, 0.15);
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: #fb7185;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.header-client-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.client-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.meta-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.highlight-link {
  color: var(--amber-primary);
  font-weight: 600;
}

.header-stats-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  min-width: 240px;
  background: rgba(0, 0, 0, 0.25);
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-radial-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.progress-radial-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: #10b981;
}

.progress-radial-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.date-highlight {
  color: #38bdf8;
  font-size: 1.05rem;
}

/* Workbench Navigation Tabs */
.workbench-tabs {
  display: flex;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  overflow-x: auto;
}

.wb-tab {
  background: transparent;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.wb-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.wb-tab.active {
  color: var(--amber-primary);
  background: rgba(245, 158, 11, 0.1);
}

.wb-tab.active::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--amber-primary);
  border-radius: 3px 3px 0 0;
}

.wb-tab .badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
}

/* ========================================================
   8-STAGE SEMÁFORO BOARD
   ======================================================== */
.semaforos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.stage-card {
  padding: 1.5rem;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all var(--transition-fast);
}

.stage-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
}

.stage-card.is-done {
  border-left: 4px solid var(--status-done);
}

.stage-card.is-in-progress {
  border-left: 4px solid var(--status-progress);
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.05), var(--bg-card));
}

.stage-card.is-blocked {
  border-left: 4px solid var(--status-blocked);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), var(--bg-card));
}

.stage-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.stage-num-badge {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--amber-primary);
  background: rgba(245, 158, 11, 0.12);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 0.4rem;
}

.stage-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.stage-status-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.stage-status-pill.pending { background: var(--status-pending-bg); color: var(--status-pending); border: 1px solid rgba(148, 163, 184, 0.3); }
.stage-status-pill.in_progress { background: var(--status-progress-bg); color: #fde047; border: 1px solid rgba(250, 204, 21, 0.4); }
.stage-status-pill.partial_done { background: var(--status-partial-bg); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.stage-status-pill.done { background: var(--status-done-bg); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.stage-status-pill.blocked { background: var(--status-blocked-bg); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

.stage-card-body {
  margin-bottom: 1.25rem;
}

.stage-description {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.stage-note-box {
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--amber-primary);
  padding: 0.6rem 0.85rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.8rem;
  color: #e2e8f0;
}

.stage-note-label {
  font-size: 0.7rem;
  color: var(--amber-primary);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
  display: block;
}

.stage-card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn-update-stage {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-update-stage:hover {
  background: var(--amber-primary);
  color: #000;
  border-color: var(--amber-primary);
}

.btn-quick-done {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-quick-done:hover {
  background: var(--status-done);
  color: #fff;
}

/* ========================================================
   PLANOS & ADJUNTOS (BLUEPRINTS, PDF, IMAGES)
   ======================================================== */
.planos-header {
  margin-bottom: 1.5rem;
}

.planos-header h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
}

.planos-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.planos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.plano-card {
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.plano-card:hover {
  transform: translateY(-4px);
  border-color: var(--amber-primary);
  box-shadow: var(--shadow-md);
}

.plano-thumbnail-wrapper {
  height: 180px;
  background: rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.plano-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.plano-thumbnail-wrapper:hover .plano-thumbnail-img {
  transform: scale(1.05);
}

.plano-thumbnail-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: #f87171;
}

.pdf-icon-big {
  font-size: 3rem;
}

.plano-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.plano-thumbnail-wrapper:hover .plano-hover-overlay {
  opacity: 1;
}

.btn-view-preview {
  background: var(--amber-primary);
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.plano-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.plano-filename {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plano-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.plano-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn-action-view {
  flex: 1;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber-primary);
  padding: 0.45rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn-action-view:hover {
  background: var(--amber-primary);
  color: #000;
}

.btn-action-download {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-action-download:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

/* ========================================================
   MÓDULOS DE MUEBLES (TMT)
   ======================================================== */
.modulos-header {
  margin-bottom: 1.25rem;
}

.modulos-header h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
}

.modulos-table-container {
  overflow-x: auto;
  border-radius: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.35);
  padding: 0.9rem 1rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--amber-primary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.delta-badge {
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.35rem;
}

.delta-badge.positive {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.delta-badge.negative {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

/* ========================================================
   BITÁCORA & CHATTER
   ======================================================== */
.bitacora-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .bitacora-layout { grid-template-columns: 1fr; }
}

.bitacora-form {
  padding: 1.5rem;
  height: fit-content;
}

.bitacora-form h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.bitacora-timeline {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 700px;
  overflow-y: auto;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.timeline-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}

.timeline-author {
  font-weight: 700;
  color: #fff;
}

.timeline-date {
  color: var(--text-dim);
}

.timeline-body {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.timeline-body b {
  color: #fff;
}

/* ========================================================
   MODALS
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  border-radius: 18px;
  position: relative;
  animation: zoomIn 0.25s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.modal-subtitle {
  font-size: 0.75rem;
  color: var(--amber-primary);
  font-weight: 700;
  text-transform: uppercase;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

.btn-close-modal {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.btn-close-modal:hover {
  background: var(--rose-primary);
}

/* Status Selector Grid */
.status-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.status-option-label {
  cursor: pointer;
}

.status-option-label input {
  display: none;
}

.status-pill-btn {
  display: block;
  text-align: center;
  padding: 0.65rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.status-pill-btn.pending { background: rgba(148, 163, 184, 0.1); color: var(--status-pending); }
.status-pill-btn.in_progress { background: rgba(250, 204, 21, 0.1); color: var(--status-progress); }
.status-pill-btn.partial_done { background: rgba(56, 189, 248, 0.1); color: var(--status-partial); }
.status-pill-btn.done { background: rgba(16, 185, 129, 0.1); color: var(--status-done); }
.status-pill-btn.blocked { background: rgba(239, 68, 68, 0.1); color: var(--status-blocked); }

.status-option-label input:checked + .status-pill-btn {
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.status-option-label input:checked + .status-pill-btn.pending { background: var(--status-pending); color: #000; }
.status-option-label input:checked + .status-pill-btn.in_progress { background: var(--status-progress); color: #000; }
.status-option-label input:checked + .status-pill-btn.partial_done { background: var(--status-partial); color: #000; }
.status-option-label input:checked + .status-pill-btn.done { background: var(--status-done); color: #000; }
.status-option-label input:checked + .status-pill-btn.blocked { background: var(--status-blocked); color: #fff; }

/* Quick Tags */
.quick-tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.quick-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-tag:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--amber-primary);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
  display: block;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ========================================================
   LIGHTBOX / VISOR DE PLANOS
   ======================================================== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox-container {
  width: 95vw;
  height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}

.lightbox-header {
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lightbox-file-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lightbox-icon {
  font-size: 1.5rem;
}

.lightbox-filename {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.zoom-controls {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.15rem;
}

.btn-tool {
  background: none;
  border: none;
  color: #fff;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-tool.highlight {
  background: var(--amber-primary);
  color: #000;
  font-weight: 700;
  text-decoration: none;
}

.zoom-indicator {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--amber-primary);
  padding: 0 0.5rem;
}

.btn-close-lightbox {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
}

.btn-close-lightbox:hover {
  background: var(--rose-primary);
}

.lightbox-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #05070a;
}

.lightbox-img-viewer {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  transition: transform 0.15s ease-out;
  cursor: grab;
  user-select: none;
}

.lightbox-img-viewer:active {
  cursor: grabbing;
}

.lightbox-iframe-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

/* ========================================================
   TOAST NOTIFICATIONS
   ======================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 3000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  font-size: 0.875rem;
  animation: slideInRight 0.3s ease-out;
  min-width: 280px;
}

.toast.success { border-left: 4px solid var(--status-done); }
.toast.error { border-left: 4px solid var(--status-blocked); }
.toast.info { border-left: 4px solid var(--amber-primary); }

/* ========================================================
   ANIMATIONS
   ======================================================== */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--amber-primary);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .obras-grid { grid-template-columns: 1fr; }
  .app-header { flex-direction: column; gap: 1rem; align-items: stretch; }
  .header-nav { justify-content: center; overflow-x: auto; }
  .header-right { justify-content: space-between; }
  .toolbar-card { flex-direction: column; align-items: stretch; }
}
