:root {
  --bg: #eef0ee;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --ink: #111820;
  --muted: #7a8088;
  --soft: #f6f3ef;
  --line: rgba(20, 28, 34, 0.08);
  --accent: #ee6b43;
  --accent-dark: #11151c;
  --green: #2d8a63;
  --blue-soft: #d8e6ff;
  --orange-soft: #ffe6c8;
  --lavender-soft: #eee8ff;
  --shadow: 0 24px 70px rgba(31, 38, 51, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 10%, rgba(159, 204, 255, 0.5), transparent 28%),
    radial-gradient(circle at 82% 8%, rgba(232, 196, 255, 0.45), transparent 30%),
    linear-gradient(135deg, #eef2f2 0%, #f7f2ec 52%, #eef2f9 100%);
  color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ambient {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
}

.ambient-one {
  width: 720px;
  height: 720px;
  left: -170px;
  top: -250px;
}

.ambient-two {
  width: 860px;
  height: 860px;
  right: -260px;
  bottom: -390px;
}

.sidebar {
  position: fixed;
  inset: 22px auto 22px 24px;
  z-index: 2;
  width: 214px;
  padding: 18px;
  color: #1a2025;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 18px 60px rgba(24, 31, 44, 0.08);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  margin-bottom: 32px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 850;
  background: linear-gradient(135deg, #6f5cff, var(--accent));
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  box-shadow: 0 10px 24px rgba(238, 107, 67, 0.22);
}

.brand strong,
.brand small,
.sidebar-foot strong,
.sidebar-foot small {
  display: block;
}

.brand strong { font-size: 13px; letter-spacing: -0.02em; }
.brand small,
.sidebar-foot small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

nav { display: grid; gap: 6px; }
.nav-label {
  margin: 0 0 4px 10px;
  color: #b3b5b8;
  font-size: 11px;
}

nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 999px;
  color: #6f757b;
  text-decoration: none;
  font-weight: 720;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

nav a span { font-size: 10px; }
nav a:hover { transform: translateX(2px); color: var(--ink); background: rgba(17, 24, 32, 0.05); }
nav a.active { background: var(--accent-dark); color: #fff; }

.sidebar-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #45c880;
  box-shadow: 0 0 0 5px rgba(69, 200, 128, 0.16);
}

.workspace {
  position: relative;
  z-index: 1;
  margin-left: 250px;
  padding: 22px 28px 46px 18px;
  max-width: 1540px;
}

.topbar {
  height: 62px;
  margin-bottom: 18px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(20px);
  box-shadow: 0 16px 50px rgba(18, 25, 35, 0.08);
}

.search-shell {
  min-width: min(460px, 58vw);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border-radius: 999px;
  background: #f5f5f2;
  color: var(--muted);
}

.search-shell input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

kbd {
  padding: 3px 7px;
  border-radius: 8px;
  background: #fff;
  color: #a0a3a8;
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sync-pill,
.date-chip,
.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #68707a;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 720;
}

.avatar { width: 38px; height: 38px; border-radius: 50%; font-size: 12px; }

.basis-switch {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.basis-switch a {
  min-width: 78px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #68707a;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 780;
}

.basis-switch a.active {
  background: var(--accent-dark);
  color: #fff;
}

.upload-entry {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: -12px 0 18px;
}

.upload-entry form { margin: 0; }

.upload-pill {
  display: inline-grid;
  place-items: center;
  min-width: 154px;
  height: 58px;
  padding: 0 30px;
  border: 1px solid rgba(17, 24, 32, 0.1);
  border-radius: 999px;
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 16px 34px rgba(17, 21, 28, 0.16);
  cursor: pointer;
  font-size: 18px;
  font-weight: 860;
  letter-spacing: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.upload-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 42px rgba(17, 21, 28, 0.2);
}

.upload-pill input { display: none; }

.upload-copy {
  display: grid;
  gap: 2px;
}

.upload-copy strong {
  font-size: 13px;
}

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

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.flash-message {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: #4d555c;
  font-size: 13px;
  font-weight: 680;
}

.flash-message.success {
  border-color: rgba(45, 138, 99, 0.22);
  background: rgba(227, 244, 234, 0.86);
  color: #246b4d;
}

.flash-message.error {
  border-color: rgba(216, 111, 95, 0.22);
  background: rgba(255, 237, 233, 0.88);
  color: #9d3e31;
}

.content-frame {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.page-head,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.page-head { margin-bottom: 24px; }
.section-head { align-items: end; margin-bottom: 18px; }

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -0.035em;
}

.subline,
.section-head small { color: var(--muted); }

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

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

.metric-card {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.metric-card:hover,
tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(20, 27, 38, 0.08);
}

.metric-card.warm { background: var(--orange-soft); }
.metric-card.cool { background: var(--blue-soft); }
.metric-card.neutral { background: var(--lavender-soft); }
.metric-card.dark { background: var(--accent-dark); color: #fff; }
.metric-card.dark span,
.metric-card.dark small { color: rgba(255, 255, 255, 0.68); }

.metric-card span,
.metric-card small,
.daily-band span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 640;
}

.metric-card strong {
  display: block;
  margin-top: 18px;
  font-size: 34px;
  letter-spacing: -0.07em;
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.68fr) minmax(260px, 0.72fr);
  gap: 14px;
  margin-bottom: 14px;
}

.trend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 14px;
  margin-bottom: 14px;
}

.chart-region,
.side-region,
.table-region,
.detail-grid > div {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 22px;
  box-shadow: 0 10px 30px rgba(25, 32, 43, 0.04);
}

.chart-region { height: 360px; }
.chart-region canvas { height: 270px !important; margin-top: 4px; }
.trend-panel {
  height: 640px;
  padding: 28px 30px 24px;
}

.trend-panel canvas {
  height: 380px !important;
  margin-top: 2px;
}

.trend-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.trend-detail div {
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid rgba(20, 28, 34, 0.06);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.54);
}

.trend-detail span,
.trend-detail small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.trend-detail strong {
  display: block;
  margin: 3px 0 1px;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.segment-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.segment-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 47px;
  padding: 0 2px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s ease, padding 0.2s ease;
}

.segment-list a:hover {
  padding-left: 7px;
  color: var(--accent);
}

.daily-band {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
  padding: 24px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(17, 21, 28, 0.96), rgba(35, 40, 55, 0.94)),
    radial-gradient(circle at 85% 20%, rgba(238, 107, 67, 0.35), transparent 30%);
  color: #f8f7f2;
  overflow: hidden;
}

.daily-band .eyebrow { color: #8fd9af; }
.daily-band h2,
.daily-band p { margin-bottom: 0; }
.daily-band strong { display: block; font-size: 28px; letter-spacing: -0.05em; }

.table-region { overflow: auto; }
.section-head a,
.eyebrow a,
.filter-bar a,
table a {
  color: var(--green);
  text-decoration: none;
  font-weight: 780;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

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

th {
  color: #90959b;
  font-weight: 800;
  letter-spacing: 0.02em;
}

tbody tr { transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease; }
tbody tr:hover { background: rgba(255, 255, 255, 0.68); }

.muted-block,
.product-cell span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
}

.product-cell {
  max-width: 420px;
  white-space: normal;
}

.product-cell strong {
  display: block;
  margin-bottom: 3px;
}

.tag {
  margin: 2px 4px 2px 0;
  padding: 4px 8px;
  background: rgba(17, 24, 32, 0.055);
  color: #5f6870;
  font-size: 11px;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-item,
.empty-state {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.event-item span,
.event-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.event-item strong {
  display: block;
  margin: 4px 0;
}

.event-item p {
  margin-bottom: 4px;
  color: #4d555c;
  font-size: 12px;
}

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

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
}

.filter-bar input,
.filter-bar select {
  min-width: 230px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 0 14px;
  color: var(--ink);
  outline: none;
}

button {
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  padding: 0 20px;
  color: #fff;
  font-weight: 820;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover { transform: translateY(-1px); box-shadow: 0 12px 22px rgba(238, 107, 67, 0.22); }
.filter-bar .ghost-link { align-self: center; padding: 0 8px; color: var(--green); }

.recent-customers {
  margin-bottom: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.48);
}

.recent-customer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--line);
}

.recent-customer {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.recent-customer:hover {
  position: relative;
  z-index: 1;
  background: #fff;
  transform: translateY(-2px);
}

.recent-customer-top,
.recent-customer-tags {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.recent-customer-top strong,
.recent-customer-top span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-customer-top strong {
  color: var(--green);
  font-size: 15px;
}

.recent-customer-top span,
.recent-customer-meta,
.recent-days {
  color: var(--muted);
  font-size: 11px;
}

.recent-customer-top time {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.05em;
}

.recent-customer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 18px 0 14px;
}

.recent-customer-meta b {
  color: var(--ink);
  font-size: 13px;
}

.recent-customer-tags {
  align-items: center;
  min-height: 24px;
}

.recent-customer-tags .tag { margin: 0 4px 0 0; }
.recent-days { margin-left: auto; white-space: nowrap; }
.customer-directory { margin-top: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.62fr) minmax(0, 1.38fr);
  gap: 14px;
}

.profile-list { margin: 0; }
.profile-list div {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

dt { color: var(--muted); font-size: 12px; }
dd { margin: 4px 0 0; font-weight: 760; }
.compact { padding: 22px; }

.reveal { animation: rise 0.48s cubic-bezier(0.22, 1, 0.36, 1) both; }
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.992); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1050px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    margin: 14px;
    inset: auto;
  }

  .brand { margin-bottom: 14px; }
  nav { display: flex; flex-wrap: wrap; }
  .nav-label,
  .sidebar-foot { display: none; }

  .workspace {
    margin: 0;
    padding: 0 14px 26px;
  }

  .grid-main,
  .trend-grid,
  .analysis-grid,
  .detail-grid { grid-template-columns: 1fr; }
  .recent-customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trend-panel { height: 660px; }
  .trend-panel canvas { height: 370px !important; }
  .daily-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .content-frame,
  .topbar { border-radius: 22px; }
  .content-frame { padding: 16px; }
  .topbar { align-items: stretch; height: auto; flex-direction: column; }
  .search-shell { min-width: 100%; }
  .metric-strip,
  .daily-band { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .recent-customer-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .basis-switch { width: 100%; }
  .basis-switch a { flex: 1; min-width: 0; }
  .upload-entry { align-items: stretch; flex-direction: column; }
  .upload-pill { width: 100%; }
  .trend-panel {
    height: auto;
    min-height: 610px;
    padding: 20px 16px;
  }
  .trend-panel canvas { height: 300px !important; }
  .trend-detail { grid-template-columns: 1fr; }
  .filter-bar input,
  .filter-bar select,
  button { width: 100%; }
}
