:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111827;
  --panel-alt: #1f2937;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #60a5fa;
  --success: #34d399;
  --warning: #facc15;
  --danger: #f87171;
  --border: rgba(148, 163, 184, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 30%),
    linear-gradient(180deg, #020617 0%, #0f172a 100%);
  color: var(--text);
  overflow: hidden;
}

button,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto auto 0;
  width: 280px;
  height: 100vh;
  overflow: auto;
  background: rgba(15, 23, 42, 0.95);
  border-right: 1px solid var(--border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.main-content {
  margin-left: 280px;
  padding: 32px;
  height: 100vh;
  overflow-y: auto;
  width: calc(100vw - 280px);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border-radius: 32px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.login-form label {
  color: var(--muted);
  font-size: 0.95rem;
}

.login-form input {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
}

.password-field {
  position: relative;
  display: grid;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.95rem;
}

.login-form input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.65);
}

.login-error {
  color: #fca5a5;
  min-height: 1.4rem;
  margin: 0;
}

.login-meta {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-card .brand {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 150px;
  height: 150px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: transparent;
  font-size: 1.2rem;
  font-weight: 700;
  margin: auto;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 1.15rem;
}

.nav-menu {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 12px 16px;
  border-radius: 14px;
  transition: background 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(56, 189, 248, 0.12);
}

.bottom-link {
  display: block;
  margin-top: auto;
  text-decoration: none;
  color: var(--text);
}

.sidebar-footer {
  display: flex;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.06);
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.sidebar-footer div, p {
  cursor: pointer;
}

.sidebar-footer:hover {
  background: rgba(56, 189, 248, 0.12);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h2 {
  margin: 0 0 8px;
  font-size: 1.9rem;
}

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

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

.mobile-menu-toggle {
  display: none;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  margin-bottom: 12px;
}

.btn {
  border: none;
  color: #0f172a;
  background: var(--accent);
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
}

.btn.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.btn-ghost.delete-btn:hover {
  background: rgba(237, 13, 13, 0.714);
}

.btn.btn-ghost#logout-btn:hover {
  background: rgba(237, 13, 13, 0.714);
}

.btn.btn-ghost.edit-btn:hover {
  background: rgba(56, 189, 248, 0.12);
}

.btn.btn-ghost.view-btn:hover {
  background: rgba(56, 189, 248, 0.12);
}

.summary-loader {
  text-align:center;
  padding:40px 0;
  height:226px;
}

.summary-loader img {
  height: 40%;
}

.profile {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1d4ed8;
  font-weight: 700;
  cursor: default;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.summary-card {
  padding: 24px;
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
}

.summary-card h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.summary-card p {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.panel {
  padding: 24px;
  border-radius: 28px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
}

.panel-large {
  grid-column: span 1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-header h3 {
  margin: 0;
}

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

.btn.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 60;
  overflow-y: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.6);
}

.modal-panel {
  position: relative;
  width: min(720px, 96%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  z-index: 62;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-body {
  margin-top: 12px;
}

.modal form {
  display: grid;
  gap: 10px;
}

.modal form .required {
  font-weight: bold;
}

.modal .option-form-control {
  height: 38px;
  width: 180px;
}

.modal .option-form-control:hover {
  cursor: pointer;
}

.modal input,
.modal select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.8);
  color: var(--text);
  min-width: 180px;
}

select {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
}

.chart {
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding: 12px 0;
}

.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.bar-fill {
  width: 100%;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.95), rgba(56, 189, 248, 0.4));
}

.bar-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}

.activity-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.activity-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
}

.activity-item p {
  margin: 0;
  color: var(--muted);
}

.status-blocks {
  display: grid;
  gap: 16px;
}

.status-blocks div {
  padding: 16px;
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.06);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.status-green { background: var(--success); }
.status-yellow { background: var(--warning); }
.status-red { background: var(--danger); }

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}

thead th {
  text-align: left;
  padding: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

table tr td, th {
  text-wrap: nowrap;
  padding: 12px;
}
tbody tr {
  border-top: 1px solid var(--border);
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap table {
  min-width: 600px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.status-chip span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-chip.on-track { background: rgba(52, 211, 153, 0.14); color: #d1fae5; }
.status-chip.blocked { background: rgba(248, 113, 113, 0.14); color: #fecaca; }
.status-chip.review { background: rgba(250, 204, 21, 0.14); color: #fef08a; }

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .main-content {
    width: 100%;
  }

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

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto auto 0;
    width: min(260px, 80vw);
    max-width: 260px;
    height: 100%;
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.35);
    z-index: 30;
    background: rgba(15, 23, 42, 0.98);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart {
    min-height: 220px;
  }
}

@media (max-width: 500px) {
  .main-content {
    padding: 16px;
  }

  .sidebar {
    padding: 24px 20px;
  }

  .panel,
  .summary-card {
    padding: 20px;
  }

  .summary-card p {
    font-size: 1.55rem;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    gap: 10px;
  }

  .btn {
    width: 100%;
  }
}

.hidden {
  display: none !important;
}

.page-section {
  animation: fadeIn 0.3s ease;
}

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