/* ═══════════════════════════════════════════════════════
   RAKJO AIEcoSystem — Data Room
   Paleta azul RAKJO + dorado (consistente con Portal)
   ═══════════════════════════════════════════════════════ */

:root {
  --rakjo-blue:        #1a3a5c;
  --rakjo-blue-mid:    #2c5282;
  --rakjo-blue-light:  #3d72b8;
  --rakjo-accent:      #e8a020;
  --rakjo-accent-dark: #c8881a;

  --bg-page:           #f0f4f8;
  --bg-card:           #ffffff;

  --text-main:         #1a2840;
  --text-secondary:    #4a5568;
  --text-muted:        #718096;

  --border:            #d1dce8;
  --danger:            #c53030;
  --danger-bg:         #fff5f5;
  --success:           #276749;
  --success-bg:        #f0fff4;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 25px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);

  --radius:    10px;
  --radius-lg: 16px;
  --sidebar-w: 240px;
  --topbar-h:  62px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--rakjo-blue-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--rakjo-blue);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.logo-mark {
  width: 36px; height: 36px;
  background: var(--rakjo-accent);
  color: var(--rakjo-blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
}

.logo-text small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: .7;
  letter-spacing: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.78);
  font-size: 14px;
  text-decoration: none;
  transition: background .15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  font-weight: 600;
}

.nav-icon { font-size: 16px; width: 22px; text-align: center; }

.nav-section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.45);
  padding: 16px 12px 4px;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 12px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--rakjo-accent);
  color: var(--rakjo-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-info strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info small {
  display: block;
  font-size: 11px;
  opacity: .6;
}

.btn-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 6px;
}
.btn-logout:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ── Main content ──────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.main-topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-topbar h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-body {
  padding: 28px;
  flex: 1;
}

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 15px;
  font-weight: 700;
}

.card-body {
  padding: 20px 24px;
}

/* ── Stats grid ────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-icon { font-size: 26px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--rakjo-blue); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  line-height: 1.3;
}

.btn-primary {
  background: var(--rakjo-blue);
  color: #fff;
}
.btn-primary:hover { background: var(--rakjo-blue-light); text-decoration: none; }

.btn-accent {
  background: var(--rakjo-accent);
  color: var(--rakjo-blue);
}
.btn-accent:hover { background: var(--rakjo-accent-dark); text-decoration: none; }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { background: var(--bg-page); text-decoration: none; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: .85; }

.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }
.btn-help {
  width: 34px; height: 34px; padding: 0; justify-content: center;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.9); border-radius: 50%; font-size: 15px;
  font-weight: 700; cursor: pointer; transition: all .15s;
}
.btn-help:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn-help-dark {
  width: 34px; height: 34px; padding: 0; display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--bg-page); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: 50%; font-size: 15px;
  font-weight: 700; cursor: pointer; transition: all .15s;
}
.btn-help-dark:hover { background: var(--rakjo-blue); color: #fff; }

/* ── Tables ─────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: #f7f9fc;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f4f8;
  font-size: 13.5px;
  vertical-align: middle;
}

tbody tr:hover { background: #fafbfe; }

.td-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green { background: #c6f6d5; color: #22543d; }
.badge-red   { background: #fed7d7; color: #742a2a; }
.badge-blue  { background: #bee3f8; color: #1a365d; }
.badge-gray  { background: #edf2f7; color: #4a5568; }
.badge-amber { background: #fefcbf; color: #744210; }

/* ── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-main);
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text-main);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--rakjo-blue-light);
  box-shadow: 0 0 0 3px rgba(44,82,130,.12);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.form-check:hover { background: #fafbfe; }
.form-check input[type="checkbox"] { margin-top: 3px; accent-color: var(--rakjo-blue); }
.check-label { font-size: 13.5px; font-weight: 600; }
.check-hint { font-size: 11.5px; color: var(--text-muted); }

select.form-control { appearance: auto; }
textarea.form-control { min-height: 80px; resize: vertical; }

/* ── Progress bar ──────────────────────────────────── */
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: var(--rakjo-blue-light);
  border-radius: 4px;
  transition: width .3s;
}

.progress-fill.warning { background: var(--rakjo-accent); }
.progress-fill.danger  { background: var(--danger); }

/* ── Quota display ─────────────────────────────────── */
.quota-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ── Alert ──────────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert-error   { background: var(--danger-bg); color: var(--danger); border: 1px solid #feb2b2; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #9ae6b4; }
.alert-info    { background: #ebf8ff; color: #2b6cb0; border: 1px solid #90cdf4; }

/* ── Toast ──────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #fff;
  background: #2d3748;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease-out;
  max-width: 380px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .15s;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-box h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-box-lg {
  max-width: 700px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Help modal ────────────────────────────────────── */
.help-modal-content {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}
.help-modal-content h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--rakjo-blue);
  margin: 16px 0 8px;
}
.help-modal-content h4:first-child { margin-top: 0; }
.help-modal-content p {
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 8px;
  color: var(--text-secondary);
}
.help-modal-content ul {
  margin: 0 0 12px 18px;
  font-size: 13.5px;
  color: var(--text-secondary);
}
.help-modal-content li { margin-bottom: 4px; }

/* ── Auth pages ────────────────────────────────────── */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--rakjo-blue) 0%, #2c5282 100%);
}

.auth-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo .logo-circle {
  width: 56px; height: 56px;
  background: var(--rakjo-blue);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--rakjo-accent);
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 8px;
}

.auth-logo h2 {
  font-size: 18px;
  color: var(--rakjo-blue);
}

.auth-logo small {
  color: var(--text-muted);
  font-size: 12px;
}

.auth-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── File explorer ─────────────────────────────────── */
.explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  flex: 1;
  min-width: 200px;
}

.breadcrumb a {
  color: var(--rakjo-blue-light);
  font-weight: 500;
}

.breadcrumb .separator {
  color: var(--text-muted);
  margin: 0 2px;
}

.breadcrumb .current {
  color: var(--text-main);
  font-weight: 600;
}

.explorer-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.explorer-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f0f4f8;
  cursor: pointer;
  transition: background .1s;
}

.explorer-item:hover {
  background: #fafbfe;
}

.explorer-item:last-child {
  border-bottom: none;
}

.explorer-icon {
  font-size: 22px;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.explorer-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 12px;
}

.explorer-actions {
  display: flex;
  gap: 4px;
  margin-left: 8px;
  opacity: 0;
  transition: opacity .15s;
}

.explorer-item:hover .explorer-actions {
  opacity: 1;
}

.explorer-actions button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
}
.explorer-actions button:hover {
  background: var(--bg-page);
}
.explorer-actions button.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s;
  margin: 16px;
}

.drop-zone.drag-over {
  border-color: var(--rakjo-blue-light);
  background: rgba(44,82,130,.05);
  color: var(--rakjo-blue);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13.5px;
}

/* ── Data Room cards (admin list) ──────────────────── */
.dr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.dr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.dr-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.dr-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.dr-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.dr-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.dr-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dr-card-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dr-card-stats strong {
  color: var(--text-main);
}

/* ── Member list (admin detail) ────────────────────── */
.member-privileges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.priv-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
}

.priv-on  { background: #c6f6d5; color: #22543d; }
.priv-off { background: #edf2f7; color: #a0aec0; }

/* ── Email log ─────────────────────────────────────── */
.email-log {
  font-size: 12.5px;
}

.email-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f4f8;
}

.email-type {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
}
.email-type.invitation { background: #bee3f8; color: #1a365d; }
.email-type.credentials { background: #fefcbf; color: #744210; }
.email-type.notification { background: #c6f6d5; color: #22543d; }

/* ── Toggle ────────────────────────────────────────── */
.toggle {
  display: inline-block;
  width: 40px;
  height: 22px;
  background: #cbd5e0;
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}

.toggle.on { background: var(--rakjo-blue-light); }
.toggle.on::after { transform: translateX(18px); }

/* ── Spinner ───────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

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

/* ── Text utilities ────────────────────────────────── */
.text-sm    { font-size: 12.5px; }
.text-muted { color: var(--text-muted); }
.text-center{ text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }

/* Hamburger: oculto en escritorio */
.hide-desktop { display: none; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dr-grid { grid-template-columns: 1fr; }
  .page-body { padding: 16px; }
  .hide-desktop { display: block !important; }
}

/* ── Selector de idioma en sidebar footer ─────────── */
.sidebar-lang {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.sidebar-lang select {
  flex: 1;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
}
.sidebar-lang select option { background: var(--rakjo-blue, #1a3a5c); color: #fff; }
