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

:root {
  --bg: #F7F8FA;
  --surface: #fff;
  --surface2: #F0F2F6;
  --border: #E2E6ED;
  --border2: #C8CDD8;
  --text: #1A1D23;
  --text2: #4B5263;
  --text3: #8892A0;
  --accent: #0C6E87;
  --accent-light: #E0F4F8;
  --accent-hover: #0A5C72;
  --brand: #0C6E87;
  --brand-dim: #E0F4F8;
  --brand-hover: #0A5C72;
  --green: #0A8A4E;
  --green-bg: #E6F5EE;
  --amber: #9A6000;
  --amber-bg: #FFF3DC;
  --red: #B91C1C;
  --red-bg: #FEE2E2;
  --muted: #4B5263;
  --sb: 248px;
  --topbar: 56px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1217;
  --surface: #181C24;
  --surface2: #1E2330;
  --border: #2A2F3D;
  --border2: #3A4050;
  --text: #E8EAF0;
  --text2: #9AA3B4;
  --text3: #5C6478;
  --accent: #22D3EE;
  --accent-light: #0C2A30;
  --accent-hover: #38E0FB;
  --brand: #22D3EE;
  --brand-dim: #0C2A30;
  --brand-hover: #38E0FB;
  --green: #34D399;
  --green-bg: #052E1C;
  --amber: #FBBF24;
  --amber-bg: #1C1500;
  --red: #F87171;
  --red-bg: #2D0A0A;
  --muted: #9AA3B4;
}

html { font-size: 14px; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-family: 'Syne', sans-serif; font-weight: 700; }
.hidden { display: none !important; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text3); }

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { border-color: var(--border2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-secondary, .btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--red-bg); border-color: transparent; color: var(--red); font-weight: 600; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 15px; }
.card-body { padding: 18px; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text3); margin-bottom: 4px; }
.form-input, .auth-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.form-input:focus, .auth-field input:focus { border-color: var(--accent); }

.alert { padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-top: 10px; }
.alert-ok { background: var(--green-bg); color: var(--green); }
.alert-err { background: var(--red-bg); color: var(--red); }
.alert-info { background: var(--accent-light); color: var(--accent); }

.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px;
  flex-shrink: 0;
}

/* Install */
.install-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.install-shell { width: 100%; max-width: 520px; }
.install-brand { text-align: center; margin-bottom: 1.5rem; }
.install-brand .brand-mark { margin: 0 auto 12px; width: 52px; height: 40px; }
.install-brand h1 { font-size: 22px; }
.install-brand p { color: var(--text3); font-size: 13px; margin-top: 4px; }
.install-version {
  display: inline-block; margin-top: 10px; padding: 3px 10px; border-radius: 20px;
  background: var(--accent-light); color: var(--accent); font-size: 12px; font-weight: 600;
}
.install-note { margin-top: 12px; font-size: 13px; }
.step-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 1.25rem; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.step-dot.active { background: var(--accent); }
.step-dot.done { background: var(--green); }
.req-list { list-style: none; margin: 12px 0 0; }
.req-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.req-ok { color: var(--green); font-weight: 600; }
.req-fail { color: var(--red); font-weight: 600; }
.install-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 1.25rem; }
.install-option { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin: 12px 0; cursor: pointer; }

/* Auth */
.auth-body { min-height: 100vh; display: flex; }
.auth-screen { width: 100%; }
.auth-screen__shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-screen__hero {
  background: var(--accent); color: #fff; padding: 32px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-screen__hero-logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.auth-screen__hero-copy { font-size: 28px; font-family: 'Syne', sans-serif; font-weight: 700; max-width: 360px; line-height: 1.25; }
.auth-screen__copy { opacity: .8; font-size: 13px; }
.auth-screen__panel { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-screen__panel-inner { width: 100%; max-width: 380px; }
.auth-screen__title { font-size: 24px; margin-bottom: 6px; }
.auth-screen__lead { color: var(--text3); margin-bottom: 18px; }
.auth-screen__form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { position: relative; }
.auth-field__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.auth-field--password { position: relative; }
.auth-field__toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; cursor: pointer; color: var(--text3); font-size: 14px;
}
.auth-screen__submit {
  margin-top: 6px; width: 100%; padding: 12px; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
}
.auth-screen__submit:disabled { opacity: .55; }
.auth-screen__form-error, .auth-screen__form-success { padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 10px; }
.auth-screen__form-error { background: var(--red-bg); color: var(--red); }
.auth-screen__form-success { background: var(--green-bg); color: var(--green); }
.auth-build { text-align: center; margin-top: 18px; color: var(--text3); font-size: 12px; }

@media (max-width: 800px) {
  .auth-screen__shell { grid-template-columns: 1fr; }
  .auth-screen__hero { min-height: 180px; }
}

/* App shell */
.app-shell { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar {
  width: var(--sb); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
}
.app-shell--collapsed .sidebar { width: 76px; }
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 16px; color: var(--text); font-family: 'Syne', sans-serif; font-weight: 800;
}
.sidebar-brand-name { font-size: 16px; letter-spacing: -.4px; }
.app-shell--collapsed .sidebar-brand-name,
.app-shell--collapsed .nav-label,
.app-shell--collapsed .sidebar-user-meta { display: none; }
.app-shell--collapsed .sidebar-user { flex-direction: column; margin-bottom: 0; }
.app-shell--collapsed .sidebar-collapse { align-self: center; margin-left: 0; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; color: var(--text2); font-weight: 500;
}
.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--accent-light); color: var(--accent); }
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; }
.nav-icon svg { width: 18px; height: 18px; }
.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-meta { flex: 1; min-width: 0; }
.sidebar-user-name {
  display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-role { display: block; font-size: 11px; color: var(--text3); }
.sidebar-logout {
  flex: 0 0 auto; width: 32px; height: 32px; margin: 0; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--text3);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-logout:hover, .sidebar-logout:focus-visible {
  background: var(--accent-light); color: var(--accent);
}
.sidebar-logout svg { width: 18px; height: 18px; display: block; }
.sidebar-collapse {
  appearance: none; width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text3); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  align-self: flex-start; margin: 4px 0 6px 4px;
}
.sidebar-collapse:hover { background: var(--accent-light); color: var(--accent); }
.app-stage { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar); display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); gap: 16px;
}
.top-progress {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px; pointer-events: none; z-index: 40;
  overflow: hidden;
}
.auth-body > .top-progress { position: fixed; }
.top-progress-bar {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  opacity: 1;
  transition: width .28s ease-out, opacity .22s ease-out;
}
.top-progress.is-done .top-progress-bar { opacity: 0; }
.topbar h1 { font-size: 15px; color: var(--text2); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.main { flex: 1; min-width: 0; }
.content { min-height: calc(100vh - var(--topbar)); }
.theme-toggle { display: flex; gap: 4px; background: var(--surface2); padding: 3px; border-radius: 8px; }
.theme-btn {
  border: 0; background: transparent; color: var(--text3); font-size: 11px; font-weight: 600;
  padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.theme-btn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* Updates */
.import-steps { display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; }
.import-step {
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--surface2); color: var(--text3);
}
.import-step.active { background: var(--accent-light); color: var(--accent); }
.import-step.done { background: var(--green-bg); color: var(--green); }
.dropzone {
  border: 1.5px dashed var(--border2); border-radius: 8px; padding: 28px 16px;
  text-align: center; cursor: pointer; color: var(--text2);
}
.dropzone.dragover { border-color: var(--accent); background: var(--accent-light); }
.dropzone-icon { font-size: 22px; margin-bottom: 6px; }
.update-progress { display: none; margin-top: 12px; }
.update-progress.visible { display: block; }
.update-progress-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.update-progress-track { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.update-progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.update-progress-bar.indeterminate { width: 40%; animation: progress-slide 1.1s ease-in-out infinite; }
@keyframes progress-slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.package-pick {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px;
  border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; cursor: pointer;
}
.package-pick.invalid { opacity: .7; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none;
  align-items: center; justify-content: center; z-index: 80; padding: 20px;
}
.modal-overlay.visible { display: flex; }
.modal-card {
  background: var(--surface); border-radius: 10px; padding: 24px; max-width: 420px;
  width: 100%; box-shadow: var(--shadow); text-align: center;
}
.update-done-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--green-bg); color: var(--green);
  display: grid; place-items: center; margin: 0 auto 12px; font-size: 22px; font-weight: 700;
}
.modal-version { margin: 10px 0; font-family: 'Fira Code', monospace; color: var(--accent); font-weight: 600; }
.modal-actions { margin-top: 16px; }

.updates-page { padding: 24px; }

.app-shell:has(.accesos-page) {
  height: 100vh;
  overflow: hidden;
}
.app-shell:has(.accesos-page) .main {
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.content.accesos-page {
  min-height: 0;
  flex: 1;
  padding: 0;
  display: flex;
  overflow: hidden;
}
.accesos-frame {
  display: block;
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #eef2f7;
}



/* Equipo */
.equipo-page { padding: 24px 24px 48px; }
.team-screen {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1100px;
}
.team-screen__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.team-screen__head h2 { font-size: 22px; }
.team-screen__head p { margin-top: 6px; color: var(--text3); font-size: 13px; max-width: 46ch; }
.team-block {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 20px 28px;
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.team-block__intro h3 {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
.team-block__intro p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text3); }
.team-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.team-table { width: 100%; border-collapse: collapse; }
.team-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
  color: var(--text3);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.team-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.team-table tbody tr:last-child td { border-bottom: none; }
.team-table tbody tr:hover td { background: var(--accent-light); }
.team-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.team-person strong { display: block; font-size: 14px; font-weight: 650; }
.team-person em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--text3);
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: var(--accent);
}
.team-active { display: inline-flex; align-items: center; gap: 7px; color: var(--text3); white-space: nowrap; }
.team-active i { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); }
.team-active.is-online { color: var(--text); }
.team-active.is-online i { background: var(--green); }
.team-row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.team-icon-btn {
  appearance: none; width: 34px; height: 34px; border: none; border-radius: 8px;
  background: transparent; color: var(--text3); display: grid; place-items: center; cursor: pointer;
}
.team-icon-btn:hover { background: var(--accent-light); color: var(--accent); }
.team-icon-btn.is-danger:hover { background: var(--red-bg); color: var(--red); }
.team-empty { text-align: center; color: var(--text3); padding: 28px 16px !important; }
.team-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.4);
  display: grid; place-items: center; padding: 20px;
}
.team-modal {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--text);
}
.team-modal--sm { width: min(380px, 100%); }
.team-modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.team-modal__head h3 { margin: 0; font-size: 16px; }
.team-modal__body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.team-modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 18px; border-top: 1px solid var(--border);
}
.team-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 650; color: var(--text3); }
.team-field input, .team-field select {
  height: 40px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); padding: 0 12px;
  font: inherit; font-size: 14px; font-weight: 500;
}
.team-field input:focus, .team-field select:focus { outline: none; border-color: var(--accent); }
.team-error { margin: 0; color: var(--red); font-size: 13px; font-weight: 600; }
.team-confirm-copy { margin: 0; color: var(--text2); font-size: 14px; line-height: 1.45; }
.team-toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  padding: 12px 16px; border-radius: 10px;
  background: var(--text); color: var(--surface);
  font-size: 13px; font-weight: 650; box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .team-block { grid-template-columns: 1fr; gap: 12px; }
  .team-table-wrap { overflow-x: auto; }
  .team-table { min-width: 560px; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-shell--collapsed .sidebar { display: none; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar h1 { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
