:root {
  --paper: #fff8ea;
  --paper-2: #f7eee0;
  --card: #fffdf9;
  --line: #eadbc8;
  --line-soft: #f1e8dc;
  --ink: #211713;
  --muted: #826f63;
  --muted-2: #a5968b;
  --red: #d8301c;
  --red-dark: #a72315;
  --orange: #f08b2f;
  --amber: #f3b51b;
  --green: #137f68;
  --teal: #157b82;
  --black: #171312;
  --shadow: 0 18px 45px rgba(73, 42, 19, .08);
  --shadow-soft: 0 8px 24px rgba(73, 42, 19, .07);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -10%, rgba(242, 178, 37, .12), transparent 26rem),
    var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; }
button:disabled { cursor: not-allowed; opacity: .48; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--red);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
}
.eyebrow.light { color: #ffb37c; }
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--red), #ef6b29);
  box-shadow: 0 10px 24px rgba(216, 48, 28, .22);
}
.button.primary:hover:not(:disabled) { box-shadow: 0 14px 30px rgba(216, 48, 28, .28); }
.button.secondary { border-color: var(--line); background: #fff; box-shadow: var(--shadow-soft); }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, .85fr);
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(126deg, rgba(20, 15, 13, .98), rgba(42, 23, 17, .96) 50%, rgba(93, 27, 16, .92)),
    var(--black);
}
.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .15;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(90deg, #000, transparent 80%);
}
.login-aura { position: absolute; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.aura-one { width: 420px; height: 420px; top: -210px; left: -120px; background: radial-gradient(circle, rgba(241, 134, 45, .3), transparent 68%); }
.aura-two { width: 520px; height: 520px; bottom: -330px; left: 32%; background: radial-gradient(circle, rgba(216, 48, 28, .3), transparent 68%); }
.login-brand {
  min-width: 0;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(46px, 8vw, 110px);
}
.login-logo-shell {
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
  margin-bottom: 34px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 26px;
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 18px 50px rgba(0,0,0,.2);
  backdrop-filter: blur(12px);
}
.login-logo-shell img { width: 86px; height: 86px; object-fit: contain; }
.login-brand h1 {
  max-width: 680px;
  margin: 16px 0 22px;
  font-size: clamp(42px, 5vw, 76px);
  line-height: 1.06;
  letter-spacing: -.05em;
}
.login-brand h1 em { color: #ffad65; font-style: normal; }
.login-brand > p {
  max-width: 580px;
  margin: 0;
  color: rgba(255,255,255,.62);
  font-size: 16px;
  line-height: 1.9;
}
.login-feature-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 38px; }
.login-feature-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  color: rgba(255,255,255,.78);
  background: rgba(255,255,255,.05);
  font-size: 12px;
  font-weight: 700;
}
.login-feature-row svg { color: #ffae6d; }
.login-panel {
  align-self: center;
  position: relative;
  z-index: 2;
  width: min(470px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 26px;
  color: var(--ink);
  background: rgba(255, 252, 246, .97);
  box-shadow: 0 30px 90px rgba(0,0,0,.3);
}
.login-panel-head h2 { margin: 10px 0 8px; font-size: 29px; letter-spacing: -.03em; }
.login-panel-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.login-form { display: grid; gap: 17px; margin-top: 28px; }
.login-form label, .modal-form label { display: grid; gap: 8px; }
.login-form label > span, .modal-form label > span { color: #66584f; font-size: 12px; font-weight: 800; }
.input-shell {
  min-height: 49px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid #dfd2c3;
  border-radius: 11px;
  color: #a39489;
  background: #fff;
  transition: box-shadow .16s ease, border-color .16s ease;
}
.input-shell:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px rgba(216, 48, 28, .1); }
.input-shell input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.login-submit { width: 100%; margin-top: 2px; }
.password-link { justify-self: center; display: inline-flex; align-items: center; gap: 6px; border: 0; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.password-link:hover { color: var(--red); }
.login-security {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 25px;
  padding: 13px;
  border: 1px solid #c6e1d9;
  border-radius: 11px;
  color: var(--green);
  background: #f0f8f5;
}
.login-security svg { flex: 0 0 auto; }
.login-security span { display: grid; gap: 2px; font-size: 10px; }
.login-security strong { font-size: 12px; }
.form-error, .form-success { padding: 10px 12px; border-radius: 9px; font-size: 12px; line-height: 1.5; }
.form-error { border: 1px solid #f0c8c3; color: #a42a1d; background: #fff0ee; }
.form-success { border: 1px solid #bfdfd5; color: var(--green); background: #eff9f6; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  padding: 20px 15px 18px;
  color: #fff;
  background: linear-gradient(165deg, #dc3c22 0%, #bf281a 58%, #8f1c14 100%);
  box-shadow: 7px 0 24px rgba(86,27,18,.12);
}
.sidebar > * { position: relative; z-index: 1; }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand img, .mobile-brand img { width: 45px; height: 45px; object-fit: contain; filter: brightness(0) invert(1); opacity: .96; }
.side-brand div { min-width: 0; display: grid; gap: 2px; }
.side-brand strong { font-size: 14px; white-space: nowrap; }
.side-brand span { color: rgba(255,255,255,.42); font-size: 8px; letter-spacing: .12em; }
.sidebar nav { display: grid; gap: 6px; margin-top: 0; }
.sidebar nav button {
  width: 100%;
  height: 45px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgba(255,247,233,.76);
  background: transparent;
  cursor: pointer;
  transition: .2s ease;
}
.sidebar nav button:hover { color: #fff; background: rgba(92,14,8,.18); }
.sidebar nav button.active { color: #261713; border-color: #ffe866; background: var(--yellow); box-shadow: 0 9px 22px rgba(75,15,8,.22); }
.sidebar nav button span { flex: 1; text-align: left; font-size: 13px; font-weight: 600; }
.side-admin-tools { display: grid; gap: 5px; margin: 14px 4px 0; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.18); }
.side-admin-tools > span { padding: 0 9px 3px; color: rgba(255,248,232,.58); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.side-admin-tools button { min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; color: rgba(255,247,233,.7); text-align: left; background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.side-admin-tools button:hover, .side-admin-tools button.active { color: #fff; border-color: rgba(255,255,255,.15); background: rgba(92,14,8,.2); }
.side-admin-tools button span { flex: 1; }
.side-scope {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.05);
}
.side-scope > span { color: rgba(255,255,255,.4); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.side-scope strong { font-size: 12px; }
.side-scope small { color: rgba(255,255,255,.5); font-size: 10px; }
.side-user { display: grid; grid-template-columns: 36px minmax(0, 1fr) 30px; align-items: center; gap: 9px; margin-top: 12px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #9b2015; background: var(--yellow); font-size: 14px; font-weight: 900; }
.side-user > div:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.side-user strong, .side-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user strong { font-size: 11px; }
.side-user span { color: rgba(255,255,255,.42); font-family: Consolas, monospace; font-size: 9px; }
.side-user button, .mobile-logout { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; color: rgba(255,255,255,.5); background: transparent; cursor: pointer; }
.side-user button:hover { color: #fff; background: rgba(255,255,255,.08); }
.app-main { min-width: 0; }
.topbar {
  min-height: 67px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px clamp(20px, 3vw, 42px);
  border-bottom: 1px solid rgba(225, 209, 188, .72);
  background: rgba(255,248,234,.86);
  backdrop-filter: blur(14px);
}
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.live-dot { width: 8px; height: 8px; border: 2px solid #b8e1d4; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(19,127,104,.08); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.accounts-button { border-color: var(--line); background: #fff; box-shadow: var(--shadow-soft); }
.import-button { color: #fff; background: var(--black); box-shadow: 0 8px 20px rgba(23,19,18,.16); }
.mobile-brand, .mobile-logout, .performance-mobile-nav { display: none; }
.content { width: min(1500px, 100%); margin: 0 auto; padding: 34px clamp(20px, 3vw, 42px) 48px; }
.view-stack { display: grid; gap: 22px; }
.dashboard-hero, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.hero-import-button { flex: 0 0 auto; color: #fff; background: linear-gradient(135deg, var(--red), var(--orange)); box-shadow: 0 9px 22px rgba(216,48,28,.22); }
.dashboard-hero h1, .section-heading h2 { margin: 7px 0 6px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.04em; }
.dashboard-hero p, .section-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.date-range-controller { min-width: 540px; display: grid; gap: 8px; }
.date-range-fields { display: grid; grid-template-columns: minmax(220px, 1fr) 22px minmax(220px, 1fr); align-items: center; gap: 7px; }
.date-range-fields > i { color: var(--muted-2); font-size: 10px; font-style: normal; font-weight: 800; text-align: center; }
.date-range-fields label { min-height: 52px; position: relative; display: grid; grid-template-columns: 20px minmax(0,1fr) 16px; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-soft); cursor: pointer; }
.date-range-fields label > svg:first-child { color: var(--red); }
.date-range-fields label span { display: grid; gap: 2px; }
.date-range-fields label small { color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.date-range-fields label strong { font-size: 11px; white-space: nowrap; }
.date-range-fields input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.range-presets { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.range-presets > span { margin-right: 2px; color: var(--muted-2); font-size: 9px; font-weight: 800; }
.range-presets button { min-height: 27px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.72); font-size: 9px; font-weight: 800; cursor: pointer; }
.range-presets button.active { color: #fff; border-color: var(--black); background: var(--black); }
.data-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid #ebd599;
  border-radius: 12px;
  color: #8a620b;
  background: #fff7d9;
}
.data-warning svg { flex: 0 0 auto; }
.data-warning div { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.data-warning strong { font-size: 12px; }
.data-warning span { font-size: 11px; }
.filter-panel, .board-section {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,253,249,.9);
  box-shadow: var(--shadow-soft);
}
.filter-panel-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.filter-panel-title > div { display: flex; align-items: center; gap: 9px; }
.filter-panel-title h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.filter-panel-title i { width: 30px; height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--orange), #ffbd1f); }
.filter-panel-title small { color: var(--muted-2); font-size: 9px; }
.section-mark { width: 4px; height: 24px; border-radius: 99px; background: var(--red); }
.quick-time-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick-time-row > span { margin-right: 2px; color: var(--muted); font-size: 10px; font-weight: 800; }
.quick-time-row button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.quick-time-row button.active { color: #fff; border-color: var(--black); background: var(--black); }
.filter-grid, .period-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.filter-field { min-width: 0; display: grid; gap: 7px; padding: 11px; border-radius: 12px; background: #fbf7f1; }
.filter-field > span { color: #8a6252; font-size: 10px; font-weight: 800; }
.filter-field > select, .filter-field > input, .filter-input-shell {
  width: 100%;
  min-height: 43px;
  padding: 0 11px;
  border: 1px solid #ead3bc;
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
}
.filter-field > select:focus, .filter-field > input:focus, .filter-input-shell:focus-within { border-color: #e46a54; box-shadow: 0 0 0 3px rgba(216,48,28,.08); }
.filter-field > select:disabled, .filter-field > input:disabled, .filter-input-shell:has(input:disabled) { color: var(--muted-2); background: #f4eee7; }
.filter-input-shell { display: flex; align-items: center; gap: 8px; }
.filter-input-shell svg { flex: 0 0 auto; color: var(--red); }
.filter-input-shell input { min-width: 0; flex: 1; border: 0; outline: 0; color: inherit; background: transparent; font-size: 11px; }
.period-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 10px; font-weight: 800; }
.period-divider::after { content: ""; height: 1px; flex: 1; border-top: 1px dashed #e5caa8; }
.filter-panel-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 2px; }
.filter-panel-bottom > div { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.filter-panel-bottom span { color: var(--muted-2); font-size: 9px; }
.filter-panel-bottom strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.filter-panel-bottom button { min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: #fff; font-size: 10px; font-weight: 800; cursor: pointer; }
.board-section { background: rgba(255,250,241,.9); }
.board-title { margin-bottom: -2px; }
.board-context { padding: 12px 14px; border: 1px solid #eddac5; border-radius: 11px; color: var(--muted); background: #fff; font-size: 10px; }
.board-context strong { color: var(--ink); }
.board-kpis { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 11px; }
.board-kpis article { min-height: 112px; display: flex; flex-direction: column; padding: 14px; border: 1px solid #ead7c2; border-top: 3px solid #f0a11d; border-radius: 13px; background: #fffdf9; }
.board-kpis article:nth-child(3), .board-kpis article:nth-child(4), .board-kpis article:nth-child(5) { border-top-color: var(--red); }
.board-kpis article > span { color: var(--muted); font-size: 9px; }
.board-kpis article > strong { margin-top: 7px; font-size: 19px; line-height: 1.25; letter-spacing: -.03em; }
.board-kpis article > div { display: flex; align-items: center; gap: 7px; margin-top: auto; padding-top: 8px; color: var(--red); font-size: 9px; }
.channel-board { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.channel-panel { overflow: hidden; border: 1px solid #eccb9a; border-radius: 15px; background: rgba(255,255,255,.62); }
.channel-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 15px; border-bottom: 1px solid #eedcc6; }
.channel-panel-head h3 { margin: 0; font-size: 14px; }
.channel-panel-head span { color: var(--muted-2); font-size: 8px; }
.channel-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; padding: 10px; }
.channel-metric-grid > div { min-width: 0; display: flex; flex-direction: column; min-height: 128px; padding: 13px; border: 1px solid #ead8c3; border-radius: 11px; background: #fffaf2; }
.channel-metric-grid span { color: var(--muted); font-size: 9px; }
.channel-metric-grid strong { margin-top: 7px; font-size: 19px; letter-spacing: -.03em; }
.channel-metric-grid small { margin-top: 5px; color: var(--muted-2); font-size: 8px; }
.channel-metric-grid p { display: flex; align-items: center; gap: 5px; margin: auto 0 0; padding-top: 8px; color: var(--red); font-size: 9px; }
.group-panel .channel-panel-head { background: #fff8df; }
.current-scope-pill { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--red); background: #fff; }
.current-scope-pill span { max-width: 420px; overflow: hidden; color: var(--ink); font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.current-scope-pill strong { margin-left: 6px; padding-left: 10px; border-left: 1px solid var(--line); color: var(--teal); font-size: 10px; white-space: nowrap; }
.filters-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.metric-switch { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.68); }
.metric-switch button { min-width: 82px; height: 34px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.metric-switch button.active { color: #fff; background: var(--black); box-shadow: 0 5px 12px rgba(23,19,18,.16); }
.select-shell { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--red); background: #fff; }
.select-shell select { min-width: 190px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; font-weight: 800; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.kpi-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,253,249,.9);
  box-shadow: var(--shadow-soft);
}
.kpi-card.dark {
  color: #fff;
  border-color: var(--black);
  background:
    radial-gradient(circle at 100% 0, rgba(239,107,41,.36), transparent 180px),
    var(--black);
  box-shadow: 0 15px 35px rgba(23,19,18,.18);
}
.kpi-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 11px; color: #fff; background: rgba(255,255,255,.14); }
.kpi-icon.red { color: var(--red); background: #fff0ec; }
.kpi-icon.amber { color: #9a6a00; background: #fff4d1; }
.kpi-icon.teal { color: var(--teal); background: #e8f5f4; }
.kpi-card > span { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .04em; }
.kpi-card.dark > span { color: rgba(255,255,255,.55); }
.kpi-card > strong { margin-top: 8px; font-size: clamp(24px, 2.15vw, 36px); letter-spacing: -.05em; white-space: nowrap; }
.kpi-card > strong em { font-size: 15px; font-style: normal; }
.kpi-card > div:last-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.kpi-card.dark > div:last-child { border-color: rgba(255,255,255,.12); }
.kpi-card small { color: var(--muted-2); font-size: 9px; }
.mini-stat { color: var(--teal); font-size: 11px; font-weight: 900; }
.change { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.change.positive { color: #4be0b6; }
.change.negative { color: #ff8579; }
.change.neutral { color: var(--muted-2); }
.change.quiet.positive { color: var(--green); }
.change.quiet.negative { color: var(--red); }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .75fr); gap: 15px; }
.chart-card, .mix-card, .table-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,253,249,.9);
  box-shadow: var(--shadow-soft);
}
.chart-card, .mix-card { padding: 22px; }
.card-heading, .table-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-heading h3, .table-head h3 { margin: 6px 0 0; font-size: 16px; letter-spacing: -.02em; }
.chart-latest { text-align: right; }
.chart-latest span { display: block; color: var(--muted-2); font-size: 9px; }
.chart-latest strong { display: block; margin-top: 3px; font-size: 17px; }
.trend-chart { margin: 8px -2px -8px; }
.trend-chart svg { width: 100%; height: 235px; overflow: visible; }
.chart-grid { stroke: #eee4d8; stroke-width: 1; stroke-dasharray: 4 5; }
.chart-line { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: #fff; stroke: var(--red); stroke-width: 2; }
.chart-dot.latest { fill: var(--red); stroke: #fff; stroke-width: 3; filter: drop-shadow(0 2px 4px rgba(216,48,28,.35)); }
.trend-chart text { fill: var(--muted-2); font-size: 10px; font-weight: 700; }
.mix-card { display: flex; flex-direction: column; }
.mix-ring {
  --dine: 50%;
  width: 154px;
  height: 154px;
  display: grid;
  place-items: center;
  align-self: center;
  margin: 19px 0 16px;
  border-radius: 50%;
  background: conic-gradient(var(--red) 0 var(--dine), #f2b432 var(--dine) 100%);
  box-shadow: inset 0 0 0 14px #fffdf9;
}
.mix-ring div { width: 100px; height: 100px; display: grid; place-content: center; text-align: center; border-radius: 50%; background: #fffdf9; }
.mix-ring strong { font-size: 27px; letter-spacing: -.05em; }
.mix-ring span { color: var(--muted); font-size: 9px; }
.mix-list { display: grid; gap: 10px; margin-top: auto; }
.mix-list > div { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.mix-list i { width: 8px; height: 8px; border-radius: 50%; }
.mix-list i.dine { background: var(--red); }
.mix-list i.group { background: #f2b432; }
.mix-list strong { color: var(--ink); font-size: 11px; }
.table-head { padding: 21px 22px 17px; border-bottom: 1px solid var(--line-soft); }
.table-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.table-count { align-self: center; padding: 6px 9px; border-radius: 999px; color: var(--muted); background: var(--paper-2); font-size: 9px; font-weight: 800; }
.responsive-table { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 12px 15px; color: var(--muted-2); background: #fbf7f1; font-size: 9px; font-weight: 900; letter-spacing: .04em; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
td { padding: 14px 15px; border-top: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #fff8ed; }
.table-card:not(.compact) tbody tr { cursor: pointer; }
.daily-comparison-card tbody tr { cursor: default; }
.daily-comparison-card .responsive-table { max-height: 620px; }
.date-cell strong, .date-cell small { display: block; }
.date-cell small { margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.selected-row { background: #fff0e9 !important; }
.drill-table tbody tr { cursor: pointer; }
.rank { width: 24px; height: 24px; display: inline-grid; place-items: center; margin-right: 8px; border-radius: 8px; color: var(--muted); background: var(--paper-2); font-size: 9px; font-weight: 900; }
tbody tr:nth-child(1) .rank { color: #fff; background: var(--red); }
tbody tr:nth-child(2) .rank { color: #fff; background: #d37a37; }
tbody tr:nth-child(3) .rank { color: #fff; background: #ae8b60; }
.up-text { color: var(--green); }
.down-text { color: var(--red); }
.split-tables { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 15px; }
.table-card.compact { min-width: 0; }
.table-card.compact .responsive-table { max-height: 520px; }
.search-shell { min-width: 190px; min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted-2); background: #fff; }
.search-shell input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 10px; }
.store-table td:first-child { white-space: normal; }
.store-table td:first-child strong, .store-table td:first-child small { display: block; }
.store-table td:first-child strong { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-table td:first-child small { margin-top: 3px; color: var(--muted-2); font-size: 8px; }
footer { padding: 8px 0 0; color: var(--muted-2); font-size: 9px; line-height: 1.7; text-align: center; }

/* Accounts */
.account-notice { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; border: 1px solid #bfded5; border-radius: 13px; color: var(--green); background: #eff9f6; }
.account-notice svg { flex: 0 0 auto; }
.account-notice strong { display: block; font-size: 12px; }
.account-notice p { margin: 4px 0 0; color: #45776a; font-size: 11px; line-height: 1.65; }
code { padding: 4px 7px; border-radius: 6px; color: #7d2b20; background: #fff0eb; font-family: Consolas, monospace; font-size: 10px; font-weight: 800; }
.role-pill { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.role-pill.admin { color: #fff; background: var(--black); }
.role-pill.supervisor { color: var(--teal); background: #e9f5f4; }
.status-dot { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 9px; font-weight: 800; }
.status-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* Modals and upload */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(26,18,14,.66); backdrop-filter: blur(8px); }
.modal-card { width: min(480px, 100%); max-height: calc(100vh - 40px); position: relative; overflow: auto; padding: 30px; border: 1px solid rgba(255,255,255,.8); border-radius: 20px; background: #fffdf9; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.modal-card.wide { width: min(760px, 100%); }
.modal-close { width: 34px; height: 34px; position: absolute; top: 17px; right: 17px; display: grid; place-items: center; border: 0; border-radius: 9px; color: var(--muted); background: #f4ece3; cursor: pointer; }
.modal-heading { display: flex; align-items: flex-start; gap: 14px; padding-right: 32px; }
.modal-icon { width: 47px; height: 47px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; color: var(--red); background: #fff0eb; }
.modal-icon.upload { color: #fff; background: linear-gradient(135deg, var(--red), var(--orange)); }
.modal-heading h2 { margin: 6px 0 5px; font-size: 21px; }
.modal-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.modal-form { display: grid; gap: 14px; margin-top: 23px; }
.modal-form input { min-height: 44px; padding: 0 12px; border: 1px solid #dfd2c3; border-radius: 10px; outline: 0; background: #fff; }
.modal-form input:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(216,48,28,.09); }
.drop-zone {
  min-height: 300px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 34px;
  border: 1.5px dashed #d8b991;
  border-radius: 16px;
  color: var(--red);
  text-align: center;
  background: #fff8ed;
  cursor: pointer;
}
.drop-zone input { display: none; }
.drop-zone strong { color: var(--ink); font-size: 16px; }
.drop-zone span { max-width: 520px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.drop-zone em { margin-top: 5px; padding: 7px 11px; border-radius: 8px; color: #fff; background: var(--black); font-size: 10px; font-style: normal; font-weight: 800; }
.upload-preview { display: grid; gap: 15px; margin-top: 24px; }
.preview-file { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.preview-file > svg { color: var(--green); }
.preview-file div { min-width: 0; display: grid; gap: 3px; }
.preview-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.preview-file span { color: var(--muted); font-size: 9px; }
.preview-file button { border: 0; color: var(--red); background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.preview-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.preview-stats > div { display: grid; gap: 4px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.preview-stats span { color: var(--muted); font-size: 9px; }
.preview-stats strong { font-size: 18px; }
.preview-stats .warning { border-color: #ebd599; color: #8a620b; background: #fff8dd; }
.channel-check { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid #bfdfd5; border-radius: 11px; color: var(--green); background: #eff9f6; }
.channel-check svg { flex: 0 0 auto; }
.channel-check strong { display: block; font-size: 11px; }
.channel-check p { margin: 4px 0 0; color: #4d7f72; font-size: 9px; line-height: 1.6; }
.unmatched-box { padding: 13px; border: 1px solid #efd7a6; border-radius: 11px; color: #895e13; background: #fff8e6; }
.unmatched-box strong { font-size: 10px; }
.unmatched-box p { margin: 5px 0 0; font-size: 9px; line-height: 1.7; }
.upload-confirm { width: 100%; }
.modal-error { margin-top: 14px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 120; display: flex; align-items: center; gap: 9px; padding: 13px 17px; border-radius: 12px; color: #fff; background: var(--black); box-shadow: 0 16px 40px rgba(0,0,0,.24); font-size: 12px; font-weight: 800; }
.toast svg { color: #62d7b8; }
.loading-page { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 13px; color: var(--muted); background: var(--paper); }
.loading-page img { width: 82px; height: 82px; object-fit: contain; }
.loading-page svg { color: var(--red); }
.loading-page span { font-size: 11px; font-weight: 800; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid, .period-filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .board-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .analysis-grid { grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr); }
  .split-tables { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; padding: 32px 0; }
  .login-brand { padding: 42px 28px 28px; }
  .login-brand h1 { font-size: 46px; }
  .login-brand > p { font-size: 13px; }
  .login-logo-shell { width: 76px; height: 76px; margin-bottom: 22px; }
  .login-logo-shell img { width: 66px; height: 66px; }
  .login-panel { margin-bottom: 30px; }
  .app-shell { grid-template-columns: 1fr; }
  .daily-performance-app .sidebar { display: none; }
  .performance-mobile-nav { position: fixed; left: 10px; right: 10px; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 70; min-height: 64px; display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); padding: 6px; border: 1px solid rgba(225,207,194,.9); border-radius: 17px; background: rgba(255,253,248,.96); box-shadow: 0 10px 32px rgba(58,25,16,.2); backdrop-filter: blur(16px); }
  .performance-mobile-nav button { min-width: 0; display: grid; place-items: center; align-content: center; gap: 3px; padding: 4px 1px; border: 0; border-radius: 11px; color: #8a7a70; background: transparent; font-size: 9px; font-weight: 800; cursor: pointer; }
  .performance-mobile-nav button.active { color: #fff; background: var(--red); box-shadow: 0 6px 13px rgba(207,50,29,.2); }
  .topbar { min-height: 62px; padding: 8px 16px; }
  .mobile-brand { min-width: 0; display: flex; align-items: center; gap: 8px; }
  .mobile-brand img { width: 38px; height: 38px; filter: none; }
  .mobile-brand strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-status { display: none; }
  .mobile-logout { display: grid; color: var(--muted); }
  .content { padding: 25px 16px 105px; }
  .dashboard-hero, .section-heading { align-items: flex-start; flex-direction: column; }
  .date-range-controller { width: 100%; min-width: 0; }
  .filters-row { align-items: stretch; flex-direction: column; }
  .metric-switch { display: grid; grid-template-columns: repeat(3, 1fr); }
  .metric-switch button { min-width: 0; }
  .current-scope-pill { width: 100%; }
  .current-scope-pill span { max-width: none; flex: 1; }
  .board-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .channel-board { grid-template-columns: 1fr; }
  .select-shell select { width: 100%; }
  .analysis-grid { grid-template-columns: 1fr; }
  .mix-card { min-height: 350px; }
  .preview-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .login-page { padding: 0; }
  .login-brand { padding: 34px 22px 24px; }
  .login-brand h1 { margin: 11px 0 15px; font-size: 36px; }
  .login-brand > p { font-size: 12px; line-height: 1.75; }
  .login-feature-row { margin-top: 23px; }
  .login-feature-row span { padding: 8px 10px; font-size: 10px; }
  .login-panel { width: calc(100% - 28px); padding: 27px 21px; border-radius: 20px; }
  .login-panel-head h2 { font-size: 24px; }
  .accounts-button, .import-button { width: 42px; padding: 0; font-size: 0; }
  .accounts-button svg, .import-button svg { margin: 0; }
  .dashboard-hero h1 { font-size: 28px; }
  .hero-import-button { width: 100%; min-height: 44px; }
  .filter-panel, .board-section { gap: 13px; padding: 15px; }
  .filter-panel-title { align-items: flex-start; }
  .filter-panel-title small { display: none; }
  .filter-grid { grid-template-columns: 1fr; }
  .period-filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filter-field { padding: 9px; }
  .filter-panel-bottom { align-items: stretch; flex-direction: column; }
  .filter-panel-bottom > div { align-items: flex-start; flex-direction: column; gap: 4px; }
  .filter-panel-bottom strong { width: 100%; white-space: normal; }
  .filter-panel-bottom button { width: 100%; }
  .board-context { line-height: 1.7; }
  .board-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .board-kpis article { min-height: 104px; padding: 12px; }
  .board-kpis article > strong { font-size: 16px; }
  .channel-panel-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .channel-metric-grid { grid-template-columns: 1fr; }
  .channel-metric-grid > div { min-height: 112px; }
  .date-range-fields { grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); gap: 4px; }
  .date-range-fields label { grid-template-columns: 17px minmax(0,1fr) 13px; gap: 7px; padding: 0 9px; }
  .date-range-fields label strong { font-size: 10px; }
  .range-presets { justify-content: flex-start; overflow-x: auto; padding-bottom: 2px; }
  .range-presets > span { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { min-height: 162px; padding: 16px; }
  .kpi-icon { width: 34px; height: 34px; margin-bottom: 15px; }
  .kpi-card > strong { font-size: 23px; }
  .kpi-card > div:last-child { align-items: flex-start; flex-direction: column; }
  .trend-chart svg { height: 205px; }
  .chart-card, .mix-card { padding: 17px; }
  .table-head { padding: 17px; }
  th, td { padding: 12px; }
  .search-shell { min-width: 155px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal-card, .modal-card.wide { width: 100%; max-height: 92vh; padding: 25px 20px calc(25px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; }
  .drop-zone { min-height: 260px; padding: 26px 18px; }
  .preview-file { grid-template-columns: 34px minmax(0,1fr); }
  .preview-file button { grid-column: 2; justify-self: start; padding: 0; }
  .toast { left: 16px; right: 16px; bottom: 82px; justify-content: center; }
}
