:root {
  --bg: #f4f7f6;
  --bg-2: #ecf3f0;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --text: #16312a;
  --muted: #6c8178;
  --line: #d7e2dc;
  --line-strong: #b8ccc3;
  --accent: #2f7a65;
  --accent-2: #5aa38f;
  --accent-soft: rgba(47, 122, 101, 0.12);
  --danger: #b45a4d;
  --warning: #c78f2a;
  --shadow: 0 18px 50px rgba(17, 45, 38, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "Aptos", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(47, 122, 101, 0.10), transparent 28%),
    radial-gradient(circle at top right, rgba(90, 163, 143, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(47, 122, 101, 0.55);
  box-shadow: 0 0 0 4px rgba(47, 122, 101, 0.12);
}
textarea { resize: vertical; min-height: 110px; }

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

.sidebar {
  padding: 1.3rem;
  border-right: 1px solid rgba(183, 204, 195, 0.5);
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(245,248,247,0.65));
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand, .login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.brand strong, .login-brand strong { display: block; font-size: 1.02rem; }
.brand span, .login-brand span, .sidebar-card, .eyebrow, .stat-hint, .timeline-item p, .timeline-item span, .login-foot, .sidebar-note {
  color: var(--muted);
}
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #1f5c4d);
  box-shadow: 0 12px 28px rgba(47, 122, 101, 0.28);
}

.nav {
  margin-top: 1.25rem;
  display: grid;
  gap: .45rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .88rem .95rem;
  border-radius: 16px;
  border: 1px solid transparent;
  color: #294139;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,0.82);
  border-color: var(--line);
  box-shadow: 0 10px 22px rgba(19, 53, 44, 0.05);
}
.nav-icon {
  width: 24px;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
}

.sidebar-card, .panel, .stat-card, .login-card, .accent-panel {
  background: var(--panel);
  border: 1px solid rgba(183, 204, 195, 0.55);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.sidebar-card {
  margin-top: 1.2rem;
  padding: 1rem 1.05rem;
  border-radius: 20px;
}
.sidebar-label, .stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sidebar-value { font-size: 1.25rem; font-weight: 800; margin-top: .35rem; }
.sidebar-note { margin-top: .45rem; font-size: .92rem; line-height: 1.45; }

.main { min-width: 0; }
.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 1.6rem 1rem;
}
.topbar h1, .panel h2, .accent-panel h2, .login-card h2, .login-hero h1 { margin: .15rem 0 0; line-height: 1.1; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.period-switcher {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.75);
}
.period-switcher select {
  width: auto;
  min-width: 160px;
  border: 0;
  background: transparent;
  padding: .45rem .7rem;
}
.topbar-pill, .panel-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem .9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--line);
  color: #2f4d44;
  font-size: .92rem;
}
.ghost-link {
  padding: .65rem .95rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--line);
}
.content { padding: 0 1.6rem 1.6rem; }

.grid { display: grid; gap: 1rem; }
.cards-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dashboard-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); margin-top: 1rem; }
.two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 1rem; }

.stat-card, .panel, .accent-panel, .login-card { border-radius: var(--radius-lg); }
.stat-card {
  padding: 1.1rem 1.15rem;
  min-height: 116px;
}
.stat-value { font-size: 1.7rem; font-weight: 800; margin: .4rem 0 .2rem; }
.stat-hint { font-size: .95rem; }

.panel, .accent-panel { padding: 1.15rem; }
.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel-head h2, .accent-panel h2 { margin-top: .15rem; }
.eyebrow {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}
.module-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.78);
}
.module-card strong, .mini-item strong { display: block; margin-bottom: .15rem; }
.module-card span, .mini-item span { color: var(--muted); font-size: .92rem; }
.module-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.timeline { display: grid; gap: .95rem; }
.timeline-item { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: .75rem; }
.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: .35rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 5px rgba(47, 122, 101, 0.10);
}
.timeline-item p { margin: .3rem 0; line-height: 1.5; }

.table-wrap { overflow: auto; border-radius: 20px; border: 1px solid var(--line); background: rgba(255,255,255,0.72); }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: .9rem .95rem; border-bottom: 1px solid rgba(215, 226, 220, 0.9); text-align: left; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: rgba(236, 243, 240, 0.35); }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: .35rem .6rem;
  border-radius: 999px;
  background: rgba(47, 122, 101, 0.1);
  color: var(--accent);
  font-size: .85rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}
.form-grid label {
  display: grid;
  gap: .4rem;
  font-weight: 600;
  color: #274139;
}
.form-grid.compact { margin-top: 1rem; }
.span-2 { grid-column: 1 / -1; }

.primary-btn, .ghost-btn, .danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 0;
  border-radius: 14px;
  padding: .88rem 1.1rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.primary-btn {
  background: linear-gradient(135deg, var(--accent), #245f4f);
  color: white;
  box-shadow: 0 16px 32px rgba(47, 122, 101, 0.25);
}
.primary-btn:hover, .ghost-btn:hover, .danger-btn:hover { transform: translateY(-1px); }
.primary-btn.inline { margin-top: .8rem; }
.ghost-btn {
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--line);
  color: #274139;
}
.danger-btn {
  background: rgba(180, 90, 77, 0.12);
  color: var(--danger);
  border: 1px solid rgba(180, 90, 77, 0.24);
}

.searchbar {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
}
.searchbar input { flex: 1; }
.filter-bar {
  display: grid;
  gap: .75rem;
  margin-top: 1rem;
}
.filter-bar .searchbar {
  margin-bottom: 0;
}

.stack-list { display: grid; gap: .7rem; }
.group-panel {
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.76);
}
.group-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: .8rem;
}
.group-panel-head span { display: block; color: var(--muted); font-size: .92rem; margin-top: .15rem; }
.mini-item, .backup-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .95rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.78);
}
.period-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .95rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.78);
}
.period-row span { display: block; color: var(--muted); font-size: .92rem; margin-top: .15rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.table-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.backup-row span { display: block; color: var(--muted); font-size: .92rem; margin-top: .15rem; }
.muted-text { color: var(--muted); font-size: .9rem; margin-top: .2rem; }

.participant-section {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,0.72);
}
.participant-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: .9rem;
}
.participant-head strong { display: block; margin-bottom: .2rem; }
.participant-head span { color: var(--muted); font-size: .92rem; }
.participant-rows { display: grid; gap: .85rem; }
.participant-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) .6fr .9fr minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: end;
  padding: .9rem;
  border-radius: 18px;
  border: 1px solid rgba(183, 204, 195, 0.55);
  background: rgba(255,255,255,0.82);
}
.participant-row label { display: grid; gap: .35rem; font-weight: 600; color: #274139; }
.participant-remove { white-space: nowrap; }

.accent-panel {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(241, 248, 245, 0.92)),
    radial-gradient(circle at top right, rgba(47, 122, 101, 0.10), transparent 45%);
}

.login-page { display: block; }
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 1.5rem;
  align-items: center;
  padding: 3rem;
}
.login-hero {
  padding: 2rem 1rem 2rem 2rem;
  max-width: 680px;
}
.login-hero h1 { font-size: clamp(2.2rem, 4vw, 4.2rem); }
.login-hero p { font-size: 1.08rem; line-height: 1.65; color: var(--muted); max-width: 56ch; }
.login-points {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.login-points div {
  padding: .65rem .9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
}
.login-card {
  padding: 1.6rem;
  max-width: 480px;
  width: 100%;
  margin-left: auto;
}
.login-card h2 { margin-bottom: .9rem; }
.alert.error {
  padding: .8rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  background: rgba(180, 90, 77, 0.1);
  color: var(--danger);
  border: 1px solid rgba(180, 90, 77, 0.2);
}
.alert.info {
  padding: .8rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  background: rgba(47, 122, 101, 0.1);
  color: var(--accent);
  border: 1px solid rgba(47, 122, 101, 0.2);
}

@media (max-width: 1200px) {
  .cards-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(183, 204, 195, 0.5);
  }
  .content, .topbar { padding-inline: 1rem; }
  .topbar { align-items: start; flex-direction: column; }
  .module-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; padding: 1.2rem; }
  .login-card, .login-hero { margin: 0; max-width: none; padding-inline: 0; }
}
@media (max-width: 640px) {
  .cards-6 { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .searchbar, .backup-row, .mini-item { flex-direction: column; align-items: stretch; }
  .period-row { flex-direction: column; align-items: stretch; }
  .row-actions { flex-direction: column; align-items: stretch; }
  .participant-head { flex-direction: column; align-items: stretch; }
  .participant-row { grid-template-columns: 1fr; }
  .participant-row { align-items: stretch; }
  .primary-btn, .ghost-btn, .danger-btn, .ghost-link { width: 100%; }
  table { min-width: 520px; }
}
