/* AICS FONT: Naver Barun Gothic / NanumBarunGothic preferred */
:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --green: #16a34a;
  --orange: #f97316;
  --red: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "NanumBarunGothic", "Nanum Barun Gothic", "Naver Barun Gothic", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

.page-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 270px;
  background: #101827;
  color: #fff;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

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

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
}

.brand-sub {
  margin-top: 4px;
  color: #a9b4c7;
  font-size: 12px;
}

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

.nav a {
  padding: 12px 13px;
  border-radius: 12px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 700;
}

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

.side-box {
  margin-top: 28px;
  padding: 15px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: #dbeafe;
}

.side-box b {
  color: #fff;
  font-size: 13px;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px;
}

.hero {
  background: linear-gradient(135deg, #1d4ed8, #0f172a);
  color: #fff;
  border-radius: 22px;
  padding: 24px 28px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  font-size: 12px;
  color: #bfdbfe;
  font-weight: 900;
}

.hero h1 {
  margin: 7px 0 10px;
  font-size: 28px;
  letter-spacing: -1px;
}

.hero p {
  margin: 0;
  max-width: 880px;
  color: #dbeafe;
  line-height: 1.55;
  font-size: 14px;
}

.hero-actions {
  display: flex;
  gap: 9px;
  flex-shrink: 0;
}

.btn {
  border: 0;
  background: #fff;
  color: #1d4ed8;
  padding: 10px 13px;
  border-radius: 11px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.btn.ghost {
  background: rgba(255,255,255,0.13);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
}

.sitemap-search {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
}

.sitemap-btn {
  height: 42px;
  border: 1px solid #168ad5;
  background: #1da1f2;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.sitemap-search input {
  height: 42px;
  border: 1px solid #cbd5e1;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}

.rules-layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 520px minmax(0, 1fr);
  gap: 16px;
}

.rule-list-panel,
.rule-view-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.rule-list-panel {
  padding: 0;
  border-radius: 0;
  height: calc(100vh - 240px);
  overflow: hidden;
}

.rule-view-panel {
  padding: 18px;
  min-width: 0;
  border-radius: 0;
}

.list-head {
  height: 32px;
  padding: 0 8px;
  margin: 0;
  border: 1px solid #d7dee9;
  border-bottom: 0;
  background: #f7f9fc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-head b {
  font-size: 16px;
}

.list-head span {
  color: var(--muted);
  font-size: 12px;
}

.rule-table-wrap {
  border: 1px solid #d7dee9;
  height: calc(100% - 32px);
  overflow: auto;
}

.rule-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.rule-list-table th {
  height: 26px;
  padding: 4px 7px;
  background: #edf2f7;
  color: #334155;
  border-bottom: 1px solid #d7dee9;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

.rule-list-table td {
  height: 24px;
  padding: 4px 7px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.group-row td {
  background: #fef9c3;
  color: #1f2937;
  font-weight: 900;
  border-top: 1px solid #fde68a;
  border-bottom: 1px solid #fde68a;
  height: 25px;
}

.rule-row {
  background: #fff;
  cursor: pointer;
}

.rule-row:hover {
  background: #eff6ff;
}

.rule-row.active {
  background: #dbeafe;
}

.tree-cell {
  width: 100%;
}

.tree-indent {
  display: inline-block;
  width: 18px;
  color: #64748b;
}

.rule-row b {
  display: inline;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 30px !important;
}

.doc-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.doc-toolbar h2 {
  margin: 0;
  font-size: 20px;
}

.doc-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.doc-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.small-btn {
  border: 0;
  padding: 8px 11px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  background: #eff6ff;
  color: #1d4ed8;
}

.small-btn.edit {
  background: #2563eb;
  color: #fff;
}

.small-btn.save {
  background: #16a34a;
  color: #fff;
}

.small-btn.cancel {
  background: #fee2e2;
  color: #991b1b;
}

.markdown-body {
  line-height: 1.68;
  font-size: 14px;
  color: #1f2937;
}

.markdown-body h1 {
  font-size: 24px;
  margin: 0 0 14px;
  letter-spacing: -1px;
}

.markdown-body h2 {
  margin: 18px 0 10px;
  font-size: 18px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 7px;
}

.markdown-body h3 {
  margin: 16px 0 8px;
  font-size: 16px;
}

.markdown-body p {
  margin: 8px 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
}

.markdown-body li {
  margin: 5px 0;
}

.markdown-body code {
  background: #f1f5f9;
  color: #1d4ed8;
  padding: 2px 5px;
  border-radius: 5px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

.markdown-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 13px;
  overflow-x: auto;
}

.markdown-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.md-table th,
.md-table td {
  border: 1px solid #dbe3ee;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.md-table th {
  background: #f1f5f9;
  color: #334155;
}

.md-table tr:nth-child(even) td {
  background: #fbfdff;
}

.md-editor {
  width: 100%;
  min-height: 640px;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 18px;
  outline: none;
  font-family: Consolas, Monaco, "Malgun Gothic", monospace;
  font-size: 14px;
  line-height: 1.65;
  color: #0f172a;
  background: #fff;
}

.empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
  background: #f8fafc;
  border-radius: 14px;
}

.footer {
  color: var(--muted);
  padding: 16px 4px 4px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-size: 12px;
}

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

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .rules-layout {
    grid-template-columns: 1fr;
  }

  .rule-list-panel {
    height: auto;
    max-height: 480px;
  }
}

/* v0.11: left list smaller, right detail wider */
.rules-layout {
  grid-template-columns: 320px minmax(0, 1fr) !important;
}

.rule-list-panel {
  height: calc(100vh - 240px);
}

.rule-row b {
  font-size: 12px;
  letter-spacing: -0.3px;
}

.tree-indent {
  width: 14px;
}

/* sitemap open panel */
.sitemap-panel {
  margin-top: 14px;
  width: 100%;
  height: 600px;
  background: #ffffff;
  border: 1px solid #d7dee9;
  box-shadow: var(--shadow);
  overflow: auto;
  padding: 14px;
}

.sitemap-panel-head {
  height: 54px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 14px;
}

.sitemap-panel-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.5px;
}

.sitemap-panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sitemap-panel-head button {
  border: 0;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 900;
  cursor: pointer;
}

.sitemap-btn.active {
  background: #0f766e;
  border-color: #0f766e;
}

.flow-map {
  min-width: 1400px;
  padding: 12px;
}

.flow-zone {
  border: 2px dashed transparent;
  margin-bottom: 26px;
  padding: 16px;
  position: relative;
}

.shop-zone {
  border-color: #c084fc;
}

.status-zone {
  border-color: #a78bfa;
}

.admin-zone {
  border-color: #f472b6;
}

.zone-title {
  display: inline-flex;
  padding: 7px 18px;
  border-radius: 999px;
  background: #86efac;
  color: #064e3b;
  font-weight: 900;
  margin-bottom: 14px;
}

.zone-title.purple {
  background: #ddd6fe;
  color: #4c1d95;
}

.zone-title.red {
  background: #ffe4e6;
  color: #9f1239;
}

.flow-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  flex-wrap: nowrap;
}

.flow-box {
  min-width: 145px;
  max-width: 180px;
  min-height: 58px;
  border: 2px solid #444;
  background: #ffffff;
  padding: 8px 9px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 2px 0 rgba(0,0,0,0.05);
}

.flow-box small {
  display: block;
  margin-top: 4px;
  color: #555;
  font-size: 11px;
  font-weight: 700;
}

.flow-box.main {
  background: #f8fafc;
  border-width: 3px;
}

.flow-box.purple {
  background: #f5f3ff;
  border-color: #7c3aed;
}

.flow-box.green {
  background: #ecfdf5;
  border: 2px dashed #10b981;
}

.flow-box.orange {
  background: #fff7ed;
  border: 2px dashed #f97316;
}

.flow-box.accent {
  background: #eff6ff;
  border-color: #2563eb;
}

.flow-box.success {
  background: #f0fdf4;
  border-color: #16a34a;
}

.flow-line {
  width: 60px;
  height: 2px;
  background: #c026d3;
  position: relative;
}

.flow-line::after {
  content: "";
  position: absolute;
  right: -4px;
  top: -4px;
  width: 0;
  height: 0;
  border-left: 8px solid #c026d3;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

@media (max-width: 1200px) {
  .rules-layout {
    grid-template-columns: 1fr !important;
  }

  .sitemap-panel {
    height: 520px;
  }
}

/* AICS dual home links */
.aics-dual-home {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  height: 52px;
  margin: 0 0 22px 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
}

.aics-home-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  color: #ffffff !important;
  line-height: 1.1;
  border-right: 1px solid rgba(255,255,255,0.18);
  background: #1d4ed8;
}

.aics-home-btn:last-child {
  border-right: 0;
}

.aics-home-btn:hover {
  color: #ffffff !important;
  background: #2563eb;
}

.aics-home-new {
  background: #0f766e;
}

.aics-home-new:hover {
  background: #0d9488;
}

.aics-home-main {
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.aics-home-sub {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 800;
  opacity: 0.92;
}


