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

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #131b2e;
  --text-secondary: #67718a;
  --border: #e3e8f2;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --accent-soft: #e8effd;
  --gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --success: #059669;
  --success-soft: #d8f3e7;
  --warning: #d97706;
  --warning-soft: #fdeed3;
  --danger: #e11d48;
  --danger-soft: #fde4ea;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(13,26,60,.04), 0 4px 16px rgba(13,26,60,.05);
  --shadow-lg: 0 8px 40px rgba(13,26,60,.14);
  --tabbar-h: calc(62px + env(safe-area-inset-bottom));
}

:root[data-theme="dark"] {
  --bg: #0d1220;
  --surface: #161d30;
  --text: #edf1fa;
  --text-secondary: #93a0bd;
  --border: #273149;
  --accent: #60a5fa;
  --accent-2: #a78bfa;
  --accent-soft: rgba(96,165,250,.14);
  --success: #34d399;
  --success-soft: rgba(16,185,129,.16);
  --warning: #fbbf24;
  --warning-soft: rgba(217,119,6,.16);
  --danger: #fb7185;
  --danger-soft: rgba(225,29,72,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.5);
}

html { -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background .25s, color .25s;
}

* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

a { color: var(--accent); }

/* ═══ Auth & Onboarding ═══ */
.auth-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(60% 50% at 15% 10%, rgba(37,99,235,.14), transparent),
    radial-gradient(50% 40% at 90% 90%, rgba(124,58,237,.12), transparent),
    var(--bg);
}

.auth-card {
  background: var(--surface);
  padding: 40px 32px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

@media (max-width: 640px) {
  .auth-container { padding: 0; align-items: stretch; }
  .auth-card {
    max-width: none; width: 100%;
    min-height: 100vh; min-height: 100dvh;
    border-radius: 0; box-shadow: none;
    display: flex; flex-direction: column; justify-content: center;
    padding: 32px 28px;
    padding-top: max(32px, env(safe-area-inset-top));
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }
}

.auth-logo {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.6rem;
  box-shadow: 0 8px 24px rgba(37,99,235,.35);
}

.brand {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle { color: var(--text-secondary); font-size: .9rem; margin-bottom: 28px; }

.auth-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; }

.input-icon { position: relative; }
.input-icon i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-secondary); font-size: .9rem; pointer-events: none;
}
.input-icon input { padding-left: 40px; }

.toggle-auth { margin-top: 20px; font-size: .85rem; color: var(--text-secondary); }
.toggle-auth a { color: var(--accent); text-decoration: none; font-weight: 600; cursor: pointer; }

.onboarding-options { display: flex; flex-direction: column; gap: 12px; }

.option-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--surface);
  color: var(--text);
  cursor: pointer; text-align: left; font-family: inherit;
  transition: border-color .2s, transform .15s;
}
.option-card:hover, .option-card:active { border-color: var(--accent); transform: translateY(-1px); }
.option-card i { font-size: 1.4rem; color: var(--accent); margin-bottom: 4px; }
.option-card strong { font-size: 1rem; }
.option-card span { font-size: .82rem; color: var(--text-secondary); }

/* ═══ Inputs & buttons ═══ */
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2367718a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; min-height: 64px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border: none; border-radius: 12px;
  font-size: .9rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.primary { background: var(--gradient); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.3); }
.btn.primary:hover { box-shadow: 0 6px 20px rgba(37,99,235,.4); }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--text-secondary); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger-solid { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(225,29,72,.3); }
.btn.small { padding: 6px 12px; font-size: .8rem; border-radius: 10px; }
.btn-group { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 10px;
  color: var(--text-secondary); font-size: .85rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ═══ Layout ═══ */
#main-view { display: flex; min-height: 100vh; }

#sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header { padding: 24px 20px 16px; }
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.15rem;
}
.sidebar-brand i { color: var(--accent); }
.sidebar-client { font-size: .8rem; color: var(--text-secondary); margin-top: 4px; font-weight: 600; }

.nav-links { list-style: none; padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 12px;
  font-size: .9rem; font-weight: 600;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-link i { width: 18px; text-align: center; font-size: .95rem; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: .85rem;
}
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-weight: 600; min-width: 0; }
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#content {
  flex: 1;
  min-width: 0;
  margin-left: 250px;
  padding: 28px 32px calc(var(--tabbar-h) + 20px);
  max-width: 1600px;
}

#topbar { display: none; }

/* ═══ Mobile tab bar ═══ */
#tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom);
}
:root[data-theme="dark"] #tabbar { background: rgba(22,29,48,.92); }
.tab-link {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .62rem; font-weight: 600;
  cursor: pointer;
  background: none; border: none; font-family: inherit;
}
.tab-link i { font-size: 1.15rem; }
.tab-link.active { color: var(--accent); }

.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(13,26,60,.4);
  z-index: 190;
  display: flex; align-items: flex-end;
}
.sheet {
  background: var(--surface);
  width: 100%;
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 6px auto 14px; }
.sheet-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 12px;
  color: var(--text); text-decoration: none;
  font-weight: 600; font-size: .95rem;
  border-radius: 12px;
  cursor: pointer;
  background: none; border: none; width: 100%; font-family: inherit; text-align: left;
}
.sheet-item i { width: 22px; text-align: center; color: var(--accent); }
.sheet-item:active { background: var(--bg); }
.sheet-item.danger, .sheet-item.danger i { color: var(--danger); }

/* ═══ Page pieces ═══ */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.45rem; font-weight: 800; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
  min-width: 0;
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  background: var(--accent-soft); color: var(--accent);
}
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }
.stat-icon.violet { background: rgba(124,58,237,.14); color: var(--accent-2); }
.stat-card .label { font-size: .72rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .value { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.stat-card > div:last-child { min-width: 0; }

/* Hero card */
.hero-card {
  border-radius: 20px;
  padding: 22px 24px;
  margin-bottom: 20px;
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 10px 30px rgba(37,99,235,.3);
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(80% 60% at 80% 0%, rgba(255,255,255,.18), transparent);
  pointer-events: none;
}
.hero-card > * { position: relative; z-index: 1; }
.hc-label { font-size: .78rem; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; opacity: .9; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.hc-value { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.hc-value small { font-size: 1rem; font-weight: 600; opacity: .85; }
.hc-hint { margin-top: 14px; font-size: .85rem; opacity: .92; line-height: 1.5; }
@media (max-width: 768px) { .hc-value { font-size: 1.6rem; } }

.progress-bar { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--gradient); border-radius: 4px; transition: width .5s ease; }

/* Project cards */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .2s, transform .15s, box-shadow .2s;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.project-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.project-key {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 800; letter-spacing: .5px;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 8px;
}
.project-card h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 8px; }
.project-meta { display: flex; gap: 14px; font-size: .8rem; color: var(--text-secondary); flex-wrap: wrap; }
.project-meta i { margin-right: 4px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-weight: 700; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; }
.data-table tr:hover td { background: var(--bg); }
.table-wrapper { overflow-x: auto; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700;
  white-space: nowrap;
}
.badge.done { background: var(--success-soft); color: var(--success); }
.badge.progress { background: var(--accent-soft); color: var(--accent); }
.badge.todo { background: var(--border); color: var(--text-secondary); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
  padding: 7px 16px; border-radius: 20px; font-size: .8rem; font-weight: 700;
  background: var(--surface); border: 1.5px solid var(--border); cursor: pointer;
  font-family: inherit; color: var(--text-secondary); transition: all .15s;
}
.filter-chip.active, .filter-chip:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* Issue detail */
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-secondary); font-size: .85rem; font-weight: 600;
  margin-bottom: 16px; cursor: pointer; background: none; border: none; font-family: inherit;
  padding: 6px 10px; border-radius: 10px;
  transition: background .15s, color .15s;
}
.back-link:hover { background: var(--accent-soft); color: var(--accent); }

.issue-key-label { font-size: .78rem; font-weight: 800; color: var(--accent); letter-spacing: .5px; }
.issue-title { font-size: 1.3rem; font-weight: 800; margin: 4px 0 14px; }
.issue-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.meta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600; color: var(--text-secondary);
  background: var(--bg); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 20px;
}
.meta-pill i { color: var(--accent); }
.issue-desc { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .92rem; white-space: pre-wrap; }

.comment {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.comment-avatar {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem;
}
.comment-author { font-weight: 700; font-size: .88rem; }
.comment-date { font-size: .75rem; color: var(--text-secondary); }
.comment-body { font-size: .9rem; white-space: pre-wrap; margin-left: 42px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13,26,60,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border-radius: 20px;
  width: 100%; max-width: 500px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: popIn .2s ease;
}
@keyframes popIn { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 800; }
.modal-close {
  background: var(--bg); border: none;
  width: 32px; height: 32px; border-radius: 10px;
  font-size: .95rem; cursor: pointer; color: var(--text-secondary);
}
.modal-body { padding: 22px; }
.modal-body form { display: flex; flex-direction: column; gap: 14px; }
.modal-body label { font-size: .8rem; font-weight: 700; color: var(--text-secondary); }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + 12px);
  left: 50%; transform: translate(-50%, 10px);
  padding: 12px 22px;
  background: #1a2338; color: #fff;
  border-radius: 14px; font-size: .88rem; font-weight: 600;
  opacity: 0; transition: all .3s;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  max-width: 90vw; text-align: center;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* Confirm dialog */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(13,26,60,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 250; padding: 16px;
}
.confirm-box {
  background: var(--surface); border-radius: 20px;
  padding: 26px; max-width: 380px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: popIn .2s ease;
}
.confirm-box p { margin-bottom: 20px; font-weight: 600; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state i { font-size: 2.2rem; color: var(--accent); opacity: .4; margin-bottom: 12px; }
.empty-state h3 { color: var(--text); font-weight: 800; margin-bottom: 6px; }
.empty-state p { font-size: .9rem; margin-bottom: 18px; }

.hidden { display: none !important; }

/* Attachments */
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.attachment-card {
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; background: var(--bg);
  display: flex; flex-direction: column;
  transition: border-color .15s, transform .15s;
}
.attachment-card.file {
  align-items: center; justify-content: center; text-align: center;
  padding: 18px 12px; gap: 6px;
}
.attachment-card.file:hover { border-color: var(--accent); transform: translateY(-2px); }
.attachment-card.file i { font-size: 1.8rem; color: var(--accent); }
.att-thumb { width: 100%; height: 110px; object-fit: cover; display: block; }
.att-name { font-size: .74rem; padding: 8px; word-break: break-word; color: var(--text); }
.att-size { font-size: .7rem; color: var(--text-secondary); }
.att-loading { display: flex; align-items: center; justify-content: center; height: 110px; color: var(--text-secondary); }

/* Toggle switch */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: none; }
.switch-label strong { display: block; font-size: .92rem; }
.switch-label span { font-size: .8rem; color: var(--text-secondary); }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border); border-radius: 26px; transition: .2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.section-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-secondary); margin: 22px 0 10px; }
.hint-box {
  background: var(--accent-soft); border-radius: 12px; padding: 14px 16px;
  font-size: .85rem; color: var(--text); display: flex; gap: 10px; margin-bottom: 16px;
}
.hint-box i { color: var(--accent); margin-top: 2px; }

/* View toggle (lista/tablero) */
.view-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.view-toggle button {
  border: none; background: none; cursor: pointer; font-family: inherit;
  width: 34px; height: 30px; border-radius: 8px; color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s;
}
.view-toggle button.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* Kanban board */
.board-hint { font-size: .8rem; color: var(--text-secondary); margin-bottom: 12px; }
.board { display: flex; gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; flex: 0 0 300px; max-width: 300px; }
.board-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; font-weight: 700; font-size: .85rem;
  border-bottom: 2px solid var(--border);
}
.board-col-header.todo { color: var(--text-secondary); }
.board-col-header.progress { color: var(--accent); }
.board-col-header.done { color: var(--success); }
.board-count { background: var(--surface); border-radius: 20px; padding: 1px 9px; font-size: .75rem; }
.board-cards { padding: 10px; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; }
.board-empty { text-align: center; color: var(--text-secondary); padding: 20px 0; font-size: .85rem; }
.board-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; cursor: pointer; transition: border-color .15s, transform .12s, box-shadow .15s;
}
.board-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.board-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.board-card-key { font-size: .72rem; font-weight: 800; color: var(--accent); }
.board-card-title { font-size: .85rem; line-height: 1.4; margin-bottom: 10px; }
.board-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.board-card-assignee {
  width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 800;
}
.pri-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pri-dot.high { background: var(--danger); }
.pri-dot.med { background: var(--warning); }
.pri-dot.low { background: var(--success); }

@media (max-width: 768px) {
  .board-col { flex-basis: 82vw; max-width: 82vw; }
}

/* Dashboard de dos columnas */
.dash-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }

/* Filas de "actualizado recientemente" */
.recent-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.recent-row:last-child { border-bottom: none; }
.recent-row:hover .recent-title { color: var(--accent); }
.recent-title { font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { font-size: .76rem; color: var(--text-secondary); margin-top: 2px; }
.recent-key { color: var(--accent); font-weight: 700; }

/* Último acceso en filas de usuario */
.member-login { font-size: .72rem; color: var(--text-secondary); margin-top: 3px; }
.member-login i { margin-right: 3px; }

/* Feed de actividad (admin) */
.activity-row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.activity-row:last-child { border-bottom: none; }
.activity-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .82rem;
}
.activity-icon.progress { background: var(--accent-soft); color: var(--accent); }
.activity-icon.done { background: var(--success-soft); color: var(--success); }
.activity-icon.todo { background: var(--border); color: var(--text-secondary); }
.activity-body { min-width: 0; }
.activity-text { font-size: .88rem; }
.activity-meta { font-size: .76rem; color: var(--text-secondary); margin-top: 2px; }

/* Gráfica donut */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { flex-shrink: 0; }
.donut-top { font-size: 22px; font-weight: 800; fill: var(--text); }
.donut-bottom { font-size: 10px; fill: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }
.donut-legend { font-size: .85rem; display: flex; flex-direction: column; gap: 6px; }
.donut-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.donut-legend strong { margin-left: 4px; }

/* Gráfica de barras */
.bar-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 150px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-track { width: 100%; flex: 1; display: flex; align-items: flex-end; background: var(--bg); border-radius: 8px 8px 0 0; overflow: hidden; }
.bar-fill { width: 100%; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 8px 8px 0 0; min-height: 3px; position: relative; transition: height .4s ease; }
.bar-val { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .72rem; font-weight: 700; color: var(--text-secondary); }
.bar-label { font-size: .72rem; color: var(--text-secondary); font-weight: 600; }

/* Proyecto asignado (tarjeta admin) */
.assigned-proj { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.assigned-proj:last-of-type { border-bottom: none; }

/* Buscador */
.search-bar { position: relative; margin-bottom: 18px; }
.search-bar i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.search-bar input { padding-left: 42px; }

/* Fade-in de contenido al navegar */
#content > * { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Members list */
.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-avatar {
  width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem;
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 700; font-size: .9rem; }
.member-email { font-size: .78rem; color: var(--text-secondary); }

.invite-code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--accent-soft); border-radius: 12px;
  padding: 12px 16px; margin-top: 8px;
}
.invite-code-box code { font-size: 1.1rem; font-weight: 800; letter-spacing: 2px; color: var(--accent); }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  #sidebar { display: none; }
  #content { margin-left: 0; padding: 76px 16px calc(var(--tabbar-h) + 20px); }
  #tabbar { display: flex; }
  #topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: fixed; top: 0; left: 0; right: 0;
    background: rgba(255,255,255,.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
    z-index: 150;
    font-weight: 800;
  }
  :root[data-theme="dark"] #topbar { background: rgba(22,29,48,.92); }
  .page-header h1 { font-size: 1.2rem; }
  .projects-grid { grid-template-columns: 1fr; }
}
