:root {
  --green: #6f351f;
  --green-2: #925033;
  --yellow: #c89255;
  --blue: #8b4930;
  --blue-2: #ad7352;
  --ink: #3d271d;
  --muted: #7b6255;
  --bg: #f2ebe4;
  --panel: #fffaf5;
  --line: #ddc8b8;
  --soft: #eadbd0;
  --red: #a63e35;
  --shadow: 0 10px 26px rgba(77, 43, 28, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(177, 112, 69, 0.13), rgba(242, 235, 228, 0.35) 260px),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  letter-spacing: 0;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 11px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
}

button {
  background: var(--green);
  color: #fffaf5;
  cursor: pointer;
}

button:hover {
  background: var(--green-2);
}

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

.hidden {
  display: none !important;
}

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

.eyebrow {
  display: block;
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.headline-sub {
  display: block;
  margin-top: 3px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(580px, 100%);
  background:
    linear-gradient(180deg, rgba(236, 215, 195, 0.98), rgba(255, 249, 242, 0.98)),
    #f2dfcd;
  border: 1px solid var(--line);
  border-top: 5px solid var(--yellow);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

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

.login-card h1,
.dash-header h1 {
  margin: 0;
  color: var(--green);
  font-size: 1.65rem;
  line-height: 1.12;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.login-copy {
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 850;
}

.login-form input {
  min-height: 42px;
  background: #fffaf5;
}

.error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 850;
}

.page {
  width: min(1680px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.dash-header {
  display: grid;
  grid-template-columns: minmax(430px, 0.8fr) minmax(720px, 1.2fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
  background:
    linear-gradient(180deg, rgba(236, 215, 195, 0.98), rgba(255, 249, 242, 0.98)),
    #f2dfcd;
  border: 1px solid var(--line);
  border-top: 5px solid var(--yellow);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.header-brand {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.header-logo {
  display: block;
  width: 98px;
  max-height: 70px;
  object-fit: contain;
}

.header-tools {
  min-width: 0;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.controls select,
.controls input {
  min-width: 118px;
  background: #fffaf5;
  border-color: #cfb6a3;
}

.controls input[type="date"] {
  min-width: 142px;
}

.clear-btn {
  min-width: 36px;
  padding: 0;
  font-size: 1rem;
}

.link-btn {
  min-height: 26px;
  padding: 0 8px;
  background: transparent;
  border-color: transparent;
  color: var(--green);
}

.header-context {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-align: right;
  flex-wrap: wrap;
}

.header-context strong {
  color: var(--green);
}

.capture-area,
.funnel-accordion,
.insight-accordion,
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.capture-area {
  padding: 12px;
  margin-bottom: 12px;
}

.executive-heading,
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--green);
  font-size: 0.96rem;
  font-weight: 900;
}

.section-title {
  margin: 0;
  color: var(--green);
  font-size: 1.08rem;
  text-transform: uppercase;
}

.panel-title small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.image-action {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: block;
  object-fit: contain;
  cursor: pointer;
}

.image-action:hover,
.copy-action:hover {
  opacity: 0.78;
}

.copy-action {
  width: 32px;
  height: 32px;
  min-width: 32px;
  cursor: pointer;
  display: block;
  object-fit: contain;
}

.copy-ok {
  opacity: 0.48 !important;
}

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

.executive-card {
  min-height: 126px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #fffdf9;
}

.executive-card .main-value {
  display: block;
  color: var(--green);
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1.12;
}

.executive-card .main-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.28;
}

.delta-up {
  color: #0b7a3a;
  font-weight: 850;
}

.delta-down {
  color: var(--red);
  font-weight: 850;
}

.delta-neutral {
  color: var(--muted);
  font-weight: 850;
}

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

.panel {
  padding: 12px;
}

.chart-small {
  height: 250px;
}

.chart-wrap {
  height: 330px;
}

.chart-wide {
  height: 360px;
}

.funnel-accordion,
.insight-accordion {
  margin-bottom: 12px;
  overflow: hidden;
}

.funnel-accordion summary,
.insight-accordion summary {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--green);
  font-size: 1.04rem;
  font-weight: 900;
  list-style: none;
}

.funnel-accordion summary::-webkit-details-marker,
.insight-accordion summary::-webkit-details-marker {
  display: none;
}

.funnel-accordion summary::before,
.insight-accordion summary::before {
  content: "▸";
  flex: 0 0 auto;
  margin-right: 9px;
  color: var(--green);
  font-size: 1.05rem;
  transition: transform 0.18s ease;
}

.funnel-accordion[open] summary::before,
.insight-accordion[open] summary::before {
  transform: rotate(90deg);
}

.funnel-accordion summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.7rem;
}

.funnel-body,
.insight-accordion-body {
  padding: 0 12px 12px;
}

.funnel-save-row {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}

.channel-grid {
  display: grid;
  grid-template-columns: 132px repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ask-strip {
  display: grid;
  grid-template-columns: 170px repeat(5, minmax(140px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  margin-bottom: 12px;
}

#askStrip {
  background: linear-gradient(90deg, rgba(0, 127, 120, 0.18), rgba(226, 247, 243, 0.92));
  border-color: rgba(0, 127, 120, 0.24);
}

#ecommerceStrip {
  background: linear-gradient(90deg, rgba(57, 91, 168, 0.18), rgba(232, 240, 255, 0.94));
  border-color: rgba(57, 91, 168, 0.25);
}

#comercialStrip {
  background: linear-gradient(90deg, rgba(139, 111, 0, 0.19), rgba(255, 246, 210, 0.95));
  border-color: rgba(139, 111, 0, 0.28);
}

.stage-label,
.channel-card,
.channel-head,
.ask-label {
  border-radius: 8px;
  border: 1px solid var(--line);
}

.stage-label,
.ask-label {
  min-height: 86px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.22;
}

.stage-label {
  background: var(--green);
  color: #fffdf4;
}

.ask-label {
  background: #e2f7f3;
  color: #5a4b0a;
}

.ecommerce-label {
  background: #e8f0ff;
  color: #173d7a;
}

.comercial-label {
  background: #fff0bc;
  color: #5f4b00;
}

.channel-head {
  min-height: 52px;
  padding: 9px 10px;
  color: #fff;
  font-weight: 900;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
}

.channel-card {
  position: relative;
  min-height: 86px;
  padding: 10px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(24, 33, 27, 0.05);
  text-align: center;
}

.channel-card h3 {
  margin: 0 0 6px;
  font-size: 0.66rem;
  text-transform: uppercase;
  line-height: 1.22;
  color: inherit;
}

.channel-card .value {
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.channel-card .sub {
  margin-top: 5px;
  color: inherit;
  font-size: 0.7rem;
  line-height: 1.24;
}

.google { --lane: #174ea6; --lane-soft: #eaf1ff; }
.meta { --lane: #0b6b3a; --lane-soft: #e8f5ee; }
.ask { --lane: #007f78; --lane-soft: #e3f6f3; }
.crm { --lane: #2f6ed3; --lane-soft: #eaf2ff; }
.site { --lane: #d1aa28; --lane-soft: #fff7d2; }
.gmn { --lane: #1f8f68; --lane-soft: #e5f6ee; }
.ecommerce { --lane: #315fa8; --lane-soft: #e8f0ff; }
.comercial { --lane: #8b6f00; --lane-soft: #fff0bc; }

.channel-head.google,
.channel-head.meta,
.channel-head.ask,
.channel-head.crm,
.channel-head.site,
.channel-head.gmn,
.channel-head.ecommerce,
.channel-head.comercial {
  background: var(--lane);
}

.channel-card.google,
.channel-card.meta,
.channel-card.ask,
.channel-card.crm,
.channel-card.site,
.channel-card.gmn,
.channel-card.ecommerce,
.channel-card.comercial {
  background: var(--lane-soft);
  border-color: color-mix(in srgb, var(--lane) 28%, white);
}

.channel-card strong {
  color: var(--lane);
}

.channel-grid .channel-card.stage-1 { background: color-mix(in srgb, var(--lane) 34%, white) !important; }
.channel-grid .channel-card.stage-2 { background: color-mix(in srgb, var(--lane) 25%, white) !important; }
.channel-grid .channel-card.stage-3 { background: color-mix(in srgb, var(--lane) 17%, white) !important; }
.channel-grid .channel-card.stage-4 { background: color-mix(in srgb, var(--lane) 9%, white) !important; }
.channel-grid .channel-card.stage-5 { background: color-mix(in srgb, var(--lane) 6%, white) !important; }

.stage-label.stage-1 { background: #58301f; }
.stage-label.stage-2 { background: #70412c; }
.stage-label.stage-3 { background: #8b5b43; }
.stage-label.stage-4 { background: #a97b62; }
.stage-label.stage-5 { background: #bf947a; }

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 12px;
}

.insight-text {
  white-space: pre-line;
  font-size: 0.98rem;
  line-height: 1.5;
}

.filter-pill {
  display: inline-block;
  margin: 0 5px 7px 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e9f4df;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 850;
}

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

.status-card {
  min-height: 108px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #fffdf9;
}

.status-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
}

.status-card small {
  color: var(--muted);
  font-weight: 750;
}

.status-pill {
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #efe1d5;
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(520px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.panel-wide {
  margin-bottom: 12px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  max-height: 382px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.66rem;
}

th,
td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #efe1d5;
  color: var(--green);
  font-size: 0.62rem;
  text-transform: uppercase;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
  font-weight: 850;
}

tbody tr:nth-child(even) {
  background: #fffaf5;
}

tbody tr:nth-child(odd) {
  background: #f5eae1;
}

tbody tr:hover {
  background: #ead3c2;
}

@media (max-width: 1250px) {
  .dash-header,
  .grid-main,
  .insight-grid,
  .executive-charts {
    grid-template-columns: 1fr;
  }

  .channel-grid {
    grid-template-columns: 120px repeat(5, minmax(150px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

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

@media (max-width: 760px) {
  .page {
    width: calc(100% - 12px);
  }

  .login-brand,
  .executive-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    justify-content: center;
  }

  .dash-header h1,
  .login-card h1 {
    font-size: 1.18rem;
  }

  .header-context {
    align-items: flex-start;
    flex-direction: column;
    text-align: left;
  }

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