:root {
  --bg: #06110b;
  --bg2: #0a1b10;
  --panel: rgba(15, 37, 23, 0.94);
  --panel2: rgba(20, 49, 31, 0.88);
  --green: #39c26b;
  --green2: #1f8f4d;
  --lime: #b7f7c5;
  --text: #f4fff7;
  --muted: #aac5b2;
  --line: rgba(185, 238, 199, 0.16);
  --danger: #ff6b6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, .36);
  --radius: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 10%, rgba(57,194,107,.16), transparent 28%),
    radial-gradient(circle at 85% 16%, rgba(183,247,197,.08), transparent 24%),
    linear-gradient(135deg, var(--bg), var(--bg2) 55%, #040905);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 292px;
  padding: 22px;
  background: rgba(5, 18, 10, .74);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--green), #83f29f);
  color: #06200f;
  font-weight: 950;
  letter-spacing: -.08em;
}

.brand-row p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
}

.brand-row h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.04em;
}

.nav {
  display: grid;
  gap: 7px;
  overflow: auto;
  padding-right: 4px;
}

.nav a {
  padding: 12px 14px;
  border-radius: 15px;
  color: #d9f8df;
  font-weight: 780;
}

.nav a.active,
.nav a:hover {
  background: rgba(57,194,107,.14);
  color: var(--lime);
}

.user-card {
  margin-top: auto;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(57,194,107,.09);
  display: grid;
  gap: 7px;
}

.user-card span,
.muted {
  color: var(--muted);
}

.main {
  margin-left: 292px;
  padding: 28px 30px 110px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  font-weight: 950;
}

.topbar h2 {
  margin: 0;
  font-size: 36px;
  letter-spacing: -.055em;
}

.new-note-link {
  padding: 16px 22px;
  border-radius: 999px;
  color: #06200f;
  background: linear-gradient(135deg, var(--green), #83f29f);
  font-weight: 950;
  box-shadow: 0 18px 40px rgba(57,194,107,.34);
}

.panel,
.stat-card,
.module-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(0,0,0,.22);
}

.panel {
  padding: 22px;
}

.panel h3,
.panel h4 {
  margin-top: 0;
}

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

.stat-grid,
.module-grid,
.grid.two,
.form-grid.two,
.party-grid,
.filter-grid {
  display: grid;
  gap: 16px;
}

.stat-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin-bottom: 18px;
}

.stat-card {
  padding: 18px;
  display: grid;
  gap: 7px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.stat-card strong {
  font-size: 26px;
  letter-spacing: -.04em;
}

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

.module-grid {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  margin-top: 18px;
}

.module-card {
  padding: 19px;
  display: grid;
  gap: 7px;
}

.module-card span {
  color: var(--green);
  font-weight: 950;
  font-size: 13px;
}

.module-card strong {
  font-size: 18px;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: #d7f8df;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px 14px;
  background: rgba(2, 13, 7, .72);
  color: var(--text);
  outline: none;
}

input::placeholder {
  color: rgba(244,255,247,.42);
}

.primary,
.secondary,
.ghost {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 850;
}

.primary {
  background: linear-gradient(135deg, var(--green), #83f29f);
  color: #06200f;
}

.secondary {
  color: var(--lime);
  border: 1px solid rgba(57,194,107,.2);
  background: rgba(57,194,107,.16);
}

.ghost {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
}

.small { padding: 8px 12px; font-size: 13px; }
.block { width: 100%; margin-top: 10px; }

.editor-top {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.editor-top h3 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -.04em;
}

.status-box {
  display: grid;
  justify-items: end;
  gap: 6px;
  color: var(--muted);
}

.status {
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 950;
  font-size: 12px;
}

.status.draft {
  color: #ffd37a;
  background: rgba(244,184,74,.18);
}

.party-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}

.party-card p {
  color: #d7f8df;
}

.items-head {
  margin-top: 18px;
}

.items-table {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(2, 13, 7, .38);
  overflow: hidden;
}

.item-row {
  display: grid;
  grid-template-columns: 42px minmax(220px, 1fr) 110px 100px 120px 130px 46px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(185,238,199,.11);
}

.item-row-head {
  color: var(--lime);
  background: rgba(57,194,107,.12);
  font-weight: 950;
  font-size: 13px;
}

.remove-item {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #ff9b9b;
  background: rgba(255,93,93,.14);
}

.add-item-inline {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--lime);
  padding: 14px 16px;
  font-weight: 900;
  border-top: 1px solid rgba(185,238,199,.11);
}

.summary-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(57,194,107,.1);
  display: grid;
  gap: 8px;
}

.summary-box div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.summary-box .rounded strong {
  font-size: 30px;
  color: var(--lime);
}

.error-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,107,107,.3);
  background: rgba(255,107,107,.12);
  color: #ffd2d2;
}

.bottom-actions {
  display: grid;
  grid-template-columns: 150px 150px 270px;
  justify-content: end;
  gap: 12px;
  margin-top: 18px;
}

.summary-layout {
  display: grid;
  grid-template-columns: 380px minmax(360px, 1fr);
  gap: 18px;
  align-items: start;
}

.summary-preview {
  display: grid;
  justify-items: center;
}

.summary-paper {
  position: relative;
  width: min(520px, 100%);
  min-height: 720px;
  padding: 38px 36px;
  background: #1c1c1c;
  color: #f3f3f3;
  box-shadow: var(--shadow);
}

.half-line {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 50%;
  width: 1px;
  background: rgba(255,255,255,.42);
}

.right-half {
  width: 50%;
  margin-left: 50%;
  padding-left: 22px;
  text-align: center;
}

.muted-on-dark {
  color: rgba(255,255,255,.62);
}

.daily-table {
  display: grid;
  gap: 10px;
  max-width: 620px;
}

.daily-table > div {
  display: grid;
  grid-template-columns: 1fr 180px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.daily-table .total {
  border-top: 2px solid var(--green);
  color: var(--lime);
  font-size: 20px;
  font-weight: 950;
}

.knowledge-list {
  display: grid;
  gap: 14px;
}

.knowledge-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}

.toast {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 100;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #07150d;
  border: 1px solid var(--line);
  color: white;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.62);
}

.modal {
  width: min(500px, 100%);
  padding: 24px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: #091c10;
  box-shadow: var(--shadow);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1080px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .main {
    margin-left: 0;
  }

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

  .stat-grid,
  .module-grid,
  .grid.two,
  .form-grid.two,
  .party-grid,
  .summary-layout {
    grid-template-columns: 1fr;
  }

  .editor-top {
    grid-template-columns: 1fr;
  }

  .status-box {
    justify-items: start;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px 14px 110px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .item-row {
    grid-template-columns: 32px 1fr;
  }

  .item-row-head {
    display: none;
  }

  .item-row > * {
    grid-column: 2;
  }

  .item-row > span:first-child {
    grid-column: 1;
    grid-row: 1 / 7;
  }

  .bottom-actions {
    grid-template-columns: 1fr;
  }
}
