:root {
  --bg: #eef3f9;
  --bg-strong: #dbe7f4;
  --bg-deep: #c8d8eb;
  --bg-accent: #f7efe7;
  --panel: #ffffff;
  --panel-soft: #f5faff;
  --text: #10233f;
  --muted: #60718b;
  --line: #d3dfef;
  --brand: #0f69cf;
  --brand-deep: #0a3f8f;
  --brand-soft: #e5f0ff;
  --brand-glow: rgba(15, 105, 207, 0.2);
  --success: #16814b;
  --warning: #c27b16;
  --danger: #bf2f2f;
  --shadow: 0 18px 50px rgba(8, 50, 112, 0.12);
  --shadow-soft: 0 10px 24px rgba(10, 63, 143, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(15, 105, 207, 0.16), transparent 20%),
    radial-gradient(circle at bottom left, rgba(197, 149, 92, 0.12), transparent 24%),
    linear-gradient(145deg, var(--bg), #f8fbff 38%, var(--bg-strong) 72%, var(--bg-deep)),
    var(--bg);
  font-family: "Bahnschrift", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 18px;
  border-radius: 36px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08));
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

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

button {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 160ms ease, filter 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(10, 63, 143, 0.16);
  filter: saturate(1.05);
}

button.secondary,
.importLabel {
  background: #fff;
  color: var(--brand-deep);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

button.dangerGhost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(15, 105, 207, 0.55);
  box-shadow: 0 0 0 4px var(--brand-glow);
  background: #fff;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.feedback {
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  color: var(--brand-deep);
}

.authShell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px;
  position: relative;
  z-index: 1;
}

.authPanel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: start;
}

.authBrand,
.authForm,
.resetBox {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.authBrand {
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.authBrand::after {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 105, 207, 0.16), transparent 70%);
}

.authLogoWrap {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(145deg, var(--brand), var(--brand-deep));
  box-shadow: 0 20px 40px rgba(12, 103, 206, 0.25);
  margin-bottom: 18px;
}

.authLogo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: #fff;
  border-radius: 18px;
  padding: 4px;
}

.authBrand h1,
.hero h2,
.panelHead h3 {
  margin: 0;
  font-family: "Trebuchet MS", "Bahnschrift", sans-serif;
  letter-spacing: -0.02em;
}

.authText,
.heroText,
.panelHead p,
.sidebarMeta p {
  color: var(--muted);
}

.authForm,
.resetBox {
  padding: 22px;
  display: grid;
  gap: 12px;
}

.authActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.resetBox h2 {
  margin: 0;
  font-size: 18px;
}

.appShell {
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-columns: 292px 1fr;
  width: min(1560px, calc(100% - 36px));
  margin: 18px auto;
  border-radius: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 28px 60px rgba(8, 50, 112, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  position: relative;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 20px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(8, 43, 98, 0.98), rgba(8, 63, 146, 0.98)),
    var(--brand-deep);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: 12px 0 34px rgba(10, 34, 77, 0.14);
}

.sidebarBrand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 6px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebarLogo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  padding: 4px;
}

.navList {
  display: grid;
  gap: 8px;
}

.navItem {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 13px 14px;
  position: relative;
}

.navItem.is-active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  border-color: rgba(255, 255, 255, 0.3);
}

.navItem.is-active::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 5px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  transform: translateY(-50%);
}

.sidebarMeta {
  margin-top: auto;
}

.mainShell {
  padding: 28px;
  display: grid;
  gap: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04)),
    transparent;
}

.hero,
.panel,
.statCard {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -120px;
  top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 105, 207, 0.18), transparent 68%);
}

.heroActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.importLabel {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
}

.importLabel input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.statsGrid,
.dashboardGrid {
  display: grid;
  gap: 16px;
}

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

.statCard {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.statCard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-deep));
}

.statCard:nth-child(2)::before {
  background: linear-gradient(90deg, #0ca6b8, #0a7280);
}

.statCard:nth-child(3)::before {
  background: linear-gradient(90deg, #8a61ff, #5b3bc6);
}

.statCard:nth-child(4)::before {
  background: linear-gradient(90deg, #1aa756, #0d7f3d);
}

.statCard span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.statCard strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  color: var(--brand-deep);
}

.compactStats {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
}

.compactStats .statCard {
  border-radius: 18px;
  box-shadow: none;
}

.compactStats .statCard strong {
  font-size: 24px;
}

.dashboardGrid {
  grid-template-columns: 1.2fr 0.8fr;
}

.reportsTopGrid {
  align-items: start;
}

.sideStack {
  display: grid;
  gap: 16px;
  align-self: start;
}

.clientsGrid {
  align-items: start;
}

.panel {
  padding: 22px;
}

.panelHead {
  margin-bottom: 16px;
}

.panelHeadInline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.panelHead p {
  margin: 6px 0 0;
}

.pipelineGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.pipelineItem {
  padding: 16px;
  border-radius: 20px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  min-height: 110px;
}

.pipelineItem span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.pipelineItem strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.alertsList {
  display: grid;
  gap: 10px;
}

.alertItem {
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 16px;
  background: #fff;
}

.alertItem.warning {
  border-left-color: var(--warning);
}

.alertItem.danger {
  border-left-color: var(--danger);
}

.floatingWhatsPanel {
  position: sticky;
  top: 24px;
  padding: 8px 0 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  opacity: 0.92;
}

.floatingWhatsIconBtn {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.floatingWhatsIcon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

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

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: 1 / -1;
}

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

.reportFilters {
  margin-bottom: 16px;
}

.reportSummaryGrid {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
}

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

.reportBlock {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(245, 250, 255, 0.95), rgba(255, 255, 255, 0.9));
}

.reportBlock h4 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--brand-deep);
}

.reportMiniList {
  display: grid;
  gap: 10px;
}

.reportMiniItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.reportMiniItem span {
  color: var(--muted);
  font-size: 13px;
}

.reportMiniItem strong {
  color: var(--brand-deep);
  font-size: 18px;
}

.formActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tableWrap {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(211, 223, 239, 0.75);
  background: rgba(255, 255, 255, 0.72);
}

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

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(245, 250, 255, 0.88);
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:hover {
  background: rgba(15, 105, 207, 0.04);
}

.rowActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.miniBtn {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.miniBtn.secondary {
  background: #fff;
}

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

.waLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 9px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1aa756, #0d7f3d);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(13, 127, 61, 0.22);
}

.whatsappBtn {
  background: linear-gradient(135deg, #1aa756, #0d7f3d);
  color: #fff;
  box-shadow: 0 12px 24px rgba(13, 127, 61, 0.22);
}

.docList,
.automationList {
  display: grid;
  gap: 10px;
}

.historyBlock {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.historyList {
  display: grid;
  gap: 10px;
}

.historyItem {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.historyItem strong {
  display: block;
  margin-bottom: 4px;
}

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

.docItem,
.automationItem {
  padding: 15px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: var(--shadow-soft);
}

.docItem strong,
.automationItem strong {
  display: block;
  margin-bottom: 4px;
}

.skillBlock {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.docMeta,
.automationMeta {
  color: var(--muted);
  font-size: 13px;
}

.itemActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.textBtn {
  background: transparent;
  color: var(--brand-deep);
  padding: 0;
  border: 0;
}

.badgeLine {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
}

.externalLinkBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 13px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.stackForm {
  display: grid;
  gap: 12px;
}

@media (max-width: 1180px) {
  .appShell,
  .authPanel,
  .dashboardGrid {
    grid-template-columns: 1fr;
  }

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

  .appShell {
    width: min(100%, calc(100% - 24px));
    margin: 12px auto;
    min-height: calc(100vh - 24px);
    border-radius: 26px;
  }

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

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

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

  .pipelineGrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .mainShell,
  .sidebar,
  .authShell {
    padding: 16px;
  }

  body::before {
    inset: 8px;
    border-radius: 22px;
  }

  .appShell {
    width: calc(100% - 12px);
    margin: 6px auto;
    min-height: calc(100vh - 12px);
    border-radius: 20px;
  }

  .hero,
  .panel,
  .authBrand,
  .authForm,
  .resetBox {
    border-radius: 18px;
  }

  .statsGrid,
  .formGrid,
  .dynamicFields,
  .pipelineGrid {
    grid-template-columns: 1fr;
  }

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

  .span-2,
  .span-4 {
    grid-column: auto;
  }

  .panelHeadInline,
  .hero {
    flex-direction: column;
    align-items: stretch;
  }
}
