:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --ink: #182230;
  --muted: #667085;
  --line: #d8e0ea;
  --blue: #2563eb;
  --blue-soft: #e9f0ff;
  --green: #13805c;
  --green-soft: #e5f6ef;
  --amber: #b7791f;
  --amber-soft: #fff4d8;
  --red: #b42318;
  --red-soft: #feecea;
  --violet: #6842c2;
  --violet-soft: #f0ebff;
  --shadow: 0 18px 48px rgba(24, 34, 48, 0.12);
  --sidebar: #162033;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.28), rgba(238,243,247,0.96)),
    var(--bg);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 18px;
  color: #f8fafc;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  padding: 0 6px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f80ed, #18a676);
  color: #fff;
  font-weight: 950;
  font-size: 23px;
}

.brand strong {
  display: block;
  font-size: 17px;
  line-height: 1.2;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: #a9b4c6;
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  color: #d7deea;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.sidebar-note {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  color: #dce5f2;
  background: rgba(255, 255, 255, 0.08);
  line-height: 1.55;
}

.sidebar-note b {
  font-size: 14px;
}

.sidebar-note span {
  color: #b8c4d5;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 950;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 950;
}

h3 {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 950;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.btn,
.text-btn,
.icon-btn,
.category-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn {
  min-height: 40px;
  padding: 9px 13px;
  font-weight: 900;
}

.btn.primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.btn.primary:hover {
  background: #1d4ed8;
}

.btn.subtle {
  color: #344054;
  background: #fff;
  border-color: var(--line);
}

.btn.subtle:hover {
  border-color: #aab7c7;
}

.btn.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f4bab6;
}

.btn.danger:hover {
  border-color: var(--red);
}

.file-btn {
  display: inline-grid;
  place-items: center;
}

#importFile {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(24, 34, 48, 0.05);
}

.section-head p {
  margin-top: 8px;
  max-width: 820px;
  color: var(--muted);
  line-height: 1.55;
}

.status-pill {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #14503e;
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
}

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

.metric-card,
.panel,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(24, 34, 48, 0.05);
}

.metric-card {
  min-height: 120px;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.metric-card b {
  font-size: 36px;
  line-height: 1;
  font-weight: 950;
}

.metric-card small {
  color: #475467;
  line-height: 1.45;
}

.two-column,
.review-grid,
.playbook-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.review-grid {
  align-items: start;
}

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

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.text-btn {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 950;
}

.text-btn:hover {
  border-color: var(--blue);
}

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

.empty-state {
  padding: 18px;
  border: 1px dashed #b8c3d1;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-alt);
  line-height: 1.55;
}

.list-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.list-item .item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.list-item strong {
  line-height: 1.35;
}

.list-item p {
  color: #475467;
  font-size: 14px;
  line-height: 1.55;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #344054;
  background: #eef2f6;
  font-size: 12px;
  font-weight: 950;
}

.badge.blue {
  color: #183b83;
  background: var(--blue-soft);
}

.badge.green {
  color: #14503e;
  background: var(--green-soft);
}

.badge.amber {
  color: #704d12;
  background: var(--amber-soft);
}

.badge.red {
  color: #84221a;
  background: var(--red-soft);
}

.badge.violet {
  color: #4b2f8d;
  background: var(--violet-soft);
}

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

.loop-grid div {
  min-height: 110px;
  padding: 13px;
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.loop-grid b {
  color: var(--blue);
  font-size: 13px;
}

.loop-grid span {
  font-weight: 950;
}

.loop-grid small {
  color: var(--muted);
  line-height: 1.45;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 170px 170px;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-input,
select,
input,
textarea {
  width: 100%;
  border: 1px solid #cfd8e5;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.search-input,
select,
input {
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  padding: 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(37, 99, 235, 0.16);
  border-color: var(--blue);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(24, 34, 48, 0.05);
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.data-table th {
  color: #344054;
  background: #f1f5f9;
  font-size: 13px;
  font-weight: 950;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table .name-cell {
  min-width: 260px;
}

.name-cell strong {
  display: block;
  margin-bottom: 6px;
}

.name-cell span {
  color: var(--muted);
  font-size: 13px;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.small-btn {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #344054;
  background: #fff;
  font-size: 12px;
  font-weight: 950;
}

.small-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

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

.decision-col {
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.decision-col h4 {
  margin: 0 0 12px;
  font-size: 14px;
}

.decision-col ul {
  margin: 0;
  padding-left: 18px;
  color: #475467;
  line-height: 1.55;
}

.lesson-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
}

.category-panel {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.category-btn {
  min-height: 40px;
  padding: 8px 12px;
  color: #344054;
  background: #fff;
  border-color: var(--line);
  text-align: left;
  font-weight: 900;
}

.category-btn:hover,
.category-btn.is-active {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--blue);
}

.lesson-list {
  display: grid;
  gap: 12px;
}

.lesson-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(24, 34, 48, 0.05);
}

.lesson-card p {
  color: #344054;
  line-height: 1.6;
}

.playbook-grid {
  align-items: stretch;
}

.plain-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: #475467;
  line-height: 1.75;
}

.editor-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(900px, calc(100vh - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.editor-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
}

.editor {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #344054;
  background: #fff;
  border-color: var(--line);
  font-weight: 950;
}

.icon-btn:hover {
  color: var(--red);
  border-color: var(--red);
}

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

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 950;
}

label span {
  display: block;
}

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

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

.editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.editor-actions > div {
  display: flex;
  gap: 8px;
}

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

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

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

  .sidebar-note {
    display: none;
  }

  .topbar,
  .section-head {
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

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

@media (max-width: 760px) {
  .main {
    padding: 16px;
  }

  .sidebar {
    padding: 18px 14px;
  }

  .brand {
    grid-template-columns: 42px 1fr;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .nav-list,
  .metric-grid,
  .two-column,
  .review-grid,
  .playbook-grid,
  .toolbar,
  .lesson-layout,
  .form-grid,
  .loop-grid,
  .decision-board {
    grid-template-columns: 1fr;
  }

  .nav-item {
    min-height: 40px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 21px;
  }

  .section-head,
  .panel,
  .editor {
    padding: 16px;
  }

  .editor-actions {
    flex-direction: column;
  }

  .editor-actions > div {
    justify-content: flex-end;
  }
}
