:root {
  --bg-a: #ffffff;
  --bg-b: #ffffff;
  --glass: rgba(255, 255, 255, 0.9);
  --glass-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(24, 72, 45, 0.18);
  --text: #17211a;
  --muted: #607265;
  --brand: #00a63c;
  --brand-deep: #05752f;
  --danger: #ff6b8a;
  font-family: "Manrope", "Sora", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: #ffffff;
}

.orb {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(46px);
  opacity: 0.08;
  z-index: 0;
}

.orb-a {
  top: -120px;
  left: -100px;
  background: #9fdcb7;
}

.orb-b {
  top: 28%;
  right: -140px;
  background: #b4ebc9;
}

.orb-c {
  bottom: -140px;
  left: 28%;
  background: #c7f0d7;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--line);
  box-shadow:
    0 10px 24px rgba(15, 42, 25, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.glass-inner {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(49, 119, 77, 0.22);
  border-radius: 16px;
}

.app-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 12px;
  padding: 12px;
}

.sidebar {
  border-radius: 20px;
  padding: 1rem;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0.9rem;
}

.brand {
  padding: 0.85rem;
}

.brand-tag {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #138f43;
  font-weight: 800;
}

.brand h1 {
  margin: 0.2rem 0 0;
  font-size: 1.45rem;
  color: var(--brand);
}

.brand-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.nav {
  display: grid;
  gap: 0.45rem;
}

.nav-link {
  border: 1px solid rgba(37, 98, 63, 0.2);
  border-radius: 12px;
  text-align: left;
  padding: 0.64rem 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  color: #1d2c22;
  font-weight: 700;
  text-decoration: none;
}

.nav-link:hover {
  background: #f3f8f5;
}

.nav-link.active {
  border-color: rgba(33, 150, 83, 0.42);
  background: linear-gradient(110deg, rgba(0, 166, 60, 0.2), rgba(2, 110, 48, 0.16));
  color: #104327;
}

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

.panel {
  border-radius: 18px;
  padding: 0.9rem;
}

.compact {
  align-self: end;
}

h2,
h3,
h4,
p {
  margin: 0;
}

h2 {
  font-size: 1.24rem;
}

h3 {
  font-size: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

#viewSubtitle {
  margin-top: 0.26rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-actions,
.actions-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-actions-block {
  display: grid;
  gap: 0.55rem;
}

.api-connect {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.api-connect input {
  min-width: 290px;
}

.sync-status {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #88a899;
}

.sync-status.ok {
  color: #9dffcd;
}

.sync-status.warn {
  color: #ffe8a8;
}

.sync-status.bad {
  color: #ffc6c6;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.56rem 0.92rem;
  background: linear-gradient(110deg, var(--brand), #2fd372);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(2, 133, 52, 0.35);
}

button.secondary {
  border: 1px solid rgba(37, 98, 63, 0.22);
  background: rgba(255, 255, 255, 0.95);
  color: #183025;
}

a.secondary {
  border: 1px solid rgba(37, 98, 63, 0.22);
  background: rgba(255, 255, 255, 0.95);
  color: #183025;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.tiny {
  border-radius: 10px;
  padding: 0.32rem 0.5rem;
  font-size: 0.78rem;
}

a.tiny {
  border-radius: 10px;
  padding: 0.32rem 0.5rem;
  font-size: 0.78rem;
}

button.danger {
  background: rgba(255, 107, 138, 0.16);
  color: #ffabc0;
  border: 1px solid rgba(255, 125, 154, 0.42);
  box-shadow: none;
}

.view {
  display: none;
  gap: 0.9rem;
}

.view.active {
  display: grid;
}

.module-launcher {
  gap: 0.8rem;
}

.launcher-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.launcher-card {
  text-decoration: none;
  color: #1a2b20;
  border-radius: 14px;
  padding: 0.85rem;
  border: 1px solid rgba(37, 98, 63, 0.18);
  background: rgba(255, 255, 255, 0.96);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.launcher-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.42);
}

.launcher-card h4 {
  font-size: 0.95rem;
}

.launcher-card p {
  margin-top: 0.35rem;
  color: #607166;
  font-size: 0.82rem;
  line-height: 1.3;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.kpi h4 {
  color: #9ab9a9;
  font-size: 0.84rem;
}

.kpi p {
  margin-top: 0.3rem;
  font-size: 1.5rem;
  font-weight: 800;
}

.double-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.bars {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.56rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.bar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #12c15a, #38ec8b);
}

.list {
  margin: 0.55rem 0 0;
  padding-left: 1rem;
}

.list li {
  margin: 0.35rem 0;
  color: #31453a;
}

.compact-list li {
  font-size: 0.83rem;
}

.form-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.inline-form {
  margin-top: 0.65rem;
  display: flex;
  gap: 0.5rem;
}

label {
  display: grid;
  gap: 0.3rem;
  color: #2f4338;
  font-size: 0.81rem;
  font-weight: 700;
}

input,
select {
  border: 1px solid rgba(42, 108, 69, 0.24);
  border-radius: 10px;
  padding: 0.56rem 0.6rem;
  background: rgba(255, 255, 255, 0.98);
  color: #18211a;
}

input::placeholder {
  color: #8aa194;
}

input:focus,
select:focus {
  outline: 2px solid rgba(0, 166, 60, 0.35);
  outline-offset: 1px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.table-wrap {
  margin-top: 0.7rem;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1900px;
}

th,
td {
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid rgba(58, 119, 83, 0.3);
  text-align: left;
  vertical-align: top;
  font-size: 0.84rem;
}

th {
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: #6c8477;
  text-transform: uppercase;
}

.table-input {
  min-width: 120px;
  width: 100%;
  font-size: 0.76rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
}

.table-input.short {
  min-width: 78px;
}

.table-input.medium {
  min-width: 130px;
}

.table-input.wide {
  min-width: 220px;
}

.badge {
  display: inline-block;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 800;
  background: rgba(222, 234, 227, 0.9);
}

.badge.good {
  background: rgba(40, 166, 92, 0.26);
  color: #b6f8cf;
}

.badge.bad {
  background: rgba(255, 107, 138, 0.2);
  color: #ffc1d0;
}

.actions-cell {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.status-select {
  min-width: 160px;
}

.chip-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.chip-card {
  border: 1px solid rgba(37, 98, 63, 0.18);
  border-radius: 12px;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.96);
  display: grid;
  gap: 0.45rem;
}

.chip-card[draggable="true"] {
  cursor: grab;
}

.chip-card.dragging {
  opacity: 0.45;
}

.chip-card.drop-target {
  border-color: rgba(0, 166, 60, 0.74);
  box-shadow: 0 0 0 2px rgba(0, 166, 60, 0.18);
}

.chip-card h4 {
  font-size: 0.9rem;
}

.chip-card p {
  margin-top: 0.25rem;
  color: #6f8478;
  font-size: 0.8rem;
}

.chip-card-main {
  display: grid;
  gap: 0.15rem;
}

.chip-card-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.drag-label {
  border: 1px dashed rgba(37, 98, 63, 0.32);
  border-radius: 10px;
  padding: 0.32rem 0.5rem;
  font-size: 0.72rem;
  color: #4f6658;
}

.muted {
  color: #6f8478;
}

.thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(42, 108, 69, 0.24);
}

.thumb.placeholder {
  display: grid;
  place-items: center;
  color: #d4f0df;
  font-size: 0.68rem;
  font-weight: 700;
}

.color-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(42, 108, 69, 0.42);
  margin-right: 0.35rem;
}

.resizer-output {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.5rem;
}

#resizeOutput {
  font-size: 0.78rem;
}

.resizer-preview {
  width: min(240px, 100%);
  height: 180px;
  object-fit: contain;
  border: 1px solid rgba(42, 108, 69, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
}

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

  .sidebar {
    grid-template-rows: auto auto;
  }

  .compact {
    display: none;
  }

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

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

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

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

@media (max-width: 780px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    flex-direction: column;
  }

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

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

  .api-connect input {
    min-width: 0;
  }

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