* {
  box-sizing: border-box;
}

:root {
  --bg: #f7f1e9;
  --panel: #fffdf9;
  --white: #ffffff;
  --text: #28211d;
  --muted: #8d7e72;
  --border: #eadfce;
  --line: #eee7df;
  --accent: #c28a5c;
  --accent-dark: #8f6040;
  --danger: #b23b3b;
  --success: #2f7d3c;
  --warning: #9a6a18;
  --shadow: 0 18px 45px rgba(71,45,25,.06);
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f7f1e9;
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

/* LOGIN */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #fff7eb, #f7f1e9);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 46px 40px;
  text-align: center;
}

.login-card img {
  max-width: 100px;
  margin-bottom: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.login-card p {
  margin: 0 0 28px;
  color: var(--muted);
}

.login-card form {
  text-align: left;
}

/* FORMS */

label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
}

textarea {
  height: 90px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194,138,92,.14);
}

button,
.btn {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  padding: 12px 16px;
  cursor: pointer;
}

button:hover,
.btn:hover {
  background: var(--accent-dark);
}

.btn.ghost {
  background: #f4eae0;
  color: var(--accent-dark);
}

/* LAYOUT */

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 286px;
  background: #fffdf9;
  border-right: 1px solid var(--border);
  padding: 30px 22px;
  overflow-y: auto;
  z-index: 20;
}

.brand {
  text-align: center;
  margin-bottom: 30px;
}

.brand img {
  max-width: 205px;
}

.nav a {
  display: block;
  padding: 12px 14px;
  margin-bottom: 7px;
  border-radius: 12px;
  color: #4d423b;
  font-weight: 800;
}

.nav a:hover,
.nav a.active {
  background: #f1e4d7;
  color: var(--accent-dark);
}

.menu-title {
  margin: 24px 0 8px;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #a89688;
}

.sidebar-user {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar,
.mini-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f1dfcf;
  color: #9a6846;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
}

.sidebar-user small {
  color: var(--muted);
}

.topbar {
  margin-left: 286px;
  padding: 26px 34px 0;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.main {
  margin-left: 286px;
  min-height: calc(100vh - 92px);
  padding: 26px 34px 54px;
  display: flex;
  justify-content: center;
}

.page-wide,
.project-page,
.dashboard-page,
.portal-page {
  width: 100%;
  max-width: 1160px;
}

.page-narrow {
  width: 100%;
  max-width: 860px;
}

/* CARDS */

.soft-card,
.dashboard-card,
.dashboard-section,
.project-hero,
.dashboard-hero {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 22px;
}

.project-hero,
.dashboard-hero,
.hero-card {
  background: linear-gradient(135deg, #fff, #fbf4ec);
}

.project-hero h1,
.dashboard-hero h1,
.hero-card h2 {
  margin: 0;
  font-size: 36px;
  letter-spacing: -.03em;
}

.project-hero p,
.dashboard-hero p,
.hero-card p {
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0;
  font-size: 25px;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

/* ALERTS */

.alert {
  padding: 13px 15px;
  border-radius: 12px;
  margin: 0 0 18px;
  font-weight: 800;
  background: #fff0ee;
  color: var(--danger);
  border: 1px solid #f2c9c5;
}

.alert.success {
  background: #edf8ef;
  color: var(--success);
  border-color: #cde9d3;
}

/* FORM GRIDS */

.clean-form label {
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-form {
  margin-top: 16px;
}

.project-form input,
.project-form textarea,
.project-form select {
  margin-bottom: 12px;
}

/* TOP ACTION BUTTONS */

.project-actions-card {
  display: flex;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.project-actions-card > details {
  flex: 1;
  position: relative;
}

.project-actions-card > details > summary {
  list-style: none;
  width: 100%;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 13px 16px;
  font-weight: 900;
  cursor: pointer;
}

.project-actions-card > details > summary::-webkit-details-marker {
  display: none;
}

.project-actions-card > details[open] > summary {
  background: var(--accent-dark);
}

.project-actions-card > details > form {
  position: absolute;
  top: 58px;
  left: 0;
  right: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.14);
}

/* VISUAL PROJECT BOARD */

.ethereal-board {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: transparent;
  border: 0;
  overflow: visible;
}

/* Hide old table header and technical rows */
.board-head,
.okr-row,
.kpi-row {
  display: none !important;
}

/* OKR group */

.okr-group {
  background: #fff;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(0,0,0,.05);
}

.okr-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 24px 28px;
  background: linear-gradient(135deg, #f7d7b8, #fff1e4);
  display: flex;
  align-items: center;
  gap: 16px;
}

.okr-group > summary::-webkit-details-marker {
  display: none;
}

.okr-group > summary strong {
  font-size: 26px;
  color: #2f241d;
}

.okr-group > summary small {
  display: block;
  margin-top: 6px;
  color: #7f6d61;
  font-size: 13px;
}

.group-caret {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(255,255,255,.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #8f6040;
  font-weight: 900;
}

/* KPI group */

.kpi-group {
  display: block;
  margin: 18px;
  background: #fffdfb;
  border: 1px solid #efe4da;
  border-radius: 22px;
  overflow: hidden;
}

.kpi-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #faf6f2;
  border-bottom: 1px solid #efe4da;
}

.kpi-group > summary::-webkit-details-marker {
  display: none;
}

.kpi-group > summary strong {
  font-size: 18px;
  color: #3b3029;
}

.kpi-group > summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* Tasks as horizontal visual cards */

.task-row-table,
.my-task-row {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 14px 18px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: .2s ease;
}

.task-row-table:hover,
.my-task-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
}

.task-row-table > div,
.my-task-row > div {
  border: 0 !important;
  padding: 0 !important;
  min-width: auto !important;
  display: flex;
  align-items: center;
}

.task-row-table > div:first-child,
.my-task-row > div:first-child {
  width: 32px;
  min-width: 32px !important;
  height: 32px;
  border-radius: 10px;
  background: #f7f1eb;
  color: var(--accent-dark);
  justify-content: center;
  font-weight: 900;
}

.task-row-table > div:nth-child(2),
.my-task-row > div:nth-child(2) {
  flex: 1;
  min-width: 180px !important;
}

.task-row-table strong,
.my-task-row strong {
  font-size: 15px;
  color: #2d2622;
}

.task-row-table > div:nth-child(3),
.my-task-row > div:nth-child(3) {
  min-width: 140px !important;
  color: var(--muted);
  font-size: 13px;
}

.task-row-table > div:nth-child(4),
.my-task-row > div:nth-child(4) {
  min-width: 120px !important;
  color: #6f6258;
  font-weight: 700;
  font-size: 13px;
}

/* Pills */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  height: 34px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: capitalize;
  border: 0;
}

.importance-baja {
  background: #e8f7ea;
  color: var(--success);
}

.importance-media {
  background: #fff4d9;
  color: var(--warning);
}

.importance-alta {
  background: #ffe9db;
  color: #b45c2f;
}

.importance-urgente {
  background: #ffe1e1;
  color: var(--danger);
}

/* Status */

.status-form-table {
  margin: 0;
}

.status-form-table select {
  height: 34px;
  min-width: 120px;
  width: auto;
  border-radius: 10px;
  border: 0;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.status-pendiente {
  background: #ffe1e1;
  color: var(--danger);
}

.status-en_proceso {
  background: #fff4d9;
  color: var(--warning);
}

.status-completada {
  background: #e8f7ea;
  color: var(--success);
}

/* Actions */

.board-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-actions details {
  position: relative;
}

.board-actions summary,
.mini-danger,
.mini-link {
  list-style: none;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
}

.board-actions summary {
  background: #f2e7dc;
  color: var(--accent-dark);
}

.board-actions summary::-webkit-details-marker {
  display: none;
}

.board-actions form {
  margin: 0;
}

.mini-danger {
  background: #ffe2e2 !important;
  color: var(--danger) !important;
}

.mini-link {
  background: #f7f1eb;
  color: var(--accent-dark);
}

/* Edit dropdown */

.mini-edit {
  position: absolute;
  right: 0;
  top: 42px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  z-index: 90;
}

.mini-edit input,
.mini-edit select,
.mini-edit textarea {
  margin-bottom: 10px;
}

.mini-edit button {
  width: 100%;
}

/* DASHBOARD */

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.dashboard-card {
  padding: 22px;
}

.dashboard-card span {
  display: block;
  color: var(--muted);
  font-weight: 900;
}

.dashboard-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 36px;
}

.dashboard-card small {
  color: var(--muted);
}

.project-progress {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.project-progress-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: #f0e7df;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar div,
.progress-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* TEAM */

.people-list {
  display: grid;
  gap: 10px;
}

.person-row,
.team-edit-row {
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.person-main strong,
.person-main small,
.person-row strong,
.person-row small {
  display: block;
}

.person-row small,
.person-main small {
  color: var(--muted);
  margin-top: 3px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #f4e9de;
  color: #8a6246;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 11px;
  text-transform: capitalize;
}

.team-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.team-actions details {
  position: relative;
}

.team-actions summary {
  list-style: none;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f7f1eb;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.team-actions summary::-webkit-details-marker {
  display: none;
}

.team-mini-form {
  position: absolute;
  right: 0;
  top: 36px;
  z-index: 80;
  width: 300px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 22px 60px rgba(0,0,0,.15);
}

.team-mini-form input,
.team-mini-form select {
  height: 38px;
  margin-bottom: 10px;
  font-size: 13px;
}

/* EMPTY */

.portal-empty,
.empty-state,
.empty-dashboard {
  padding: 20px;
  border-radius: 16px;
  background: #fbf6ef;
  color: var(--muted);
  font-weight: 700;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
  .dashboard-metrics {
    grid-template-columns: 1fr;
  }

  .project-actions-card {
    flex-direction: column;
  }

  .project-actions-card > details > form {
    position: static;
    margin-top: 12px;
  }
}

@media (max-width: 900px) {
  .task-row-table,
  .my-task-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-row-table > div,
  .my-task-row > div {
    width: 100%;
  }

  .mini-edit {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 360px);
  }
}

@media (max-width: 860px) {
  .sidebar {
    position: relative;
    width: 100%;
    inset: auto;
  }

  .topbar,
  .main {
    margin-left: 0;
  }

  .main {
    padding: 20px 14px 40px;
  }

  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .soft-card,
  .dashboard-card,
  .dashboard-section,
  .project-hero,
  .dashboard-hero {
    border-radius: 18px;
    padding: 22px;
  }

  .person-row,
  .team-edit-row {
    grid-template-columns: 44px 1fr;
  }

  .team-actions {
    grid-column: 2;
  }

  .team-mini-form {
    position: static;
    width: 100%;
    margin-top: 10px;
  }
}