﻿:root {
  --bg: #f3f5f1;
  --panel: #ffffff;
  --panel-soft: #eef3ef;
  --text: #172322;
  --muted: #627170;
  --accent: #0e7a71;
  --accent-mist: #e9f5f2;
  --accent-soft: #d6f0ed;
  --warn: #c36a14;
  --warn-soft: #ffe8cf;
  --danger: #b6442f;
  --danger-soft: #ffe2db;
  --line: #d6dfdd;
  --shadow: 0 12px 30px rgba(20, 38, 36, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(156deg, #f4fbf8 0%, #e9f5f2 46%, #f8fbfa 100%);
  min-height: 100vh;
  position: relative;
}

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

.app-bg-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.22;
  pointer-events: none;
}

.app-bg-glow-a {
  width: 380px;
  height: 380px;
  background: #c2eadf;
  top: -110px;
  right: -80px;
}

.app-bg-glow-b {
  width: 340px;
  height: 340px;
  background: #ffd7b3;
  bottom: -120px;
  left: -90px;
}

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

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1c9a8f 0%, #0d6e66 56%, #0f544f 100%);
  border: 1px solid #94d4cd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 16px rgba(14, 122, 113, 0.28);
}

.brand-mark::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 999px;
  top: -28px;
  right: -24px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0) 62%);
}

.mark-main {
  position: relative;
  z-index: 1;
  font-size: 16px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ecfffb;
}

.mark-sub {
  position: relative;
  z-index: 1;
  font-size: 8px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #d1f4ef;
}

.brand-overline {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.12em;
}

.brand-wrap h1 {
  font-size: 18px;
  font-family: "Fraunces", serif;
  line-height: 1.15;
}

.brand-caption {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  text-align: left;
  border: 1px solid transparent;
  background: var(--panel-soft);
  color: #1b2f2d;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-item:hover,
.nav-item:focus-visible {
  border-color: #9acfc8;
  background: #f1f8f6;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #cde8e5 100%);
  border-color: #96cfc7;
}

.endpoint-box {
  margin-top: auto;
  padding: 14px;
  background: #f4f8f7;
}

.small-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin-bottom: 8px;
}

.endpoint-box code {
  display: block;
  background: #12302d;
  color: #d8f5ef;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
}

.tiny {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.main-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.topbar {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(145deg, rgba(222, 242, 238, 0.68) 0%, rgba(255, 255, 255, 0.92) 58%);
}

.kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  margin-bottom: 4px;
}

#viewTitle {
  font-family: "Fraunces", serif;
  font-size: 31px;
  line-height: 1;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  min-width: 275px;
  color: var(--text);
}

input[type="search"].active-search {
  border-color: #86c7c0;
  background: #f7fcfb;
  box-shadow: 0 0 0 3px rgba(134, 199, 192, 0.2);
}

input[type="search"]:focus-visible {
  outline: 2px solid #93cbc4;
  outline-offset: 2px;
}

.search-clear-btn {
  white-space: nowrap;
}

.search-clear-btn:disabled {
  opacity: 0.46;
  cursor: not-allowed;
  background: #f6faf9;
}

.clock {
  font-weight: 700;
  color: #224745;
  background: #ecf6f4;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 152px;
  text-align: center;
}

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

.kpi-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid #e7eded;
  box-shadow: 0 8px 18px rgba(19, 37, 35, 0.05);
}

.kpi-card-actionable {
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.kpi-card-actionable:hover,
.kpi-card-actionable:focus-visible {
  border-color: #99ccc5;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(18, 57, 53, 0.08);
}

.kpi-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}

.kpi-meta {
  font-size: 12px;
  color: var(--muted);
}

.kpi-cta {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1e6560;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  min-height: 0;
  flex: 1;
}

body[data-view]:not([data-view="dashboard"]) .kpi-grid {
  display: none;
}

body[data-view]:not([data-view="dashboard"]) .content-grid {
  grid-template-columns: 1fr;
}

body[data-view]:not([data-view="dashboard"]) .activity {
  display: none;
}

.main-view {
  padding: 18px;
  min-height: 0;
}

.activity {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.section-head h3 {
  font-size: 19px;
  font-family: "Fraunces", serif;
}

.section-note {
  color: var(--muted);
  font-size: 13px;
}

.view-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.view-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.view-toolbar label span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.view-toolbar select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
}

.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  padding: 7px 11px;
  font-size: 12px;
  color: #2b4442;
  cursor: pointer;
}

.ghost-btn:hover {
  background: #f3f8f7;
}

.activity-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  max-height: calc(100vh - 285px);
}

.activity-feed li {
  border: 1px solid #e5ecea;
  border-radius: 10px;
  padding: 10px;
  background: #fbfdfc;
}

.activity-feed strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

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

.view-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.owner-flow-card {
  border: 1px solid #deebe8;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(145deg, #f6fcfa 0%, #ffffff 100%);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.owner-flow-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3b5452;
  font-weight: 800;
}

.owner-flow-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
  min-height: 36px;
}

.owner-flow-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.stack-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-list li {
  border: 1px solid #e4ebea;
  border-radius: 12px;
  padding: 12px;
  background: #fcfefd;
}

.stack-list p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.stack-list .queue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stack-list .queue-row select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  background: #fff;
  color: var(--text);
}

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

.kanban-col {
  background: #f5f9f8;
  border: 1px solid #deeaeb;
  border-radius: 12px;
  padding: 10px;
}

.kanban-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.kanban-head h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #29403f;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.badge-neutral {
  background: #ebf2f1;
  color: #294341;
}

.badge-good {
  background: var(--accent-soft);
  color: #1b5c56;
}

.badge-warn {
  background: var(--warn-soft);
  color: #8a4a0c;
}

.badge-danger {
  background: var(--danger-soft);
  color: #8d3829;
}

.lead-card {
  border: 1px solid #dce8e6;
  border-radius: 10px;
  background: white;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 8px;
}

.lead-card:last-child {
  margin-bottom: 0;
}

.lead-top {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.lead-card strong {
  font-size: 14px;
}

.lead-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.lead-card select {
  border: 1px solid #ccd8d6;
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
  background: #fbfdfd;
}

.lead-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lead-btn {
  border: 1px solid #d0dcd9;
  border-radius: 8px;
  background: #fff;
  color: #295250;
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
}

.lead-btn:hover {
  background: #eff7f5;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e6eceb;
  text-align: left;
  font-size: 13px;
}

th {
  color: #405655;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.row-flag {
  font-weight: 800;
  color: #234441;
}

.inline-btn {
  border: 1px solid #b9d5d1;
  border-radius: 8px;
  background: #edf8f6;
  color: #1d5f59;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
  cursor: pointer;
}

.inline-btn:hover {
  background: #daf1ed;
}

.chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.aging-card {
  border: 1px solid #dfe9e8;
  border-radius: 12px;
  padding: 10px;
  background: #fbfdfd;
}

.aging-card p {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.aging-card strong {
  display: block;
  font-size: 22px;
  line-height: 1.05;
}

.client-insights {
  border: 1px solid #deebe9;
  border-radius: 12px;
  background: #f9fcfb;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.client-insights.hidden {
  display: none;
}

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

.insight-card {
  border: 1px solid #dfe9e7;
  border-radius: 10px;
  padding: 9px;
  background: #fff;
}

.insight-card p {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.insight-card strong {
  font-size: 17px;
}

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

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tasks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.task-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  border: 1px solid #cfddda;
  background: #f4f9f8;
  color: #2e4b49;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.filter-chip.active {
  border-color: #90c9c2;
  background: #dcf3ef;
  color: #175b55;
}

.task-assignee-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}

.task-assignee-wrap select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 12px;
  color: var(--text);
  background: #fff;
}

.task-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #e5ecea;
  border-radius: 12px;
  padding: 10px;
  background: #fbfdfd;
}

.task-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.task-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.task-copy strong {
  font-size: 14px;
}

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

.task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.task-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.task-action-btn {
  border: 1px solid #d5dfdd;
  border-radius: 8px;
  background: #fff;
  color: #2b4644;
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
}

.task-action-btn:hover {
  background: #f2f7f6;
}

.task-action-btn.delete {
  border-color: #e5c1b7;
  color: #9f3a25;
  background: #fff6f3;
}

.task-action-btn.delete:hover {
  background: #ffe9e2;
}

.task-form {
  border: 1px solid #dfebe9;
  border-radius: 12px;
  padding: 12px;
  background: #f8fcfb;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-form.hidden {
  display: none;
}

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

.task-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-form label span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.task-form input,
.task-form select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
}

.task-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.done strong,
.done span {
  text-decoration: line-through;
  color: #8b9998;
}

@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .activity-feed {
    max-height: 250px;
  }
}

@media (max-width: 1050px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    min-height: auto;
  }

  .sidebar {
    order: 0;
  }

  .main-area {
    order: 1;
  }

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

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

  input[type="search"] {
    min-width: 0;
    flex: 1;
  }

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

  .owner-flow-grid {
    grid-template-columns: 1fr;
  }

  .split.two,
  .kanban,
  .form-grid,
  .aging-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .task-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .task-actions {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
    gap: 10px;
  }

  #viewTitle {
    font-size: 24px;
  }

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