:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --text: #17211d;
  --muted: #697670;
  --line: #dce5e1;
  --primary: #1d7f65;
  --primary-strong: #115f4a;
  --accent: #e2a93b;
  --danger: #c34a36;
  --blue: #2d6cdf;
  --shadow: 0 18px 40px rgba(35, 62, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans KR",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    Roboto,
    Arial,
    sans-serif;
  font-size: 14px;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: #17211d;
  color: #f8fbf9;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  font-weight: 800;
}

.brand strong,
.brand span,
.sidebar-status strong,
.sidebar-status span {
  display: block;
}

.brand span,
.sidebar-status span {
  margin-top: 3px;
  color: #aebbb6;
  font-size: 13px;
}

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

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

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

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

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #53d388;
  box-shadow: 0 0 0 6px rgba(83, 211, 136, 0.13);
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 28px);
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
}

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

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 15px;
  font-weight: 700;
}

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

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--line);
}

.text-button {
  background: transparent;
  color: var(--primary-strong);
}

.danger-text {
  color: var(--danger);
}

.icon-button {
  width: 42px;
  padding: 0;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric-card,
.panel,
.campaign-card,
.ticket-column,
.todo-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

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

.metric-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 32px;
  line-height: 1;
}

.positive {
  color: var(--primary-strong) !important;
}

.dashboard-layout,
.seo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.panel {
  padding: 20px;
}

.checklist,
.timeline,
.audit-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.check-item,
.activity-item,
.audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.check-item label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e8eee9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ready {
  background: #dff4e8;
  color: #126141;
}

.badge.review {
  background: #fff0cf;
  color: #795513;
}

.badge.issue {
  background: #fde2dd;
  color: #8d2f20;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
}

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

.campaign-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.source-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: var(--surface-soft);
}

.source-banner strong,
.source-banner span {
  display: block;
}

.source-banner span {
  margin-top: 5px;
  color: var(--muted);
}

.source-banner a,
.todo-card a {
  color: var(--primary-strong);
  font-weight: 800;
}

.campaign-card {
  overflow: hidden;
}

.campaign-visual {
  height: 130px;
  background:
    linear-gradient(120deg, rgba(29, 127, 101, 0.82), rgba(226, 169, 59, 0.72)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=900&q=80");
  background-size: cover;
  background-position: center;
}

.campaign-card:nth-child(2) .campaign-visual {
  background:
    linear-gradient(120deg, rgba(45, 108, 223, 0.8), rgba(29, 127, 101, 0.55)),
    url("https://images.unsplash.com/photo-1552664730-d307ca884978?auto=format&fit=crop&w=900&q=80");
  background-size: cover;
  background-position: center;
}

.campaign-card:nth-child(3) .campaign-visual {
  background:
    linear-gradient(120deg, rgba(195, 74, 54, 0.72), rgba(226, 169, 59, 0.55)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=900&q=80");
  background-size: cover;
  background-position: center;
}

.campaign-body {
  padding: 16px;
}

.campaign-body h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.campaign-body p {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.progress-track {
  height: 10px;
  margin: 18px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e9e6;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  background: #dff4e8;
  color: #126141;
  font-weight: 800;
}

.meta-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.password-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.password-form .primary-button {
  justify-self: start;
}

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

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

input[readonly] {
  background: #f5f8f7;
  color: var(--muted);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

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

.toggle-row {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 9px;
  color: var(--text);
}

.toggle-row input,
.permission-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.permission-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.permission-fieldset legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.permission-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-soft);
  color: var(--text);
}

.permission-card span,
.user-name-cell strong,
.user-name-cell span {
  display: block;
}

.permission-card small,
.user-name-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.form-actions,
.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-badge.ready {
  background: #dff4e8;
  color: #126141;
}

.status-badge.issue {
  background: #fde2dd;
  color: #8d2f20;
}

.kanban,
.todo-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.ticket-column,
.todo-column {
  min-height: 320px;
  padding: 16px;
}

.ticket-column h3,
.todo-column h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.ticket,
.todo-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.ticket + .ticket,
.todo-card + .todo-card {
  margin-top: 10px;
}

.ticket strong,
.ticket span,
.todo-card strong,
.todo-card span {
  display: block;
}

.ticket span,
.todo-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.todo-meta span {
  margin-top: 0;
}

.todo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.modal {
  width: min(440px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(23, 33, 29, 0.44);
}

.modal form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.modal menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(16px);
  max-width: min(380px, calc(100vw - 44px));
  border-radius: 8px;
  padding: 13px 16px;
  background: #17211d;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

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

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(23, 33, 29, 0.9), rgba(23, 33, 29, 0.42)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1500&q=82");
  background-position: center;
  background-size: cover;
}

.login-shell {
  width: min(460px, 100%);
}

.login-panel {
  display: grid;
  gap: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-brand {
  color: var(--text);
}

.login-brand span {
  color: var(--muted);
}

.login-copy {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
}

.remember-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.remember-user input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.login-password-toggle {
  justify-self: start;
  width: 100%;
}

.password-change-panel {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.password-change-form {
  gap: 12px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

.login-home-link {
  justify-self: start;
  padding: 0;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    padding: 14px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
  }

  .sidebar-status {
    display: none;
  }

  .metric-grid,
  .campaign-grid,
  .password-grid,
  .form-grid,
  .permission-list,
  .kanban,
  .todo-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .seo-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 18px;
  }

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

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .primary-button {
    flex: 1;
  }

  .metric-grid,
  .campaign-grid,
  .password-grid,
  .form-grid,
  .permission-list,
  .kanban,
  .todo-board {
    grid-template-columns: 1fr;
  }

  .source-banner,
  .check-item,
  .activity-item,
  .audit-item {
    align-items: flex-start;
    flex-direction: column;
  }
}
