:root {
  --green: #174f35;
  --green-2: #2f7650;
  --mint: #eaf4ed;
  --paper: #f7f6f1;
  --glass: rgba(255, 255, 255, 0.64);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --ink: #151815;
  --muted: #6d746d;
  --line: rgba(38, 70, 48, 0.14);
  --red: #b85647;
  --amber: #b98431;
  --blue: #48758b;
  --shadow: 0 22px 60px rgba(30, 61, 42, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 18%, rgba(47, 118, 80, 0.16), transparent 26%),
    radial-gradient(circle at 88% 8%, rgba(72, 117, 139, 0.16), transparent 24%),
    linear-gradient(135deg, #fbfaf6 0%, #f3f5ef 58%, #eef4ef 100%);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(246, 243, 234, 0.72);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(140%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.brand-mark {
  width: 74px;
  height: 74px;
  flex: 0 0 74px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.50);
  border: 1px solid rgba(38, 70, 48, 0.10);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.42);
}

.brand-logo {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #29352d;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(23, 79, 53, 0.94);
  box-shadow: 0 12px 28px rgba(23, 79, 53, 0.18);
}

.sync-box {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
}

.sync-box p {
  margin: 7px 0 12px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

.main {
  padding: 28px;
  min-width: 0;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.08;
}

h2 {
  font-size: 19px;
  margin-bottom: 14px;
}

h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.date-pill {
  min-width: 220px;
  padding: 10px 13px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
}

.date-pill span,
.date-pill strong {
  display: block;
}

.date-pill span {
  color: var(--muted);
  font-size: 12px;
}

.date-pill strong {
  font-size: 13px;
}

.auth-bar {
  margin-left: auto;
}

.user-pill {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
}

.user-pill span,
.user-pill strong {
  padding: 0 5px;
  font-size: 12px;
}

.user-pill strong {
  color: var(--green);
  text-transform: uppercase;
}

.filter-bar {
  margin-bottom: 18px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(24px) saturate(150%);
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 5px 7px 5px 10px;
  border: 1px solid rgba(38, 70, 48, 0.12);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
}

.filter-chip span {
  white-space: nowrap;
}

.filter-chip select,
.filter-chip input {
  min-height: 27px;
  width: auto;
  max-width: 190px;
  padding: 2px 24px 2px 7px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.date-filter input {
  max-width: 150px;
  padding-right: 7px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.filter-clear {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 13px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.two-col {
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  align-items: stretch;
}

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

.section-gap {
  margin-top: 14px;
}

.panel,
.metric,
.form-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow: var(--shadow);
}

.panel,
.form-panel {
  padding: 18px;
}

.form-panel {
  display: flex;
  flex-direction: column;
}

.form-panel .form-grid {
  flex: 1;
}

.hero-panel {
  background: var(--glass-strong);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.metric {
  min-height: 118px;
  padding: 16px;
}

.metric span {
  display: block;
  min-height: 30px;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin: 5px 0 8px;
  font-size: 26px;
  line-height: 1.05;
}

.metric small {
  display: block;
  color: var(--muted);
  line-height: 1.25;
}

.glass-green {
  background: rgba(234, 244, 237, 0.86);
}

.danger {
  border-color: rgba(184, 86, 71, 0.36);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--green);
  background: rgba(234, 244, 237, 0.92);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.red {
  color: var(--red);
  background: rgba(184, 86, 71, 0.13);
}

.pill.amber {
  color: #8a5a12;
  background: rgba(185, 132, 49, 0.15);
}

.chart {
  width: 100%;
  height: 240px;
  display: block;
}

.chart-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.bars {
  display: grid;
  gap: 11px;
}

.compact-bars {
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.8fr) minmax(0, 2fr) auto;
  gap: 10px;
  align-items: center;
}

.bar-row span {
  min-width: 0;
  color: #303b33;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.bar-row strong {
  font-size: 13px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(31, 90, 58, 0.09);
  overflow: hidden;
}

.bar-track div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #7aa58c);
}

.signal-list,
.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.signal-list div,
.insight-grid div,
.mini-list div,
.chat-turn,
.list-card {
  border: 1px solid rgba(38, 70, 48, 0.10);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
  padding: 12px;
}

.signal-list span,
.insight-grid span,
.mini-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.signal-list strong,
.insight-grid strong {
  font-size: 20px;
}

.mini-list,
.card-list,
.chat-log {
  display: grid;
  gap: 10px;
}

.list-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 76px;
}

.list-card strong,
.list-card span {
  display: block;
}

.muted {
  color: var(--muted);
}

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

.list-card p {
  margin: 6px 0 0;
}

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

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.report-actions .secondary {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 13px;
}

.big-stat {
  font-size: 54px;
  line-height: 1;
  font-weight: 900;
  color: var(--green);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  min-height: 72px;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.primary,
.secondary {
  min-height: 42px;
  border-radius: 14px;
  padding: 10px 13px;
  border: 1px solid transparent;
  font-weight: 850;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--green-2));
}

.secondary {
  color: var(--green);
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
}

.danger-button {
  color: var(--red);
}

.compact {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.full {
  width: 100%;
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 11px 8px;
  border-bottom: 1px solid rgba(38, 70, 48, 0.10);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.ai-layout {
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
}

.chat-panel {
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

.chat-log {
  flex: 1;
  align-content: start;
  max-height: 440px;
  overflow: auto;
  padding-right: 4px;
}

.chat-turn strong {
  display: block;
  margin-bottom: 6px;
}

.chat-turn p {
  margin-bottom: 0;
  color: #303b33;
  line-height: 1.45;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.compressed-list details {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
  overflow: hidden;
}

.compressed-list summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--green);
  font-weight: 850;
}

.compressed-list details .card-list {
  padding: 0 12px 12px;
}

.ops-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  align-items: start;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-grid > strong {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 112px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
  overflow: hidden;
}

.calendar-day.outside {
  opacity: 0.46;
}

.calendar-day > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.event-chip {
  display: block;
  width: 100%;
  min-height: 26px;
  margin-bottom: 5px;
  padding: 4px 6px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  background: var(--green);
}

.event-chip.maintenance {
  background: var(--blue);
}

.event-chip.staff {
  background: var(--amber);
}

.event-chip.purchase,
.event-chip.restock {
  background: #6f7f50;
}

.event-chip.need {
  background: #8d6b72;
}

.secure-note {
  margin-top: 12px;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.auth-screen {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 18% 24%, rgba(23, 79, 53, 0.20), transparent 28%),
    rgba(247, 246, 241, 0.82);
  backdrop-filter: blur(18px) saturate(150%);
  z-index: 20;
}

.auth-screen.show {
  display: grid;
}

.auth-card {
  width: min(460px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(150%);
}

.auth-brand {
  padding: 0 0 18px;
}

.google-button,
.link-button {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  font-weight: 850;
}

.google-button {
  margin-bottom: 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.google-button::before {
  content: "G";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 13px;
}

.google-note {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(185, 132, 49, 0.24);
  border-radius: 14px;
  background: rgba(255, 249, 235, 0.72);
}

.link-button {
  margin-top: 10px;
  padding: 8px;
  border: 0;
  color: var(--green);
  background: transparent;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

#resetRequestForm {
  margin-top: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(21, 24, 21, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .focus-grid,
  .two-col,
  .three-col,
  .ai-layout,
  .ops-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .nav,
  .focus-grid,
  .two-col,
  .three-col,
  .form-grid,
  .signal-list,
  .insight-grid,
  .ai-layout,
  .ops-layout,
  .list-card {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .date-pill {
    min-width: 0;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .chart {
    height: 210px;
  }

  .calendar-grid {
    gap: 5px;
  }

  .calendar-day {
    min-height: 82px;
    padding: 6px;
    border-radius: 12px;
  }

  .event-chip {
    font-size: 10px;
  }

  .filter-chip {
    width: 100%;
    justify-content: space-between;
  }

  .filter-chip select,
  .filter-chip input {
    max-width: 62%;
  }

  .filter-actions {
    width: 100%;
    margin-left: 0;
  }
}
