:root {
  --bg: #0f1923;
  --surface: #1a2533;
  --surface2: #243044;
  --border: #2e3f55;
  --accent: #e8a020;
  --accent-dark: #c4861a;
  --text: #eef2f7;
  --text-muted: #7a90a8;
  --danger: #e05050;
  --success: #3dba7a;
  --radius: 12px;
  --radius-sm: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }

.trabajador-marcado {
  background: color-mix(in srgb, var(--accent) 25%, var(--surface2)) !important;
  border-color: var(--accent) !important;
  font-weight: 600;
}
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }

.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* LOGIN */
#screen-login { align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg,#0f1923,#1a2533); }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 28px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon { width: 68px; height: 68px; background: var(--accent); border-radius: 18px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 30px; }
.login-logo h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* INPUTS */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text); font-size: 15px; outline: none; transition: border-color 0.2s; -webkit-appearance: none; font-family: inherit; }
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field select option { background: var(--surface2); }

/* BOTONES */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: all 0.15s; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--accent); color: #0f1923; width: 100%; padding: 14px; font-size: 15px; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-icon { padding: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; font-size: 16px; }
.btn-icon:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* TOPBAR */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 16px; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand .brand-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; color: #0f1923; font-weight: 800; }
.topbar-brand span { font-weight: 800; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px 5px 6px; font-size: 13px; font-weight: 600; }
.user-chip .avatar { width: 24px; height: 24px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #0f1923; }

/* ROL BADGES */
.rol-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.rol-admin { background: #2d1f00; color: var(--accent); border: 1px solid var(--accent-dark); }
.rol-usuario { background: #1a2d3d; color: #5ab4e8; border: 1px solid #2a4d6d; }

/* NAV TABS */
.nav-tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab { flex: 1; min-width: 70px; padding: 11px 6px; text-align: center; font-size: 10px; font-weight: 700; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
.nav-tab .tab-icon { font-size: 19px; display: block; margin-bottom: 2px; }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-tab:hover:not(.active) { color: var(--text); }

/* CONTENT */
.content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 32px; }

/* SECTION */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 18px; font-weight: 800; }
.section-title small { display: block; font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

/* WELCOME BANNER */
.welcome-banner { background: linear-gradient(135deg,#1a2533,#243044); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; position: relative; overflow: hidden; }
.welcome-banner::before { content:''; position:absolute; top:-20px; right:-20px; width:100px; height:100px; background:var(--accent); opacity:0.07; border-radius:50%; }
.welcome-banner h2 { font-size: 18px; font-weight: 800; }
.welcome-banner p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ACCION BUTTONS (usuario home) */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.action-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 16px; text-align: center; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.action-card:hover, .action-card:active { border-color: var(--accent); background: var(--surface2); transform: translateY(-1px); }
.action-card .action-icon { font-size: 36px; }
.action-card .action-label { font-size: 13px; font-weight: 700; color: var(--text); }
.action-card .action-sub { font-size: 11px; color: var(--text-muted); }
.action-card.primary { border-color: var(--accent); background: rgba(232,160,32,0.07); }
.action-card.primary .action-label { color: var(--accent); }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .value { font-size: 30px; font-weight: 900; color: var(--accent); line-height: 1; }
.stat-card .label { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }

/* PARTE CARDS */
.parte-list { display: flex; flex-direction: column; gap: 10px; }
.parte-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.parte-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.parte-card-header .obra { font-weight: 700; font-size: 15px; }
.parte-card-header .fecha { font-size: 12px; color: var(--text-muted); }
.parte-card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chip { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.meta-chip span { color: var(--text); }
.parte-card-autor { font-size: 11px; color: var(--text-muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* USUARIO CARDS */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.user-card .user-avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; flex-shrink: 0; }
.user-avatar.admin { background: #2d1f00; color: var(--accent); }
.user-avatar.usuario { background: #1a2d3d; color: #5ab4e8; }
.user-info { flex: 1; min-width: 0; }
.user-info .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .username { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.user-actions { display: flex; gap: 6px; flex-shrink: 0; }
.inactive-badge { font-size: 10px; color: var(--danger); font-weight: 700; background: rgba(224,80,80,0.1); border-radius: 4px; padding: 1px 6px; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 200; display: none; align-items: flex-end; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; padding: 24px; animation: slideUp 0.25s ease; }
@keyframes slideUp { from{transform:translateY(40px);opacity:0} to{transform:translateY(0);opacity:1} }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 800; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; line-height: 1; padding: 0; }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: calc(100% - 32px); max-width: 400px; }
.toast { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 10px; animation: toastIn 0.25s ease; border-left: 3px solid var(--border); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent); }
@keyframes toastIn { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

/* FORM */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* PERFIL */
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center; margin-bottom: 16px; }
.profile-avatar { width: 76px; height: 76px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 900; color: #0f1923; margin: 0 auto 14px; }
.profile-name { font-size: 20px; font-weight: 800; }
.profile-username { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* CONFIG */
.config-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 12px; }
.config-section h3 { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }

/* MISC */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.error-msg { background: rgba(224,80,80,0.1); border: 1px solid rgba(224,80,80,0.3); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-top: 10px; display: none; }
.error-msg.visible { display: block; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
.info-box { background: rgba(232,160,32,0.08); border: 1px solid rgba(232,160,32,0.2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }
