:root {
  --bg-main: #05060a;
  --bg-elevated: #111827;
  --bg-soft: #0b0f19;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.14);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border-subtle: #1f2933;
  --radius-lg: 1.25rem;
  --radius-md: 0.75rem;
  --shadow-soft: 0 18px 45px rgba(0,0,0,0.45);
  --gap: 1rem;
  --transition-fast: 0.16s ease-out;
  --header-height: 56px;
  --bottom-nav-height: 56px;
  --sidebar-width: 230px;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: radial-gradient(circle at top left, #111827 0, #020617 40%, #000 100%);
  color: var(--text-main);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER */

.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(15,23,42,0.8);
  background: radial-gradient(circle at 0 0, #1f2937 0, #020617 55%);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-logo {
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.app-logo span {
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #020617;
  font-size: 0.75rem;
}

.app-header-right {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.app-lang {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  padding: 0.25rem 0.7rem;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.app-lang:hover {
  border-color: var(--accent);
  color: #fed7aa;
}

.app-lang--active {
  background: var(--accent-soft);
  color: #fed7aa;
  border-color: var(--accent);
}

.app-user {
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.45);
  background: linear-gradient(135deg, rgba(15,23,42,0.9), rgba(15,23,42,0.6));
  backdrop-filter: blur(18px);
}

/* BODY LAYOUT */

.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0,1fr);
  min-height: calc(100vh - var(--header-height));
}

.app-sidebar {
  border-right: 1px solid rgba(15,23,42,0.85);
  padding: 1rem 0.75rem;
  background: radial-gradient(circle at top, #020617 0, #020617 40%, #000 100%);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.app-view {
  padding: 1.25rem 1.5rem 4.5rem;
  min-height: 0;
}

/* NAVIGATION */

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.nav-item::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: rgba(148,163,184,0.3);
}

.nav-item:hover {
  background: rgba(15,23,42,0.85);
  border-color: rgba(148,163,184,0.45);
  color: #e5e7eb;
  transform: translateY(-1px);
}

.nav-item.active {
  background: radial-gradient(circle at left, rgba(249,115,22,0.18) 0, rgba(15,23,42,0.9) 55%);
  border-color: rgba(249,115,22,0.85);
  color: #fef3c7;
}

.nav-item.active::before {
  background: #f97316;
}

/* BOTTOM NAV (MOBILE) */

.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  border-top: 1px solid rgba(15,23,42,0.9);
  background: radial-gradient(circle at top, #020617 0, #000 55%);
  display: none;
  z-index: 45;
  padding: 0.25rem 0.75rem;
}

.bottom-nav-item {
  flex: 1;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.bottom-nav-item-active {
  background: var(--accent-soft);
  color: #fed7aa;
  border-color: var(--accent);
}

/* CARDS, KPI, TABLES */

.card {
  background: radial-gradient(circle at top left, rgba(30,64,175,0.18) 0, rgba(15,23,42,0.96) 35%, rgba(15,23,42,0.98) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15,23,42,0.9);
  box-shadow: var(--shadow-soft);
  padding: 1rem 1.15rem;
}

.card-soft {
  background: rgba(15,23,42,0.92);
  border-radius: var(--radius-md);
  border: 1px solid rgba(30,64,175,0.5);
  box-shadow: 0 12px 32px rgba(15,23,42,0.9);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.kpi-chip {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(34,197,94,0.7);
  color: #bbf7d0;
  background: rgba(22,163,74,0.18);
}

.kpi-chip-warn {
  border-color: rgba(249,115,22,0.75);
  color: #fed7aa;
  background: rgba(249,115,22,0.18);
}

.grid {
  display: grid;
  gap: 0.9rem;
}

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

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

.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}

/* TAGS & BADGES */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid rgba(148,163,184,0.35);
  color: var(--text-muted);
}

.badge-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: rgba(148,163,184,0.55);
}

.badge-status-1 { border-color: rgba(148,163,184,0.6); }
.badge-status-2 { border-color: rgba(59,130,246,0.7); color:#bfdbfe; }
.badge-status-3 { border-color: rgba(234,179,8,0.85); color:#fef9c3; }
.badge-status-4 { border-color: rgba(34,197,94,0.85); color:#bbf7d0; }
.badge-status-5 { border-color: rgba(244,63,94,0.85); color:#fecaca; }

/* TABLE */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.table thead {
  background: rgba(15,23,42,0.95);
}

.table th,
.table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(15,23,42,0.85);
}

.table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.table tbody tr:hover {
  background: rgba(15,23,42,0.75);
}

/* BUTTONS */

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #111827;
  border-color: #fb923c;
  box-shadow: 0 10px 26px rgba(248,113,22,0.4);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(248,113,22,0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: rgba(148,163,184,0.4);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: #e5e7eb;
}

/* UTILITIES */

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.text-muted { color: var(--text-muted); }
.text-xs { font-size: 0.7rem; }
.text-sm { font-size: 0.8rem; }
.text-right { text-align: right; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .app-body {
    grid-template-columns: minmax(0,1fr);
  }
  .app-sidebar {
    display: none;
  }
  .app-view {
    padding-bottom: calc(var(--bottom-nav-height) + 1.2rem);
  }
  .app-bottom-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0,1fr);
  }
}

/* TIMELINE */

.timeline {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  border-left: 1px solid rgba(148,163,184,0.4);
}

.timeline-item {
  position: relative;
  padding-left: 0.9rem;
  margin-bottom: 0.5rem;
}

.timeline-dot {
  position: absolute;
  left: -0.23rem;
  top: 0.25rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #f97316;
  box-shadow: 0 0 0 4px rgba(248,113,22,0.25);
}

.timeline-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.timeline-text {
  font-size: 0.8rem;
}
