:root {
  --brand-red: #06c755;
  --line-green: #06c755;
  --deep-green: #018844;
  --mint: #e9f8ef;
  --gold: #ffc107;
  --blush: #f4fbf7;
  --ink: #1f2a24;
  --muted: #66736b;
  --line: #dfe9e3;
  --panel: #ffffff;
  --page: #f5f8f6;
  --ok: #0f8a5f;
  --danger: #c7342f;
  --shadow: 0 12px 28px rgba(22, 85, 48, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f1fbf5 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bit-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background:
    linear-gradient(90deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%),
    linear-gradient(0deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%),
    var(--line-green);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.08);
}

.brand-lockup p,
.eyebrow {
  margin: 0;
  color: var(--deep-green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-lockup h1,
.topbar h2,
.panel-heading h3 {
  margin: 0;
  line-height: 1.2;
}

.brand-lockup h1 {
  font-size: 1.28rem;
}

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

.nav-list a {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.nav-list a:hover,
.nav-list a:focus {
  background: var(--mint);
  border-color: #bdeccc;
  outline: none;
}

.side-card {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid #bdeccc;
  border-radius: 8px;
  background: #ffffff;
}

.side-card p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--ok);
}

.workspace {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

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

.primary-button,
.secondary-button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  min-height: 42px;
}

.primary-button {
  color: #ffffff;
  background: var(--line-green);
}

.secondary-button {
  color: var(--deep-green);
  background: #ffffff;
  border-color: #bdeccc;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card,
.panel,
.setting-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: rgba(6, 199, 85, 0.12);
}

.metric-card span,
.setting-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
}

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

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

.story-card {
  min-height: 250px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.story-visual {
  position: relative;
  height: 130px;
  background: var(--mint);
  overflow: hidden;
}

.story-visual::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(1, 136, 68, 0.12);
}

.story-visual span {
  position: absolute;
  display: block;
  border-radius: 999px;
  background: var(--line-green);
}

.live-visual span:nth-child(1) {
  left: 32px;
  top: 34px;
  width: 78px;
  height: 28px;
}

.live-visual span:nth-child(2) {
  left: 66px;
  top: 72px;
  width: 118px;
  height: 28px;
  background: #ffffff;
  border: 2px solid var(--line-green);
}

.live-visual span:nth-child(3) {
  right: 26px;
  top: 32px;
  width: 42px;
  height: 42px;
  background: var(--gold);
}

.stock-visual span:nth-child(1),
.stock-visual span:nth-child(2),
.stock-visual span:nth-child(3) {
  bottom: 28px;
  width: 36px;
  border-radius: 8px 8px 0 0;
}

.stock-visual span:nth-child(1) {
  left: 42px;
  height: 42px;
}

.stock-visual span:nth-child(2) {
  left: 92px;
  height: 68px;
  background: var(--deep-green);
}

.stock-visual span:nth-child(3) {
  left: 142px;
  height: 54px;
  background: var(--gold);
}

.pos-visual span:nth-child(1) {
  left: 36px;
  top: 34px;
  width: 140px;
  height: 76px;
  border-radius: 8px;
}

.pos-visual span:nth-child(2) {
  left: 56px;
  top: 52px;
  width: 82px;
  height: 12px;
  background: #ffffff;
}

.pos-visual span:nth-child(3) {
  right: 34px;
  bottom: 28px;
  width: 52px;
  height: 52px;
  background: var(--gold);
}

.message-visual span:nth-child(1),
.message-visual span:nth-child(2) {
  left: 34px;
  width: 128px;
  height: 32px;
}

.message-visual span:nth-child(1) {
  top: 34px;
}

.message-visual span:nth-child(2) {
  top: 76px;
  left: 74px;
  background: #ffffff;
  border: 2px solid var(--line-green);
}

.message-visual span:nth-child(3) {
  right: 34px;
  top: 30px;
  width: 30px;
  height: 30px;
  background: var(--gold);
}

.story-copy {
  padding: 14px;
}

.story-copy h3 {
  margin: 4px 0 6px;
  font-size: 1.05rem;
}

.story-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel {
  padding: 18px;
}

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

.panel-heading h3 {
  margin-top: 4px;
  font-size: 1.25rem;
}

.panel-heading > span {
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--deep-green);
  font-size: 0.82rem;
  font-weight: 700;
}

.form-grid,
.compact-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

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

.compact-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 42px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-green);
  outline: 3px solid rgba(6, 199, 85, 0.12);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--ink);
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
}

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

.data-list {
  display: grid;
  gap: 8px;
}

.data-list h4 {
  margin: 14px 0 4px;
  font-size: 0.95rem;
}

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

.data-row strong {
  display: block;
  font-size: 0.96rem;
}

.data-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.row-meta {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 120px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.success-pill,
.danger-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.success-pill {
  color: var(--ok);
  background: var(--mint);
}

.danger-pill {
  color: var(--danger);
  background: #fff0ef;
}

.empty-state,
.notice-line {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.notice-line {
  margin-bottom: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.setting-card {
  padding: 14px;
  box-shadow: none;
}

.setting-card strong {
  display: block;
  margin-top: 4px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

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

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

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-card {
    margin-top: 0;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid,
  .story-grid,
  .form-grid,
  .compact-form,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .data-row {
    align-items: start;
    flex-direction: column;
  }

  .row-meta {
    justify-content: start;
    text-align: left;
  }
}

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

  .panel-heading {
    flex-direction: column;
  }

  .panel-heading > span {
    white-space: normal;
  }
}
