:root {
  --bg: #eef3f9;
  --bg-soft: #f6f9fd;
  --card: rgba(255, 255, 255, 0.96);
  --card-strong: #ffffff;
  --ink: #17233d;
  --muted: #6b7a90;
  --line: rgba(122, 143, 174, 0.2);
  --brand: #2e62ff;
  --brand-strong: #1d3f93;
  --brand-soft: rgba(46, 98, 255, 0.1);
  --danger: #d84c4c;
  --warning: #d49a17;
  --success: #1f9d68;
  --shadow: 0 18px 44px rgba(20, 43, 79, 0.1);
  --shadow-soft: 0 14px 30px rgba(20, 43, 79, 0.08);
  --panel-radius: 24px;
  --panel-padding: 22px;
  --sidebar-bg: linear-gradient(180deg, #142b57 0%, #1c386e 55%, #223f78 100%);
  --sidebar-panel: rgba(255, 255, 255, 0.06);
  --sidebar-line: rgba(255, 255, 255, 0.1);
  --sidebar-text: rgba(255, 255, 255, 0.96);
  --sidebar-muted: rgba(214, 225, 245, 0.74);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(46, 98, 255, 0.08), transparent 20%),
    radial-gradient(circle at top right, rgba(41, 114, 255, 0.07), transparent 18%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%, #eaf0f8 100%);
}

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

a {
  color: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  align-items: center;
  justify-items: end;
  padding: 24px clamp(24px, 7vw, 120px);
  position: relative;
  background:
    linear-gradient(108deg, rgba(8, 13, 28, 0.84) 0%, rgba(12, 24, 54, 0.62) 38%, rgba(16, 28, 60, 0.36) 58%, rgba(8, 13, 28, 0.72) 100%),
    radial-gradient(circle at center, rgba(255, 82, 46, 0.18), transparent 26%),
    url("./login-bg.jpg?v=20260408-11") center center / cover no-repeat;
}

.login-panel {
  width: min(100%, 460px);
  padding: 32px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 28px 64px rgba(6, 15, 39, 0.34);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.login-panel h1 {
  margin: 0 0 12px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.remember-login {
  margin-top: -4px;
  color: var(--text-muted);
}

.login-error {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(197, 67, 45, 0.1);
  color: var(--danger);
  font-size: 13px;
}

.login-hint {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.login-access-hint {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(46, 98, 255, 0.08);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.sidebar,
.panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  padding: 24px;
  border-radius: 30px;
  background: var(--sidebar-bg);
  border-color: rgba(20, 43, 79, 0.4);
  box-shadow: 0 24px 48px rgba(10, 26, 57, 0.24);
}

.sidebar:hover,
.sidebar:focus-within {
  scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.06);
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}

.sidebar:hover::-webkit-scrollbar-track,
.sidebar:focus-within::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar:hover::-webkit-scrollbar-thumb,
.sidebar:focus-within::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar:hover::-webkit-scrollbar-thumb:hover,
.sidebar:focus-within::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.34);
}

.sidebar .panel {
  background: var(--sidebar-panel);
  border-color: var(--sidebar-line);
  box-shadow: none;
  backdrop-filter: none;
}

.sidebar .eyebrow,
.sidebar h1,
.sidebar h2,
.sidebar-summary,
.sidebar .ghost-btn {
  color: var(--sidebar-text);
}

.sidebar .sidebar-copy,
.sidebar .user-meta,
.sidebar .hint-list,
.sidebar .muted-note {
  color: var(--sidebar-muted);
}

.sidebar .sidebar-summary::after {
  color: var(--sidebar-text);
}

.sidebar .quick-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.sidebar .ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar .ghost-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar .nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-text);
}

.sidebar .nav-btn-sub,
.sidebar .nav-group-label {
  color: var(--sidebar-muted);
}

.sidebar .nav-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar .nav-btn.active {
  background: linear-gradient(135deg, #3e74ff, #2451cd);
  box-shadow: 0 12px 24px rgba(16, 33, 74, 0.28);
}

.sidebar .nav-btn.active .nav-btn-sub {
  color: rgba(233, 240, 255, 0.88);
}

.sidebar .user-meta {
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  line-height: 1.7;
}

.brand-block {
  display: grid;
  gap: 10px;
}

.page-container,
.page-section,
.stats-grid,
.content-grid,
.account-management-grid,
 .profit-top-grid,
.roas-layout,
.roas-result-grid,
 .profit-board,
.product-board,
.store-grid {
  display: grid;
  gap: 16px;
}

.page-container {
  min-width: 0;
}

.page-section {
  gap: 12px;
}

.page-hero {
  display: none !important;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  grid-auto-rows: minmax(0, auto);
  gap: 12px;
}

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

.account-management-grid {
  grid-template-columns: 1.05fr 0.95fr;
  align-items: start;
}

.profit-top-grid {
  grid-template-columns: 0.88fr 1.12fr;
  align-items: start;
}

.roas-layout {
  grid-template-columns: 0.92fr 1.08fr;
  align-items: start;
}

.panel {
  padding: var(--panel-padding);
  border-radius: var(--panel-radius);
  background: var(--card);
  backdrop-filter: blur(12px);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
}

.sidebar h1,
.panel h2,
.page-hero h2 {
  margin: 0;
}

.panel h2 {
  font-size: clamp(22px, 1.8vw, 30px);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.sidebar-copy,
.user-meta,
.hint-list,
.login-hint,
.page-hero p,
.metric-note,
.empty-state,
.muted-note {
  color: var(--muted);
}

.page-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 16px 18px;
  min-height: auto;
  margin: 0;
}

.page-hero-copy {
  display: grid;
  gap: 6px;
  align-content: flex-start;
  min-width: 0;
  flex: 1 1 540px;
}

.page-hero .eyebrow {
  margin: 0;
}

.page-hero h2 {
  margin: 0;
  line-height: 1.2;
  font-size: 18px;
}

.page-hero p {
  margin: 0;
  line-height: 1.45;
  font-size: 14px;
}

.page-hero-copy > p:last-child {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-hero-badge {
  min-width: 260px;
  max-width: 420px;
  flex: 0 1 400px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(46, 98, 255, 0.14);
  box-shadow: 0 10px 24px rgba(20, 43, 79, 0.06);
  align-self: flex-start;
}

.page-hero-badge span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.page-hero-badge strong {
  display: block;
  font-size: 15px;
  line-height: 1.4;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.nav-list {
  display: grid;
  gap: 16px;
}

.nav-group {
  display: grid;
  gap: 10px;
}

.nav-group-label {
  margin: 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar-collapse {
  padding: 18px 18px 20px;
}

.sidebar-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.sidebar-summary::-webkit-details-marker {
  display: none;
}

.sidebar-summary::after {
  content: "▾";
  color: var(--brand-strong);
  font-size: 14px;
  transition: transform 0.2s ease;
}

.sidebar-collapse:not([open]) .sidebar-summary::after {
  transform: rotate(-90deg);
}

.sidebar-summary::after {
  content: "\25BE";
}

.sidebar-collapse-body {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.current-user-actions {
  display: flex;
  justify-content: flex-end;
}

.nav-btn {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 14px 16px 15px;
  border: 1px solid rgba(122, 143, 174, 0.18);
  border-radius: 18px;
  background: rgba(248, 251, 255, 0.82);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.nav-btn-main {
  display: block;
  font-weight: 700;
  font-size: 15px;
}

.nav-btn-sub {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.nav-btn:hover {
  transform: translateY(-1px);
  background: rgba(231, 239, 255, 0.95);
  box-shadow: 0 10px 22px rgba(20, 43, 79, 0.08);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(29, 63, 147, 0.24);
}

.field {
  display: grid;
  gap: 9px;
}

.field span {
  font-size: 12px;
  font-weight: 600;
  color: #40506a;
  letter-spacing: 0.01em;
}

.compact-field span {
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid rgba(122, 143, 174, 0.18);
  border-radius: 15px;
  background: rgba(248, 251, 255, 0.94);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input[readonly] {
  background: rgba(232, 240, 255, 0.88);
  color: #1d3f93;
  font-weight: 700;
}

.field small {
  font-size: 12px;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(46, 98, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(46, 98, 255, 0.1);
}

.field.full {
  grid-column: 1 / -1;
}

.product-form,
.store-structure-form,
.followup-form,
.account-form,
.roas-form,
.profit-config-form,
.profit-item-form,
.profit-edit-form {
  display: grid;
  gap: 16px;
}

.product-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.store-structure-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.profit-config-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.profit-item-form,
.profit-edit-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn {
  justify-self: start;
  padding: 12px 20px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow: 0 14px 26px rgba(29, 63, 147, 0.22);
  font-weight: 700;
}

.primary-btn.small {
  padding: 10px 16px;
}

.ghost-btn {
  padding: 11px 16px;
  background: rgba(248, 251, 255, 0.94);
  color: var(--brand-strong);
  border: 1px solid rgba(122, 143, 174, 0.22);
  font-weight: 600;
}

.ghost-btn.small {
  padding: 8px 12px;
  font-size: 12px;
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

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

.backup-status {
  margin-top: 10px;
  line-height: 1.7;
}

.workspace-status-stack {
  display: grid;
  gap: 14px;
}

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

.workspace-status-card {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.workspace-status-label,
.workspace-status-card p {
  margin: 0;
}

.workspace-status-label {
  font-size: 12px;
  color: var(--sidebar-muted);
}

.workspace-status-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--sidebar-text);
}

.workspace-status-actions {
  display: grid;
  gap: 10px;
}

.workspace-status-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.workspace-status-item strong,
.workspace-status-item span {
  display: block;
}

.workspace-status-item strong {
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--sidebar-text);
}

.workspace-status-item span {
  font-size: 12px;
  line-height: 1.6;
  color: var(--sidebar-muted);
}

.store-checklist {
  display: grid;
  gap: 10px;
  max-height: 240px;
  overflow: auto;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(122, 143, 174, 0.2);
  background: rgba(248, 251, 255, 0.92);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.checkbox-item input {
  width: 16px;
  height: 16px;
}

.hint-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  line-height: 1.65;
}

.stat-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto;
  align-items: start;
  gap: 8px;
  min-height: 118px;
  padding: 16px 16px 14px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, rgba(46, 98, 255, 0.92), rgba(46, 98, 255, 0.08));
}

.stat-card-button {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.stat-card-button:hover {
  transform: translateY(-2px);
}

.stat-card-button.active {
  border-color: rgba(46, 98, 255, 0.24);
  background: linear-gradient(135deg, rgba(46, 98, 255, 0.08), rgba(255, 255, 255, 0.98));
  box-shadow: 0 18px 40px rgba(29, 63, 147, 0.12);
}

.stat-card strong {
  display: block;
  margin: 0;
  align-self: start;
  font-size: clamp(32px, 2.3vw, 38px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  min-width: 0;
}

.stat-card p:first-child {
  font-size: 12px;
  font-weight: 600;
  color: #4c5d79;
  letter-spacing: 0.02em;
}

.stat-card p:last-child {
  font-size: 12px;
  line-height: 1.45;
  align-self: start;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.subsection-title {
  margin: 0 0 14px;
  font-size: 16px;
}

.user-list,
.alert-list,
.timeline-list,
.store-matrix {
  display: grid;
  gap: 14px;
}

.user-card,
.alert-item,
.timeline-item,
.entity-group,
.store-item {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(122, 143, 174, 0.16);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 18px rgba(20, 43, 79, 0.04);
}

.user-card-head,
.store-card-top,
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.user-card-head h4,
.entity-head h4,
.store-card-top h4 {
  margin: 0;
}

.user-meta strong {
  display: block;
  margin-bottom: 6px;
}

.user-card-body {
  display: grid;
  gap: 7px;
}

.user-card-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.form-actions {
  margin-top: 8px;
}

.user-card-actions {
  margin-top: 12px;
  justify-content: flex-start;
}

.timeline-item p {
  margin: 8px 0 0;
  color: var(--muted);
}

.user-badges,
.store-badges,
.store-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

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

.user-badge,
.mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(232, 240, 255, 0.95);
  color: var(--brand-strong);
  font-size: 12px;
}

.mini-badge.danger {
  background: rgba(197, 67, 45, 0.12);
  color: var(--danger);
}

.mini-badge.warning {
  background: rgba(200, 137, 21, 0.14);
  color: #926100;
}

.mini-badge.healthy {
  background: rgba(47, 122, 84, 0.12);
  color: var(--success);
}

.entity-group {
  display: grid;
  gap: 14px;
}

.entity-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.entity-head-actions,
.store-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

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

.store-item {
  display: grid;
  gap: 10px;
}

.store-item strong,
.alert-item strong,
.timeline-item strong {
  display: block;
  margin-bottom: 4px;
}

.execution-toolbar {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

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

.overview-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(250, 252, 255, 0.98);
}

.overview-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

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

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

.profit-toolbar,
.inline-fields,
.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profit-side-stack {
  display: grid;
  gap: 12px;
  align-content: start;
}

.profit-toolbar {
  grid-template-columns: 1.2fr 1fr auto;
  margin-bottom: 16px;
  align-items: end;
}

.filter-summary {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(232, 240, 255, 0.82);
  color: var(--muted);
  font-size: 13px;
}

.roas-results {
  display: grid;
  gap: 16px;
}

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

.roas-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.roas-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

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

.roas-conclusion,
.roas-note {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.roas-conclusion.warning {
  border-color: rgba(197, 67, 45, 0.22);
  background: rgba(197, 67, 45, 0.08);
}

.roas-conclusion strong,
.roas-note strong {
  display: block;
  margin-bottom: 8px;
}

.roas-note p,
.roas-conclusion p {
  margin: 6px 0 0;
  color: var(--muted);
}

.execution-filters .ghost-btn {
  align-self: end;
}

.profit-toolbar .ghost-btn {
  align-self: end;
}

.profit-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.compact-header {
  margin-bottom: 12px;
}

.profit-import-panel {
  min-height: 188px;
}

.profit-import-panel .backup-status {
  margin-top: 0;
  margin-bottom: 0;
}

.profit-import-panel .profit-import-actions {
  margin-bottom: 0;
}

.profit-import-panel .filter-summary:empty {
  display: none;
}

.profit-board {
  grid-template-columns: 1fr;
}

.profit-card {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.profit-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
  gap: 12px;
}

.profit-card-head h3 {
  margin: 4px 0 0;
}

.profit-meta {
  margin: 0;
  font-size: 13px;
  color: var(--brand);
  font-weight: 700;
}

.profit-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.profit-metric {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.profit-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.profit-metric p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.profit-metric.is-danger {
  border-color: rgba(197, 67, 45, 0.2);
  background: rgba(197, 67, 45, 0.07);
}

.profit-metric.is-success {
  border-color: rgba(47, 122, 84, 0.2);
  background: rgba(47, 122, 84, 0.07);
}

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

.product-card {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.card-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.delete-product-btn,
.delete-user-btn,
.delete-profit-btn {
  color: var(--danger);
}

.product-store,
.product-sku,
.product-spu,
.product-link,
.metric-note {
  margin: 0;
  font-size: 13px;
}

.product-store {
  color: var(--brand);
  font-weight: 700;
}

.product-sku {
  margin-top: 6px;
  color: var(--muted);
}

.product-spu {
  margin-top: 4px;
  color: var(--muted);
}

.product-name {
  margin: 4px 0 0;
}

.product-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--brand-strong);
}

.status-pill {
  align-self: start;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-danger {
  background: rgba(197, 67, 45, 0.12);
  color: var(--danger);
}

.status-warning {
  background: rgba(200, 137, 21, 0.14);
  color: #926100;
}

.status-healthy {
  background: rgba(47, 122, 84, 0.12);
  color: var(--success);
}

.metric-row {
  margin: 18px 0;
}

.metric-chip {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(239, 244, 252, 0.98);
  font-size: 13px;
}

.timeline-block {
  margin-top: 18px;
}

.timeline-block h4 {
  margin: 0 0 12px;
}

.timeline-collapse {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.timeline-collapse summary {
  padding: 14px 16px;
  cursor: pointer;
  color: var(--brand-strong);
  font-weight: 600;
  list-style: none;
}

.timeline-collapse summary::-webkit-details-marker {
  display: none;
}

.timeline-collapse-body {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.product-card {
  padding: 0;
  overflow: hidden;
}

.product-summary {
  display: grid;
  gap: 0;
  padding: 20px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.product-summary:hover {
  background: rgba(232, 240, 255, 0.52);
}

.product-summary:focus-visible {
  outline: 2px solid rgba(168, 101, 46, 0.28);
  outline-offset: -2px;
}

.product-card.is-expanded .product-summary {
  background: rgba(232, 240, 255, 0.64);
  border-bottom: 1px solid var(--line);
}

.product-summary-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(84, 58, 30, 0.12);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
}

.product-summary-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(223, 234, 255, 0.96);
  color: var(--brand-strong);
  font-size: 16px;
  line-height: 1;
}

.product-detail-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.product-detail-panel[hidden] {
  display: none;
}

.product-detail-panel .timeline-block {
  margin-top: 0;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(84, 58, 30, 0.2);
}

.knowledge-toolbar-header {
  align-items: end;
  margin-bottom: 12px;
}

.knowledge-toolbar-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.75fr) minmax(150px, 0.75fr) auto;
  align-items: end;
  gap: 12px;
  width: min(1040px, 100%);
}

.compact-field {
  gap: 6px;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.knowledge-sidebar,
.knowledge-detail-panel,
.knowledge-editor-panel {
  min-width: 0;
}

.knowledge-sidebar {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 24px;
}

.knowledge-source-list,
.knowledge-category-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.knowledge-source-btn,
.knowledge-category-btn,
.knowledge-article-card {
  width: 100%;
  border: 1px solid rgba(122, 143, 174, 0.2);
  background: rgba(248, 251, 255, 0.86);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.knowledge-source-btn,
.knowledge-category-btn {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 13px;
}

.knowledge-source-btn strong,
.knowledge-category-btn strong {
  color: var(--brand);
}

.knowledge-source-btn.active,
.knowledge-category-btn.active,
.knowledge-article-card.active {
  border-color: rgba(46, 98, 255, 0.42);
  background: linear-gradient(135deg, rgba(46, 98, 255, 0.1), rgba(255, 255, 255, 0.96));
  box-shadow: 0 12px 26px rgba(29, 63, 147, 0.1);
}

.knowledge-source-btn:hover,
.knowledge-category-btn:hover,
.knowledge-article-card:hover {
  transform: translateY(-1px);
  border-color: rgba(46, 98, 255, 0.32);
}

.knowledge-article-list {
  display: grid;
  gap: 12px;
  max-height: 720px;
  overflow: auto;
  padding-right: 6px;
}

.knowledge-article-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
}

.knowledge-article-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--brand);
}

.knowledge-article-topline em {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(46, 98, 255, 0.1);
  color: var(--brand-strong);
  font-style: normal;
}

.knowledge-article-source {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.knowledge-article-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.knowledge-article-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.knowledge-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.knowledge-tag-row i {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(46, 98, 255, 0.08);
  color: var(--brand-strong);
  font-size: 12px;
  font-style: normal;
}

.knowledge-detail-card {
  display: grid;
  gap: 20px;
  max-width: 980px;
}

.knowledge-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.knowledge-detail-head h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1.2;
}

.knowledge-detail-head p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.knowledge-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 160px;
}

.danger-btn {
  color: #b42318;
}

.knowledge-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-detail-meta span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(233, 239, 249, 0.72);
}

.detail-tags {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(122, 143, 174, 0.18);
}

.knowledge-content {
  display: grid;
  gap: 12px;
  max-width: 920px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.82;
}

.knowledge-content h3 {
  margin: 18px 0 4px;
  font-size: 19px;
}

.knowledge-content h3:first-child {
  margin-top: 0;
}

.knowledge-content p {
  margin: 0;
}

.knowledge-subhead {
  font-weight: 700;
  color: var(--ink);
}

.knowledge-step {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(46, 98, 255, 0.12);
  background: rgba(46, 98, 255, 0.05);
  font-weight: 700;
  color: var(--ink);
}

.knowledge-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.knowledge-list li {
  position: relative;
  padding-left: 18px;
  color: var(--ink);
}

.knowledge-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.78em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.knowledge-bullet {
  position: relative;
  padding-left: 18px;
  color: var(--ink);
}

.knowledge-bullet::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.78em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.knowledge-content-gap {
  height: 8px;
}

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

.knowledge-form .full {
  grid-column: 1 / -1;
}

.knowledge-form textarea {
  min-height: 110px;
  resize: vertical;
}

.panel-tip {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.knowledge-ai-panel {
  display: grid;
  gap: 18px;
}

.knowledge-ai-header {
  align-items: end;
  gap: 16px;
}

.knowledge-ai-header-actions,
.knowledge-ai-inline-actions,
.knowledge-ai-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.knowledge-ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.knowledge-ai-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(122, 143, 174, 0.18);
  background: rgba(247, 250, 255, 0.82);
}

.knowledge-ai-preview-card {
  grid-column: 1 / -1;
}

.knowledge-ai-card-head {
  display: grid;
  gap: 6px;
}

.knowledge-ai-card-head h3 {
  margin: 0;
  font-size: 18px;
}

.knowledge-ai-card-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.knowledge-ai-form .full {
  grid-column: 1 / -1;
}

.knowledge-ai-form textarea {
  min-height: 110px;
  resize: vertical;
}

.knowledge-ai-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 22px;
}

.knowledge-ai-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(46, 98, 255, 0.08);
  color: var(--brand-strong);
  font-size: 12px;
}

.knowledge-ai-file-chip span:last-child {
  color: var(--muted);
}

.knowledge-ai-status,
.knowledge-ai-preview-summary {
  padding: 11px 14px;
  border-radius: 16px;
  background: rgba(233, 239, 249, 0.72);
  color: var(--muted);
  line-height: 1.65;
}

.knowledge-ai-status.is-success,
.knowledge-ai-preview-summary.is-success {
  background: rgba(34, 197, 94, 0.1);
  color: #166534;
}

.knowledge-ai-status.is-warning,
.knowledge-ai-preview-summary.is-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.knowledge-ai-status.is-danger,
.knowledge-ai-preview-summary.is-danger {
  background: rgba(220, 38, 38, 0.12);
  color: #991b1b;
}

.knowledge-ai-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.knowledge-ai-preview-item {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(122, 143, 174, 0.2);
  background: rgba(255, 255, 255, 0.92);
}

.knowledge-ai-preview-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.knowledge-ai-preview-topline strong {
  color: var(--brand);
  font-size: 13px;
}

.knowledge-ai-preview-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.knowledge-ai-preview-summary-text,
.knowledge-ai-preview-content {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.knowledge-ai-preview-content {
  font-size: 13px;
}

.meeting-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: start;
}

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

.meeting-form .full {
  grid-column: 1 / -1;
}

.meeting-form textarea {
  min-height: 220px;
  resize: vertical;
}

.meeting-list {
  display: grid;
  gap: 12px;
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.meeting-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(122, 143, 174, 0.2);
  background: rgba(248, 251, 255, 0.86);
}

.meeting-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.meeting-card-title {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.35;
}

.meeting-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.meeting-card-meta span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(46, 98, 255, 0.08);
  color: var(--brand-strong);
}

.meeting-card-content {
  margin: 0;
  color: var(--ink);
  line-height: 1.75;
  white-space: pre-wrap;
}

@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid,
  .account-management-grid,
  .profit-top-grid,
  .roas-layout,
  .roas-result-grid,
  .store-structure-form,
  .store-grid,
  .profit-item-form,
  .profit-edit-form,
  .product-board,
  .product-form,
  .knowledge-grid,
  .knowledge-ai-grid,
  .knowledge-form,
  .knowledge-ai-form,
  .meeting-layout,
  .meeting-form {
    grid-template-columns: 1fr;
  }

  .execution-overview,
  .execution-filters,
  .profit-config-form,
  .profit-summary-grid,
  .roas-form,
  .knowledge-toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .knowledge-ai-header {
    align-items: start;
  }

}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .page-hero {
    padding: 0;
  }

  .page-hero-badge {
    min-width: 0;
    width: 100%;
    max-width: none;
    flex-basis: 100%;
  }

  .page-hero-copy > p:last-child,
  .page-hero-badge strong {
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 640px) {
  .app-shell,
  .login-shell {
    padding: 14px;
  }

  .login-shell {
    justify-items: center;
    background-position: center center;
  }

  .sidebar,
  .panel,
  .page-hero-badge,
  .product-card,
  .login-panel {
    border-radius: 22px;
  }

  .stats-grid,
  .execution-overview,
  .execution-filters,
  .profit-toolbar,
  .profit-config-form,
  .profit-summary-grid,
  .roas-form,
  .inline-fields,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .knowledge-toolbar-actions,
  .knowledge-source-list,
  .knowledge-category-list,
  .knowledge-ai-header-actions,
  .knowledge-ai-inline-actions,
  .knowledge-ai-footer-actions {
    grid-template-columns: 1fr;
  }

  .knowledge-detail-head {
    display: grid;
  }

  .knowledge-detail-actions {
    justify-content: flex-start;
  }

  .knowledge-ai-preview-list {
    grid-template-columns: 1fr;
  }

  .meeting-card-head {
    display: grid;
  }

  .product-summary,
  .product-detail-panel {
    padding: 16px;
  }
}
