:root {
  --app-sidebar-width: 250px;
  --app-blue: #1a73e8;
  --app-blue-soft: #e8f0fe;
  --app-text: #202124;
  --app-muted: #5f6368;
  --app-border: #e8eaed;
  --app-bg: #ffffff;
  --app-sidebar-bg: #f8f9fa;
  --action-sync: #5f6368;
  --action-projects: #1e8e3e;
  --action-tracking: #12b5cb;
  --action-clients: #f9ab00;
  --action-members: #1a73e8;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
}

html {
  font-size: 15px;
  height: 100%;
}

body.app-shell {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--app-text);
  background: var(--app-bg);
  display: flex;
}

/* ——— Sidebar ——— */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--app-sidebar-width);
  background: var(--app-sidebar-bg);
  border-right: 1px solid var(--app-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--app-border);
}

.sidebar-brand a {
  text-decoration: none;
  color: var(--app-text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.brand-org { color: var(--app-muted); }
.brand-sep { margin: 0 0.35rem; color: #9aa0a6; }
.brand-app { color: var(--app-blue); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-link,
.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  color: var(--app-muted);
  text-decoration: none;
  font-weight: 500;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 0.95rem;
}

.sidebar-link:hover,
.sidebar-sublink:hover {
  background: #eef1f4;
  color: var(--app-text);
}

.sidebar-link.active {
  background: var(--app-blue-soft);
  color: var(--app-blue);
}

.sidebar-link i:first-child {
  font-size: 1.1rem;
  width: 1.25rem;
  text-align: center;
}

.sidebar-toggle .sidebar-chevron {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.7;
}

.sidebar-sublink {
  padding-left: 2.75rem;
  font-size: 0.9rem;
}

.sidebar-sublink.sidebar-toggle {
  justify-content: flex-start;
}

.sidebar-sublink.sidebar-toggle .sidebar-chevron {
  margin-left: auto;
}

.sidebar-sublink-nested {
  padding-left: 3.5rem;
  font-size: 0.88rem;
}

.sidebar-sublink.active {
  color: var(--app-blue);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 1.15rem 1.25rem;
  border-top: 1px solid var(--app-border);
}

.sidebar-user {
  font-size: 0.82rem;
  color: var(--app-muted);
  word-break: break-all;
  margin-bottom: 0.5rem;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 0;
  background: transparent;
  color: var(--app-muted);
  font-size: 0.9rem;
  font-family: inherit;
  padding: 0;
  text-decoration: none;
  cursor: pointer;
}

.sidebar-logout:hover {
  color: var(--app-blue);
}

/* ——— Main ——— */
.app-main {
  margin-left: var(--app-sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.75rem;
  border-bottom: 1px solid var(--app-border);
  background: #fff;
  min-height: 56px;
}

.topbar-title {
  color: var(--app-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.sidebar-open-btn {
  margin-right: auto;
  border: 1px solid var(--app-border);
  background: #fff;
  border-radius: 0.4rem;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--app-text);
}

.app-content {
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
  max-width: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  overflow-x: hidden; /* tablas anchas hacen scroll dentro de DataTables, no fuera del panel */
}

.app-content > .card,
.app-content > .row {
  max-width: 100%;
  min-width: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(32, 33, 36, 0.35);
  z-index: 1035;
}

.sidebar-backdrop.show {
  display: block;
}

/* ——— Portal Home ——— */
.portal-home {
  max-width: 980px;
  margin: 0 auto;
}

.portal-hero {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.portal-title {
  font-size: clamp(1.85rem, 3.5vw, 2.45rem);
  font-weight: 700;
  color: var(--app-blue);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.portal-title span {
  font-weight: 700;
}

.portal-lead {
  color: var(--app-muted);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 720px;
  margin: 0 auto 1.75rem;
}

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2.25rem;
}

.portal-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.portal-action:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(32, 33, 36, 0.12);
}

.portal-action-sync { background: var(--action-sync); }
.portal-action-projects { background: var(--action-projects); }
.portal-action-tracking { background: var(--action-tracking); }
.portal-action-clients { background: var(--action-clients); color: #3c4043; }
.portal-action-clients:hover { color: #3c4043; }
.portal-action-members {
  background: #fff;
  color: var(--action-members);
  border-color: var(--action-members);
}
.portal-action-members:hover { color: var(--action-members); }

.portal-about {
  background: #f8f9fa;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  padding: 1.35rem 1.5rem 1.25rem;
  margin-bottom: 2.5rem;
}

.portal-about-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--app-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.portal-about-title i {
  color: var(--app-blue);
}

.portal-about-body {
  color: var(--app-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.portal-about-body p {
  margin-bottom: 0.85rem;
}

.portal-modules-title {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.15rem;
  color: var(--app-text);
}

.portal-modules-title i {
  color: var(--app-muted);
}

.portal-module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.portal-module {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  padding: 1.15rem 1rem 1.25rem;
  border-top: 3px solid var(--app-border);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.portal-module:hover {
  color: inherit;
  box-shadow: 0 6px 18px rgba(32, 33, 36, 0.08);
  transform: translateY(-2px);
}

.portal-module-projects { border-top-color: var(--action-projects); }
.portal-module-tracking { border-top-color: var(--action-tracking); }
.portal-module-clients { border-top-color: var(--action-clients); }
.portal-module-members { border-top-color: var(--action-members); }

.portal-module-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.portal-module-projects .portal-module-icon { background: #e6f4ea; color: var(--action-projects); }
.portal-module-tracking .portal-module-icon { background: #e4f7fa; color: var(--action-tracking); }
.portal-module-clients .portal-module-icon { background: #fef7e0; color: #b06000; }
.portal-module-members .portal-module-icon { background: var(--app-blue-soft); color: var(--action-members); }

.portal-module h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.portal-module p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--app-muted);
  line-height: 1.4;
}

/* Forms / focus */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(26, 115, 232, 0.35);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ——— Alta rápida de proyectos ——— */
.quick-create {
  max-width: 720px;
  margin: 0 auto;
}

.quick-create-header {
  margin-bottom: 1.75rem;
}

.quick-create-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--app-blue);
  margin-bottom: 0.5rem;
}

.quick-create-lead {
  color: var(--app-muted);
  margin: 0;
  line-height: 1.5;
}

.quick-create-form {
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  padding: 1.5rem 1.5rem 1.25rem;
}

.quick-create-field {
  margin-bottom: 1.25rem;
}

.quick-create-field .form-label {
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.required-mark {
  color: #d93025;
  font-weight: 700;
}

.quick-create-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--app-border);
}

.quick-create-submit {
  min-width: 200px;
  font-weight: 600;
}

.quick-create-success {
  text-align: center;
  background: #e6f4ea;
  border: 1px solid #ceead6;
  border-radius: 0.75rem;
  padding: 2rem 1.5rem;
}

.quick-create-success-icon {
  font-size: 2.5rem;
  color: var(--action-projects);
  margin-bottom: 0.5rem;
}

.quick-create-success h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.quick-create-success-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

/* Responsive */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .portal-module-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575.98px) {
  .app-content {
    padding: 1.25rem 1rem 2rem;
  }

  .portal-module-grid {
    grid-template-columns: 1fr;
  }

  .portal-action {
    width: 100%;
    justify-content: center;
  }
}
