:root {
  --bg-0: #f3f3f4;
  --bg-1: #eeeeef;
  --bg-2: #e7e7e8;
  --card: #f7f7f8;
  --card-2: #f1f1f2;
  --ink: #171717;
  --muted: #6e7178;
  --accent: #1f7d52;
  --accent-2: #2f9f69;
  --danger: #d9536f;
  --ok: #3aa56c;
  --shadow: 0 12px 28px rgba(18, 22, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, rgba(31, 125, 82, 0.08), transparent 32%),
    radial-gradient(circle at bottom left, rgba(31, 125, 82, 0.06), transparent 32%),
    linear-gradient(130deg, var(--bg-0), var(--bg-1) 55%, var(--bg-2));
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(120deg, rgba(31, 125, 82, 0.05), rgba(47, 159, 105, 0.05));
}

.app-shell {
  width: calc(100vw - 2rem);
  max-width: none;
  margin: 1rem;
  position: relative;
  z-index: 1;
}

.card {
  background: linear-gradient(180deg, rgba(247, 247, 248, 0.97), rgba(241, 241, 242, 0.99));
  border: 1px solid rgba(28, 30, 34, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.auth-card {
  max-width: 450px;
  margin: 3rem auto;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
}

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

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 1rem 0;
}

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

button {
  border: none;
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button.secondary {
  background: #ffffff;
  color: #1d513a;
  border: 1px solid #c9d4ce;
}

button.ghost {
  background: #ffffff;
  color: #2d3b34;
  border: 1px solid #d7dcda;
}

button.danger {
  background: var(--danger);
}

.tabs button {
  background: #eceef0;
  color: #3f4643;
}

.tabs button.active {
  background: var(--accent);
  color: #fff;
}

form,
.row-wrap {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(23, 23, 23, 0.14);
  padding: 0.62rem;
  background: #ffffff;
  color: var(--ink);
}

.inline-input {
  display: flex;
  gap: 0.5rem;
}

.topbar,
.board-tools {
  margin-bottom: 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f2f3f4;
}

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

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.board-tools {
  display: grid;
  gap: 0.6rem;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 1rem;
}

.kanban-footer {
  margin-top: 0.65rem;
}

.deleted-link {
  color: #1f7d52;
  text-decoration: underline;
  font-weight: 600;
}

.column {
  padding: 0.8rem;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfbfb, #f3f4f4);
  border: 1px solid rgba(23, 23, 23, 0.08);
  min-height: 340px;
}

.column h3 {
  margin-bottom: 0.6rem;
}

.card-item {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  box-shadow: 0 3px 12px rgba(18, 22, 28, 0.07);
  padding: 0.7rem;
  margin-bottom: 0.55rem;
  animation: rise 0.24s ease;
}

.card-item p {
  margin: 0.35rem 0;
}

.card-item .meta {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.completed-tag {
  display: inline-block;
  margin-top: 0.4rem;
  background: rgba(58, 165, 108, 0.14);
  color: #206444;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.card-actions button {
  padding: 0.38rem 0.6rem;
  font-size: 0.8rem;
}

.client-kanban .card-actions {
  justify-content: flex-start;
}

.card-actions .delete-btn {
  background: #d95e75;
  color: #fff;
}

.card-actions .complete-btn {
  background: #1f7d52;
  color: #ffffff;
}

.error {
  color: var(--danger);
  min-height: 1.1rem;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(23, 23, 23, 0.24);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 20;
}

.modal-panel {
  width: min(720px, 96vw);
  max-height: 92vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.settings-grid {
  display: grid;
  gap: 0.9rem;
}

.settings-subpages {
  padding: 0.7rem;
}

.settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.settings-subnav-link {
  background: #eceef0;
  color: #3f4643;
  border: 1px solid #d4dbd7;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
}

.settings-subnav-link.active {
  background: #1f7d52;
  border-color: rgba(31, 125, 82, 0.44);
  color: #fff;
}

.member-list {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.member-pill {
  background: #eaf0ed;
  color: #2f4e40;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
}

.deleted-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.hub-shell {
  display: grid;
  gap: 1rem;
}

.hub-section {
  display: grid;
  gap: 0.8rem;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.6rem;
}

.widget-card {
  background: #ffffff;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 12px;
  padding: 0.65rem;
  display: grid;
  gap: 0.2rem;
}

.widget-card strong {
  font-size: 1.4rem;
}

.widget-grid .widget-card:first-child {
  background: linear-gradient(135deg, #1f7d52, #2d9a66);
  color: #fff;
}

.widget-grid .widget-card:first-child span,
.widget-grid .widget-card:first-child strong {
  color: #fff;
}

.simple-list {
  display: grid;
  gap: 0.45rem;
}

.list-row {
  background: #ffffff;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}

.role-row {
  display: grid;
  gap: 0.6rem;
}

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

.perm-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.45rem;
}

.perm-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  background: #f8f9fa;
  font-size: 0.8rem;
}

.sheet-wrap {
  overflow-x: auto;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 12px;
  background: #fff;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 760px;
}

.sheet-table th,
.sheet-table td {
  border: 1px solid rgba(23, 23, 23, 0.1);
  padding: 0.42rem 0.48rem;
  vertical-align: middle;
}

.sheet-table th {
  background: #f2f4f5;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  text-align: left;
}

.sheet-table td input,
.sheet-table td select {
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 8px;
  padding: 0.42rem;
  min-height: 2rem;
}

.mono-log {
  margin: 0.6rem 0 0;
  max-height: 260px;
  overflow: auto;
  background: #111418;
  color: #d8e1dd;
  border: 1px solid rgba(23, 23, 23, 0.2);
  border-radius: 10px;
  padding: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.3;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 0.6rem;
}

.full-row {
  grid-column: 1 / -1;
}

.brand-line {
  color: #4f7d67;
  margin: 0;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-home-link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 7px;
  flex: 0 0 auto;
}

.brand-wordmark {
  height: 1.15rem;
  width: auto;
  max-width: 155px;
}

.subapp-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.subapp-link {
  text-decoration: none;
  border: 1px solid #d4dbd7;
  background: #ffffff;
  color: #3a4540;
  border-radius: 12px;
  padding: 0.34rem 0.72rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subapp-link.active {
  border-color: rgba(31, 125, 82, 0.44);
  color: #ffffff;
  background: #1f7d52;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.app-tile {
  text-decoration: none;
  color: var(--ink);
  border-radius: 14px;
  border: 1px solid rgba(23, 23, 23, 0.08);
  background: #ffffff;
  padding: 0.9rem;
  display: grid;
  gap: 0.35rem;
}

.app-tile strong {
  color: #1b1b1b;
}

.app-icon {
  width: 1.85rem;
  height: 1.85rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(31, 125, 82, 0.22);
  background: #e7f2ec;
  color: #1f7d52;
  font-weight: 700;
}

.unified-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 0.95rem;
  align-items: start;
}

.unified-sidebar {
  min-height: 84vh;
  padding: 1rem 0.8rem;
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.unified-main {
  display: grid;
  gap: 0.85rem;
}

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

.page-title-wrap {
  display: grid;
  gap: 0.2rem;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0.95rem;
  align-items: start;
}

.dashboard-sidebar {
  min-height: 82vh;
  padding: 1rem 0.8rem;
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.subapp-nav.vertical {
  flex-direction: column;
  align-items: stretch;
}

.subapp-nav.vertical .subapp-link {
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.subapp-link-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(31, 125, 82, 0.1);
  color: #1f7d52;
  font-size: 0.76rem;
  font-weight: 700;
}

.subapp-link.active .subapp-link-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.unified-sidebar h3,
.dashboard-sidebar h3 {
  display: none;
}

.dashboard-main {
  display: grid;
  gap: 0.85rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-header-actions {
  display: flex;
  gap: 0.5rem;
}

.feature-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.metric-card {
  border-radius: 16px;
  padding: 1rem 1rem 0.9rem;
}

.metric-card .metric-label {
  font-weight: 500;
  color: #3f4643;
}

.metric-card strong {
  font-size: 2.45rem;
  line-height: 1;
  margin-top: 0.3rem;
}

.metric-card small {
  color: #6e7178;
  font-size: 0.78rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 0.8rem;
}

.panel {
  min-height: 220px;
}

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

.analytics-bars {
  margin-top: 0.7rem;
  display: flex;
  align-items: end;
  gap: 0.7rem;
  height: 190px;
}

.bar-wrap {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  flex: 1;
}

.bar-wrap span {
  font-size: 0.78rem;
  color: #73777d;
}

.bar {
  width: 100%;
  max-width: 36px;
  border-radius: 999px;
  background: repeating-linear-gradient(
    -45deg,
    #d6d9d8,
    #d6d9d8 4px,
    #eff0ef 4px,
    #eff0ef 8px
  );
}

.bar.active {
  background: linear-gradient(180deg, #2fa56a, #1f7d52);
}

.compact-list .list-row.minimal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.subtask-row {
  display: grid;
  gap: 0.45rem;
}

.subtask-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.subtask-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
}

.subtask-status-pill {
  border-radius: 999px;
  border: 1px solid rgba(31, 125, 82, 0.3);
  background: rgba(31, 125, 82, 0.1);
  color: #1f7d52;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
}

.subtask-progress {
  height: 8px;
  border-radius: 999px;
  background: #e4e7e8;
  overflow: hidden;
}

.subtask-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2f9f69, #1f7d52);
}

.subtask-row-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.subtask-row-actions select {
  max-width: 170px;
}

.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.client-card {
  background: #ffffff;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 14px;
  padding: 0.8rem;
  display: grid;
  gap: 0.45rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.client-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(18, 22, 28, 0.08);
}

.client-card-head {
  display: grid;
  gap: 0.2rem;
  justify-items: start;
}

.client-card-logo {
  width: 100%;
  max-width: 220px;
  height: 72px;
  border-radius: 0;
  object-fit: contain;
  object-position: center;
  border: none;
  background: transparent;
}

.client-card-logo.fallback {
  border: none;
  display: grid;
  place-items: center;
  color: #1f7d52;
  font-weight: 700;
  background: transparent;
}

.client-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  object-position: center;
  border: 1px solid rgba(23, 23, 23, 0.1);
  background: #fff;
  margin-right: 0.5rem;
}

.client-logo.fallback {
  display: inline-grid;
  place-items: center;
  color: #1f7d52;
  font-weight: 700;
  background: #e8f2ed;
}

.member-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.member-choice {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 10px;
  padding: 0.4rem 0.55rem;
}

.client-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.client-col {
  min-height: 72vh;
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.activity-tree-card {
  display: grid;
  gap: 0.4rem;
}

.activity-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.subtask-tree {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
}

.subtask-tree-item {
  border-left: 2px solid #d8e8df;
  padding-left: 0.55rem;
}

.calendar-sync-panel {
  display: grid;
  gap: 0.7rem;
}

.calendar-board {
  display: grid;
  gap: 0.8rem;
}

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

.calendar-cell {
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 12px;
  background: #fcfcfc;
}

.calendar-cell-head {
  padding: 0.45rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  background: #eff1f2;
}

.calendar-cell-empty {
  border-style: dashed;
  background: transparent;
  min-height: 108px;
}

.calendar-day {
  min-height: 108px;
  padding: 0.5rem;
  display: grid;
  gap: 0.35rem;
  align-content: start;
}

.calendar-day.is-today {
  background: linear-gradient(180deg, #e8f5ee, #dff1e8);
  border-color: rgba(31, 125, 82, 0.72);
  box-shadow: inset 0 0 0 1px rgba(31, 125, 82, 0.26), 0 8px 18px rgba(31, 125, 82, 0.09);
}

.calendar-day.is-past {
  background: #f3f4f5;
  border-color: rgba(23, 23, 23, 0.08);
  opacity: 0.72;
}

.calendar-day.is-past .calendar-day-num {
  color: #6d737a;
}

.calendar-day-num {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

.calendar-day-events {
  display: grid;
  gap: 0.25rem;
}

.calendar-chip {
  background: #e4f2eb;
  color: #1e6945;
  border: 1px solid #c4e4d4;
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  font-size: 0.74rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-chip.muted {
  background: #f1f2f3;
  color: #656c74;
  border-color: #dadde0;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  background: #f8f8f9;
  font-size: 0.83rem;
}

.calendar-dot {
  display: inline-block;
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.error-inline {
  color: #b64860;
  margin-left: 0.2rem;
}

.month-events-accordion summary {
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  list-style: none;
}

.month-events-accordion summary::-webkit-details-marker {
  display: none;
}

.month-events-accordion summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.4rem;
  color: #2b5f46;
}

.month-events-accordion[open] summary::before {
  content: '▾';
}

.month-events-accordion .simple-list {
  margin-top: 0.7rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .topbar {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

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

  .unified-shell {
    grid-template-columns: 1fr;
  }

  .unified-sidebar {
    min-height: auto;
    position: static;
  }

  .dashboard-sidebar {
    min-height: auto;
    position: static;
  }

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

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

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

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

  .perm-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

}
