@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

/* 내 계정 화면 (좌측 사이드바 + 제작자 프로필 편집 + 작업 공간/세션 요약) */
:root {
  --ac-bg: #f6f8f4;
  --ac-panel: #ffffff;
  --ac-sidebar-bg: #ffffff;
  --ac-sidebar-w: 236px;
  --ac-sidebar-rail: 60px;
  --ac-line: #e3e8e1;
  --ac-input-line: #748078;
  --ac-text: #20352d;
  --ac-muted: #748078;
  --ac-green: #2a624b;
  --ac-green-deep: #20352d;
  --ac-green-soft: #edf3eb;
  --ac-danger: #a83b32;
  --ac-danger-bright: #d93025;
  --ac-danger-bg: #fdf1f0;

  /* studio-i18n.css 테마 토큰 연동 */
  --mc-bg: var(--ac-bg);
  --mc-panel: var(--ac-panel);
  --mc-line: var(--ac-line);
  --mc-text: var(--ac-text);
  --mc-muted: var(--ac-muted);
  --mc-green: var(--ac-green);
  --mc-green-soft: var(--ac-green-soft);
}

* { box-sizing: border-box }

html, body {
  height: 100%;
  margin: 0;
  background: var(--ac-bg);
  color: var(--ac-text);
  font-family: 'Noto Sans KR', system-ui, sans-serif;
}

body { font-size: 14px }
button { font: inherit; color: inherit; cursor: pointer }
[hidden] { display: none !important }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.ac-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── 좌측 접이식 사이드바 ─────────────── */
.ac-nav-backdrop { display: none }

.ac-sidebar {
  flex: 0 0 var(--ac-sidebar-w);
  width: var(--ac-sidebar-w);
  background: var(--ac-sidebar-bg);
  border-right: 1px solid var(--ac-line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .2s ease, flex-basis .2s ease;
}

.ac-sidebar-head {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border-bottom: 1px solid var(--ac-line);
}

.ac-nav-toggle { flex: none }
.ac-sidebar-brand { white-space: nowrap; overflow: hidden }

.ac-sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 10px;
}

.ac-workspace-label {
  font-size: 10px;
  font-weight: 600;
  color: #939d96;
  letter-spacing: 1.4px;
  padding: 4px 12px 10px;
  white-space: nowrap;
  transition: opacity .15s ease;
}

.ac-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ac-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #768078;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}

.ac-nav-item:hover { background: var(--ac-green-soft); color: var(--ac-green) }
.ac-nav-item.active { background: var(--ac-green-soft); color: var(--ac-green); font-weight: 700 }

.ac-nav-item:focus-visible,
.ac-account-card:focus-visible,
.ac-nav-toggle:focus-visible,
.ac-mobile-nav-btn:focus-visible,
.ac-btn:focus-visible,
.ac-quick-link:focus-visible,
.ac-dialog-btn:focus-visible,
.ac-icon:focus-visible {
  outline: 2px solid var(--ac-green);
  outline-offset: 2px;
}

.ac-nav-ico {
  flex: none;
  width: 22px;
  text-align: center;
  font-size: 18px;
  line-height: 1;
  color: inherit;
}

.ac-nav-item:hover .ac-nav-ico,
.ac-nav-item.active .ac-nav-ico { color: var(--ac-green) }

.ac-sidebar-foot {
  flex: none;
  padding: 12px 10px;
  border-top: 1px solid var(--ac-line);
}

.ac-account-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--ac-text);
  text-decoration: none;
  transition: background .15s ease;
}

.ac-account-card:hover { background: var(--ac-green-soft) }

.ac-account-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e9eee4;
  color: var(--ac-green);
  font-size: 14px;
  font-weight: 700;
}

.ac-account-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ac-account-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ac-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-account-sub {
  font-size: 11px;
  color: var(--ac-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 우측 작업공간 ─────────────────────── */
.ac-workspace {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  height: 100%;
  overflow: hidden;
}

.ac-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse 65% 40% at 50% 0%, #e9eee3 0%, #f1f5ed 38%, var(--ac-bg) 80%);
  container-type: inline-size;
  container-name: mainpane;
}

.ac-main-head {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  background: #ffffffa6;
  border-bottom: 1px solid var(--ac-line);
}

.ac-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ac-icon.ac-mobile-nav-btn { display: none }
.ac-brand.ac-chat-brand { display: none }

.ac-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ac-text);
  text-decoration: none;
  font-size: 15px;
}

.ac-brand b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ac-green);
  color: #fff;
  font-size: 14px;
}

.ac-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ac-muted);
  font-size: 18px;
}

.ac-icon:hover { background: var(--ac-green-soft); color: var(--ac-green) }

.ac-crumb {
  font-size: 14px;
  font-weight: 700;
  color: var(--ac-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-head-actions { display: flex; gap: 8px; align-items: center; flex: none }

.ac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid var(--ac-line);
  border-radius: 18px;
  background: #fff;
  color: var(--ac-text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.ac-btn:hover { background: var(--ac-green-soft); border-color: #cfd9cc; color: var(--ac-green) }
.ac-btn.primary { background: var(--ac-green); border-color: var(--ac-green); color: #fff }
.ac-btn.primary:hover { background: var(--ac-green-deep); border-color: var(--ac-green-deep); color: #fff }
.ac-btn.danger { color: var(--ac-danger); border-color: #e6c8c4 }
.ac-btn.danger:hover { background: var(--ac-danger-bg); border-color: #d99d96; color: #8c2820 }

/* ── 본문 (계정 설정 & 상태 요약) ──────── */
.ac-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 26px 28px 44px;
}

.ac-intro,
.ac-layout {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.ac-intro { margin-bottom: 20px }

.ac-intro h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  color: var(--ac-text);
  letter-spacing: -.3px;
}

.ac-intro p {
  margin: 0;
  color: var(--ac-muted);
  font-size: 13px;
  line-height: 1.5;
}

.ac-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 1fr);
  gap: 18px;
  align-items: start;
}

.ac-card {
  background: var(--ac-panel);
  border: 1px solid var(--ac-line);
  border-radius: 16px;
  padding: 22px 24px;
}

.ac-card-head { margin-bottom: 18px }

.ac-card-head h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ac-text);
}

.ac-card-desc {
  margin: 0;
  color: var(--ac-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ── 프로필 폼 & 상호작용 후 검증 스타일 ─── */
.ac-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 14px;
}

.ac-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

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

.ac-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ac-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ac-text);
  line-height: 1.4;
}

.ac-req {
  color: var(--ac-danger-bright);
  font-weight: 700;
}

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

.ac-char-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--ac-muted);
}

.ac-input,
.ac-textarea {
  width: 100%;
  font: inherit;
  font-size: max(1rem, 1em);
  line-height: 1.5;
  color: var(--ac-text);
  background: #ffffff;
  border: 1px solid var(--ac-input-line);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.ac-input {
  min-height: 44px;
}

.ac-textarea {
  min-height: 112px;
  resize: vertical;
}

.ac-input::placeholder,
.ac-textarea::placeholder {
  color: #88938c;
}

.ac-input:focus-visible,
.ac-textarea:focus-visible {
  outline: 2px solid var(--ac-green);
  outline-offset: 2px;
  border-color: var(--ac-green);
}

/* 상호작용 완료(:user-invalid) 이후에만 오류 표시 */
:is(.ac-input, .ac-textarea):is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--ac-danger-bright);
  background-color: var(--ac-danger-bg);
}

:is(.ac-input, .ac-textarea):is(:user-invalid, .user-invalid-fallback):focus-visible {
  outline-color: var(--ac-danger-bright);
}

.ac-error-msg {
  display: none;
  align-items: flex-start;
  gap: 5px;
  color: var(--ac-danger);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

:is(.ac-input, .ac-textarea):is(:user-invalid, .user-invalid-fallback) + .ac-error-msg {
  display: flex;
}

.ac-form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--ac-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ac-save-note {
  font-size: 12px;
  color: var(--ac-muted);
}

.ac-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ac-btn-group .ac-btn {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 10px;
}

.ac-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ac-bg);
  border: 1px solid var(--ac-line);
  font-size: 12px;
  line-height: 1.5;
}

.ac-note strong {
  display: block;
  color: var(--ac-text);
  margin-bottom: 2px;
}

.ac-note p {
  margin: 0;
  color: var(--ac-muted);
}

/* ── 우측 요약 & 상태 카드 ──────────────── */
.ac-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ac-summary-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ac-line);
}

.ac-summary-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ac-green-soft);
  color: var(--ac-green);
  font-size: 20px;
  font-weight: 700;
}

.ac-summary-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ac-summary-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ac-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-summary-company {
  font-size: 12px;
  color: var(--ac-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-auth-badge {
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--ac-green-soft);
  color: var(--ac-green);
  font-size: 11px;
  font-weight: 700;
}

.ac-auth-badge.is-auth {
  background: var(--ac-green);
  color: #ffffff;
}

.ac-status-list {
  margin: 12px 0 0;
  padding: 0;
}

.ac-status-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #edf0ea;
  font-size: 13px;
}

.ac-status-row:last-child { border-bottom: 0 }

.ac-status-row dt {
  color: var(--ac-muted);
  font-weight: 600;
  flex: none;
}

.ac-status-row dd {
  margin: 0;
  color: var(--ac-text);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.ac-side-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ac-line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ac-side-actions .ac-btn {
  flex: 1 1 120px;
  min-height: 38px;
  border-radius: 10px;
}

.ac-side-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ac-text);
}

.ac-side-desc {
  margin: 0 0 14px;
  color: var(--ac-muted);
  font-size: 12px;
  line-height: 1.55;
}

.ac-quick-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ac-quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--ac-line);
  border-radius: 10px;
  background: var(--ac-bg);
  color: var(--ac-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.ac-quick-link:hover {
  background: var(--ac-green-soft);
  border-color: #cfd9cc;
  color: var(--ac-green);
}

/* ── 네이티브 확인 모달 & 토스트 ───────── */
.ac-dialog {
  border: 1px solid var(--ac-line);
  border-radius: 16px;
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  background: #fff;
  color: var(--ac-text);
  box-shadow: 0 20px 50px #20352d30;
}

.ac-dialog:modal {
  overscroll-behavior: contain;
}

.ac-dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: #20352d4d;
}

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

.ac-dialog-head h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ac-text);
}

.ac-dialog-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ac-dialog-text {
  margin: 0;
  font-size: 13px;
  color: var(--ac-text);
  line-height: 1.55;
}

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

.ac-dialog-btn {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--ac-line);
  border-radius: 10px;
  background: #fff;
  color: var(--ac-text);
  font-size: 13px;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.ac-dialog-btn:hover { background: var(--ac-green-soft); border-color: #cfd9cc; color: var(--ac-green) }
.ac-dialog-btn.danger { color: var(--ac-danger); border-color: #e6c8c4 }
.ac-dialog-btn.danger:hover { background: var(--ac-danger-bg); border-color: #d99d96; color: #8c2820 }

.ac-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 20px;
  background: var(--ac-text);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 60;
}

.ac-toast.show { opacity: 1; transform: translate(-50%, 0) }

/* ── 반응형 & 사이드바 접힘 ─────────────── */
@media (pointer: coarse) {
  .ac-input,
  .ac-textarea {
    min-height: 48px;
  }
}

@media (max-width: 920px) {
  .ac-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .ac-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .ac-card {
    padding: 18px 16px;
  }
}

@media (min-width: 768px) {
  .ac-shell.nav-collapsed .ac-sidebar {
    flex-basis: var(--ac-sidebar-rail);
    width: var(--ac-sidebar-rail);
  }
  .ac-shell.nav-collapsed .ac-sidebar-head { justify-content: center; padding: 0 }
  .ac-shell.nav-collapsed .ac-brand.ac-sidebar-brand { display: none }
  .ac-shell.nav-collapsed .ac-brand.ac-chat-brand { display: flex }
  .ac-shell.nav-collapsed .ac-sidebar-scroll { padding: 10px 0 }
  .ac-shell.nav-collapsed .ac-workspace-label {
    height: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
  }
  .ac-shell.nav-collapsed .ac-nav { align-items: center; gap: 6px }
  .ac-shell.nav-collapsed .ac-nav-item {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }
  .ac-shell.nav-collapsed .ac-nav-txt { display: none }
  .ac-shell.nav-collapsed .ac-sidebar-foot {
    padding: 12px 0;
    display: flex;
    justify-content: center;
  }
  .ac-shell.nav-collapsed .ac-account-card { padding: 4px; justify-content: center }
  .ac-shell.nav-collapsed .ac-account-meta { display: none }
}

@media (max-width: 767px) {
  .ac-shell { flex-direction: column; height: auto; min-height: 100vh; overflow: visible }
  .ac-workspace { flex-direction: column; height: auto; min-height: 100vh; overflow: visible }
  .ac-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    max-width: 82vw;
    height: 100vh;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 12px 0 32px #20352d24;
  }
  .ac-shell.nav-mobile-open .ac-sidebar { transform: translateX(0) }
  .ac-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: #20352d4d;
    opacity: 0;
    transition: opacity .2s ease;
  }
  .ac-shell.nav-mobile-open .ac-nav-backdrop { display: block; opacity: 1 }
  .ac-icon.ac-mobile-nav-btn { display: grid }
  .ac-brand.ac-chat-brand { display: flex }
  .ac-crumb { display: none }
  .ac-main-head { height: auto; min-height: 56px; padding: 8px 14px; flex-wrap: wrap; gap: 8px }
  .ac-head-actions { gap: 6px; margin-left: auto }
  .ac-body { padding: 18px 16px 36px }
  .ac-main { flex: none; min-height: 100vh }
}

@media (prefers-reduced-motion: reduce) {
  .ac-sidebar,
  .ac-nav-backdrop,
  .ac-workspace-label,
  .ac-input,
  .ac-textarea,
  .ac-btn { transition: none }
}
