:root {
  --bg: #f6f4ef;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --navy: #102238;
  --navy-soft: #1a3855;
  --teal: #0d8f8a;
  --teal-soft: #dff4ef;
  --mint: #edf8f2;
  --coral: #ee765f;
  --amber: #f1b85a;
  --sage: #94ad8b;
  --ink: #15283b;
  --muted: #6f7f8c;
  --line: #e3ded3;
  --shadow: 0 18px 42px rgba(16, 34, 56, 0.1);
  --shadow-soft: 0 8px 22px rgba(16, 34, 56, 0.08);
  --radius: 8px;
  --thai: "Noto Sans Thai", sans-serif;
  --display: "Chakra Petch", "Noto Sans Thai", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(16, 34, 56, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(16, 34, 56, 0.03) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--thai);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: #102238;
  color: #f9fbfb;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e6fff7;
  color: var(--navy);
  font-family: var(--display);
  font-weight: 700;
}

.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 18px;
}

.brand span {
  color: #afc2cb;
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: #c9d7df;
  text-align: left;
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--teal);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-note svg {
  width: 18px;
}

.sidebar-note p {
  margin: 8px 0 0;
  color: #d8e4e7;
  font-size: 13px;
  line-height: 1.55;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 88px;
  padding: 22px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(246, 244, 239, 0.86);
  border-bottom: 1px solid rgba(227, 222, 211, 0.8);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal);
  font: 700 12px var(--display);
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: 0;
  color: var(--navy);
}

h1 {
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.05;
}

h2 {
  font-size: 25px;
}

h3 {
  font-size: 18px;
}

p {
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  width: min(360px, 40vw);
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.search-box svg {
  width: 17px;
  color: var(--muted);
}

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

.icon-button,
.primary-button,
.ghost-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--navy);
  color: #ffffff;
}

.primary-button {
  background: var(--navy);
  color: #ffffff;
  box-shadow: 0 9px 20px rgba(16, 34, 56, 0.2);
}

.primary-button:hover,
.icon-button:hover {
  background: var(--navy-soft);
}

.ghost-button {
  background: var(--teal-soft);
  color: var(--navy);
}

.workspace {
  padding: 28px 30px 48px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: liftIn 0.28s ease both;
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.section-heading p,
.card p {
  margin: 5px 0 0;
  line-height: 1.55;
}

.soft-pill,
.status,
.mini-label {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.soft-pill {
  padding: 8px 12px;
  background: var(--panel);
  color: var(--navy);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-weight: 700;
}

.soft-pill svg {
  width: 16px;
}

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

.metric-card,
.card {
  border: 1px solid rgba(227, 222, 211, 0.85);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  min-height: 130px;
  padding: 17px;
}

.metric-card.accent {
  background: #e6fbf6;
  border-color: #c4e9de;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 12px 0 4px;
  color: var(--navy);
  font: 700 34px var(--display);
}

.metric-card small {
  color: var(--muted);
}

.overview-grid,
.two-column,
.score-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 16px;
}

.card {
  padding: 18px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.task-list,
.stack-list,
.plan-list,
.score-list {
  display: grid;
  gap: 10px;
}

.task-item,
.research-item,
.plan-item,
.report-card,
.score-item,
.prompt-card,
.export-card,
.decision-card,
.idea-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.task-item,
.research-item,
.plan-item {
  padding: 13px;
  display: grid;
  gap: 8px;
}

.task-item-header,
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-item strong,
.research-item strong,
.plan-item strong {
  color: var(--navy);
}

.mini-row {
  color: var(--muted);
  font-size: 13px;
}

.recommendation-card {
  background:
    linear-gradient(135deg, rgba(13, 143, 138, 0.12), transparent 42%),
    #fffefa;
}

.recommendation-card h3 {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.3;
}

.mini-label {
  padding: 5px 9px;
  background: #f3efe4;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.form-card h3 {
  margin-bottom: 14px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

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

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 143, 138, 0.12);
}

.status {
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
  background: #eef1f1;
}

.status.Ready,
.status.Posted,
.status.Validated,
.status.Use,
.status.Repeat,
.status.Boost {
  background: var(--teal-soft);
  color: #08706c;
}

.status.Draft,
.status.Idea,
.status.New,
.status.Improve {
  background: #fff1d6;
  color: #80601f;
}

.status.Stop,
.status.Parked {
  background: #ffe8e2;
  color: #9d3f2e;
}

.status.Approved,
.status.Scheduled,
.status.Review {
  background: var(--teal-soft);
  color: #08706c;
}

.status.Needs {
  background: #fff1d6;
  color: #80601f;
}

.idea-board,
.prompt-grid,
.export-grid,
.report-grid,
.decision-lanes,
.studio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.idea-card,
.prompt-card,
.export-card,
.decision-card,
.report-card,
.score-item,
.draft-card,
.asset-card,
.approval-card,
.publish-card {
  padding: 16px;
}

.draft-card,
.asset-card,
.approval-card,
.publish-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  box-shadow: var(--shadow-soft);
}

.idea-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.idea-card h3,
.prompt-card h3,
.export-card h3,
.decision-card h3,
.report-card h3,
.score-item h3 {
  font-size: 17px;
  line-height: 1.35;
}

.idea-meta,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f3efe4;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.idea-card p {
  margin: 0;
}

.idea-card footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.compact-action {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.compact-action svg {
  width: 15px;
  height: 15px;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: var(--navy);
  color: #ffffff;
}

.calendar-view,
.report-mode {
  display: none;
}

.calendar-view.active,
.report-mode.active {
  display: block;
}

#calendarGrid {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

#calendarGrid.active {
  display: grid;
}

.calendar-day {
  min-height: 148px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffefa;
  box-shadow: var(--shadow-soft);
}

.calendar-day strong {
  font-family: var(--display);
  color: var(--navy);
}

.calendar-post {
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--mint);
  font-size: 12px;
}

.calendar-post b {
  display: block;
  color: var(--navy);
}

.content-table {
  display: grid;
  gap: 9px;
}

.content-row {
  display: grid;
  grid-template-columns: 110px 1.4fr 0.8fr 0.8fr 110px;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  box-shadow: var(--shadow-soft);
}

.content-row small {
  color: var(--muted);
}

.upload-card {
  min-height: 230px;
  display: grid;
  place-items: center;
  text-align: center;
}

.upload-card svg {
  width: 46px;
  height: 46px;
  color: var(--teal);
}

.report-card {
  display: grid;
  gap: 12px;
}

.score-number {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #ffffff;
  font: 700 28px var(--display);
}

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

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.metric-strip span {
  padding: 8px;
  border-radius: 8px;
  background: #f5f1e8;
  color: var(--muted);
  font-size: 12px;
}

.metric-strip b {
  display: block;
  color: var(--navy);
  font-size: 15px;
}

.score-explain {
  align-self: start;
}

.brand-brain-layout,
.writer-layout,
.approval-layout,
.publish-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: start;
}

.brand-memory-card {
  min-height: 100%;
}

.memory-stack {
  display: grid;
  gap: 10px;
}

.memory-stack div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.memory-stack span {
  display: block;
  margin-bottom: 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.memory-stack strong {
  color: var(--navy);
  overflow-wrap: anywhere;
}

.memory-stack p {
  margin: 0;
  overflow-wrap: anywhere;
}

.draft-list,
.approval-list,
.publish-list {
  display: grid;
  gap: 12px;
}

.draft-card {
  display: grid;
  gap: 12px;
}

.draft-copy {
  padding: 14px;
  border-radius: 8px;
  background: #f8f3ea;
  border: 1px solid #ece3d4;
}

.draft-copy strong,
.draft-copy b {
  color: var(--navy);
}

.draft-copy p {
  margin: 8px 0;
}

.asset-card {
  display: grid;
  gap: 12px;
  min-height: 260px;
}

.asset-preview {
  min-height: 115px;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(13, 143, 138, 0.16), transparent 55%),
    repeating-linear-gradient(0deg, rgba(16, 34, 56, 0.05), rgba(16, 34, 56, 0.05) 1px, transparent 1px, transparent 14px),
    #fff8e8;
  border: 1px solid #eadfc9;
}

.asset-preview span {
  color: var(--teal);
  font-weight: 800;
}

.asset-preview strong {
  color: var(--navy);
  font: 700 22px var(--display);
}

.checklist-card {
  align-self: start;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.weight-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.weight-row strong {
  color: var(--teal);
}

.score-item {
  display: grid;
  gap: 12px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: #ece7dc;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
}

.decision-card {
  min-height: 210px;
}

.decision-card .icon-chip {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  color: var(--teal);
  margin-bottom: 12px;
}

.prompt-card {
  display: grid;
  gap: 12px;
  background: #fffefa;
}

.prompt-card textarea,
.export-card textarea {
  min-height: 150px;
  font-size: 13px;
  line-height: 1.55;
}

.copy-button {
  justify-self: start;
}

.export-card {
  display: grid;
  gap: 10px;
}

.settings-card {
  max-width: 850px;
}

.integration-card {
  margin-top: 16px;
}

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

.settings-hint {
  margin: 12px 0 0;
  font-size: 13px;
}

.danger-button {
  background: #ffe8e2;
  color: #9d3f2e;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
  z-index: 30;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .brand div:not(.brand-mark),
  .nav-item span,
  .sidebar-note p {
    display: none;
  }

  .sidebar {
    padding: 18px 12px;
  }

  .nav-item {
    justify-content: center;
  }

  .metric-grid,
  .idea-board,
  .prompt-grid,
  .export-grid,
  .report-grid,
  .decision-lanes,
  .studio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-grid,
  .two-column,
  .score-layout,
  .brand-brain-layout,
  .writer-layout,
  .approval-layout,
  .publish-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

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

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 48px;
  }

  .sidebar-note {
    display: none;
  }

  .topbar {
    position: static;
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .search-box {
    width: 100%;
  }

  .workspace {
    padding: 18px;
  }

  .section-heading {
    display: grid;
  }

  .metric-grid,
  .idea-board,
  .prompt-grid,
  .export-grid,
  .report-grid,
  .decision-lanes,
  .studio-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  #calendarGrid.active {
    grid-template-columns: 1fr;
  }

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