.customization-management,
.customization-management * { box-sizing: border-box; }

.customization-management {
  --customization-accent: #2f8a69;
  --customization-deep: #185d47;
  --customization-soft: #eaf7f0;
  --customization-line: #dcebe3;
  --customization-muted: #71877c;
  display: grid;
  min-height: calc(100vh - 154px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  max-width: 1420px;
  color: #20382c;
}

.customization-management-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px;
  border: 1px solid #cfe7d9;
  border-radius: 20px;
  background: radial-gradient(circle at 84% 20%, rgba(183, 229, 204, .42), transparent 31%), linear-gradient(135deg, #eef9f3, #fbfefc 72%);
  box-shadow: 0 12px 30px rgba(35, 92, 67, .08);
}

.customization-management-kicker {
  color: #579176;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}

.customization-management-hero h2 { margin: 7px 0 8px; color: var(--customization-deep); font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -.03em; }
.customization-management-hero p { max-width: 650px; margin: 0; color: #658073; font-size: 13px; line-height: 1.7; }

.customization-management-stats { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.customization-management-stats div { display: grid; min-width: 112px; gap: 3px; padding: 13px 16px; border: 1px solid rgba(207, 231, 217, .86); border-radius: 14px; background: rgba(255, 255, 255, .72); }
.customization-management-stats strong { color: var(--customization-deep); font-size: 25px; line-height: 1.1; }
.customization-management-stats span { color: var(--customization-muted); font-size: 11px; }

.customization-agent-filter { display: flex; align-items: center; gap: 9px; min-width: 260px; color: #466858; font-size: 12px; font-weight: 700; }
.customization-agent-filter > span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.customization-agent-filter > span svg { width: 15px; color: var(--customization-accent); }
.customization-agent-filter select { min-width: 170px; border: 1px solid #cfe5d8; border-radius: 10px; padding: 8px 30px 8px 10px; color: #315b49; background: #fbfefc; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.customization-agent-filter select:focus { outline: 3px solid #e5f4eb; border-color: var(--customization-accent); }

.customization-agent-list { display: flex; min-height: 0; gap: 17px; }
.customization-agent-section { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; border: 1px solid var(--customization-line); border-radius: 18px; background: rgba(255, 255, 255, .96); box-shadow: 0 10px 25px rgba(35, 92, 67, .06); }
.customization-agent-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 21px 24px; border-bottom: 1px solid #e7f1eb; background: linear-gradient(180deg, #fff, #fbfefc); }
.customization-agent-identity { display: flex; align-items: center; min-width: 0; gap: 13px; }
.customization-agent-avatar { display: grid; flex: 0 0 auto; width: 42px; height: 42px; place-items: center; border-radius: 14px; color: #21694f; background: linear-gradient(135deg, #d5f1e2, #f0faf4); font-size: 17px; font-weight: 800; }
.customization-agent-identity h2 { overflow: hidden; margin: 0; color: #264838; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.customization-agent-identity p { overflow: hidden; margin: 4px 0 0; color: var(--customization-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.customization-agent-controls { display: flex; align-items: center; justify-content: flex-end; gap: 18px; flex: 0 0 auto; }
.customization-agent-meta { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; color: #879b91; font-size: 11px; }
.customization-rule-count { padding: 5px 9px; border-radius: 999px; color: #31785b; background: var(--customization-soft); font-weight: 700; }

.customization-rule-area { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 18px 22px 20px; background: linear-gradient(180deg, #fbfefc, #fff); }
.customization-rule-carousel { display: grid; min-height: 0; height: 100%; flex: 1; grid-template-columns: 36px minmax(0, 1fr) 36px; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.customization-rule-window { min-width: 0; height: 100%; overflow-x: auto; border-radius: 17px; scrollbar-width: none; scroll-behavior: smooth; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; touch-action: pan-x; }
.customization-rule-window::-webkit-scrollbar { display: none; }
.customization-rule-grid { display: grid; width: 100%; min-width: 100%; height: 100%; grid-template-rows: repeat(3, minmax(0, 1fr)); grid-auto-flow: column; grid-auto-columns: calc((100% - 60px) / 6); gap: 12px; }
.customization-rule-card { position: relative; display: flex; height: 100%; min-width: 0; min-height: 0; flex-direction: column; padding: 15px 14px 13px; border: 1px solid #deece4; border-radius: 17px; background: #fff; box-shadow: 0 4px 10px rgba(35, 92, 67, .045); scroll-snap-align: start; transition: border-color .18s, box-shadow .18s, transform .18s; }
.customization-rule-card::before { position: absolute; top: -1px; right: 18px; left: 18px; height: 3px; border-radius: 0 0 5px 5px; background: #b9e1c9; content: ''; }
.customization-rule-card:hover { border-color: #a8d4ba; box-shadow: 0 8px 18px rgba(35, 92, 67, .08); transform: translateY(-1px); }
.customization-rule-card-corner { display: flex; align-items: center; justify-content: space-between; min-height: 22px; color: #9ab3a5; }
.customization-rule-card-corner svg { width: 15px; height: 15px; color: #6fa88c; }
.customization-rule-rank { color: #7ca18e; font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.customization-rule-card-top { display: flex; align-items: center; gap: 7px; color: #719183; font-size: 11px; font-weight: 700; }
.customization-rule-icon { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 8px; color: #2d8663; background: #e8f6ee; }
.customization-rule-icon svg { width: 14px; height: 14px; }
.customization-rule-card h3 { overflow: hidden; margin: 13px 0 6px; color: #2b4d3d; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.customization-rule-card p { display: -webkit-box; overflow: hidden; min-height: 42px; margin: 0; color: #668074; font-size: 12px; line-height: 1.7; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.customization-rule-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: auto; padding-top: 13px; border-top: 1px solid #eef4f0; }
.customization-rule-actions button { min-height: 30px; padding: 5px 10px; font-size: 11px; }
.customization-rule-actions .customization-delete-button { border: 1px solid #f0d4d4; color: #a45555; background: #fffafa; box-shadow: none; }
.customization-rule-actions .customization-delete-button:hover { border-color: #e5b7b7; color: #a13f3f; background: #fff1f1; }
.customization-rule-actions button:disabled { cursor: wait; opacity: .5; }
.customization-carousel-button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid #cfe5d8; border-radius: 50%; color: #3d8063; background: #fff; box-shadow: 0 4px 10px rgba(35, 92, 67, .06); }
.customization-carousel-button svg { width: 16px; height: 16px; }
.customization-carousel-button:hover:not(:disabled) { border-color: #8fc7a7; color: #21694f; background: #f2faf5; }
.customization-carousel-button:disabled { cursor: not-allowed; opacity: .35; }
.customization-carousel-meta { display: flex; grid-column: 2; grid-row: 2; align-items: center; justify-content: space-between; gap: 10px; padding-top: 9px; color: #91a69b; font-size: 10px; }
.customization-carousel-meta span:first-child { color: #56836c; font-weight: 800; letter-spacing: .08em; }

.customization-rule-empty { display: grid; min-height: 0; height: 100%; place-items: center; gap: 5px; padding: 24px; border: 1px dashed #d6e9de; border-radius: 13px; color: #789085; background: #fcfefc; text-align: center; font-size: 13px; }
.customization-rule-empty small { color: #9aaea4; font-size: 11px; line-height: 1.6; }
.customization-source-section, .customization-manual-section { display: flex; min-width: 0; min-height: 0; flex-direction: column; gap: 12px; }
.customization-source-section { flex: 0 0 auto; }
.customization-source-section-head, .customization-manual-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.customization-source-section-head h3, .customization-manual-section-head h3 { margin: 4px 0 0; color: #2b4d3d; font-size: 16px; }
.customization-source-section-head p, .customization-manual-section-head p { margin: 4px 0 0; color: #82988d; font-size: 11px; line-height: 1.5; }
.customization-source-section-count { display: inline-flex; align-items: baseline; gap: 4px; flex: 0 0 auto; padding: 8px 11px; border: 1px solid #e0eee6; border-radius: 10px; color: #71877c; background: #fbfefc; font-size: 11px; font-weight: 600; white-space: nowrap; }
.customization-source-section-count strong { color: #2f7659; font-size: 14px; line-height: 1; }
.customization-source-section-count i { color: #b1c5b9; font-style: normal; }
.customization-source-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.customization-source-card { position: relative; display: flex; min-height: 190px; min-width: 0; flex-direction: column; padding: 18px 18px 14px; border: 1px solid #dbeae2; border-radius: 14px; background: #fff; box-shadow: none; transition: border-color .18s, background-color .18s, transform .18s; }
.customization-source-card:hover { border-color: #9ccdb0; background: #fcfffd; transform: translateY(-1px); }
.customization-source-card-head { display: grid; min-width: 0; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.customization-source-card-icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid #cfe8d9; border-radius: 12px; color: #287b5b; background: #eff9f3; }
.customization-source-card-icon svg { width: 19px; height: 19px; }
.customization-source-card-heading { min-width: 0; }
.customization-source-card-eyebrow, .customization-source-drawer-eyebrow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.customization-source-card-status { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 7px; border-radius: 999px; color: #327a5a; background: #eaf7f0; font-size: 10px; font-weight: 700; white-space: nowrap; }
.customization-source-card-heading h3 { overflow: hidden; margin: 9px 0 0; color: #254938; font-size: 15px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.customization-source-card-arrow { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #e2eee7; border-radius: 9px; color: #6fa58a; background: #fbfefc; }
.customization-source-card-arrow svg { width: 15px; height: 15px; }
.customization-source-card-stats { display: flex; align-items: center; gap: 17px; margin: 25px 0 18px; padding: 15px 0; border-top: 1px solid #eef4f0; border-bottom: 1px solid #eef4f0; }
.customization-source-card-stat { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.customization-source-card-stat strong { color: #2b6d52; font-size: 20px; line-height: 1; }
.customization-source-card-stat span { color: #849a8f; font-size: 11px; white-space: nowrap; }
.customization-source-card-stat-divider { width: 1px; height: 20px; background: #e3eee8; }
.customization-source-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.customization-source-card-version { color: #91a69b; font-size: 11px; }
.customization-source-card-action { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 5px 0 5px 9px; border: 0; color: #2d7b5a; background: transparent; font-size: 12px; font-weight: 700; }
.customization-source-card-action svg { width: 14px; height: 14px; transition: transform .18s; }
.customization-source-card-action:hover { color: #185d47; background: transparent; box-shadow: none; }
.customization-source-card-action:hover svg { transform: translateX(2px); }
.customization-manual-section { flex: 1; }
.customization-source-drawer-mask { position: fixed; z-index: 230; inset: 0; display: flex; justify-content: flex-end; background: rgba(18, 38, 29, .34); }
.customization-source-drawer { display: flex; width: min(720px, calc(100vw - 24px)); height: 100%; flex-direction: column; overflow: hidden; border-left: 1px solid #d5e9dc; background: #fff; box-shadow: -18px 0 48px rgba(18, 38, 29, .2); animation: customizationSourceDrawerIn .2s ease-out; }
.customization-source-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 26px 20px; border-bottom: 1px solid #e7f1eb; background: #fff; }
.customization-source-drawer-identity { display: flex; min-width: 0; gap: 13px; }
.customization-source-drawer-icon { display: grid; flex: 0 0 auto; width: 42px; height: 42px; place-items: center; border: 1px solid #cfe8d9; border-radius: 12px; color: #287b5b; background: #eff9f3; }
.customization-source-drawer-icon svg { width: 19px; height: 19px; }
.customization-source-drawer-head h2 { overflow: hidden; margin: 8px 0 4px; color: #244b39; font-size: 20px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.customization-source-drawer-head p { margin: 0; color: #7b9085; font-size: 12px; line-height: 1.55; }
.customization-source-drawer-head button { flex: 0 0 auto; min-height: 31px; padding: 6px 10px; }
.customization-source-drawer-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 13px 26px; border-bottom: 1px solid #eef4f0; color: #789085; background: #fbfefc; font-size: 11px; }
.customization-source-drawer-toolbar strong { color: #466858; font-size: 12px; }
.customization-source-drawer-toolbar span { color: #31785b; font-weight: 700; }
.customization-source-drawer-body { min-height: 0; flex: 1; overflow: auto; padding: 0 26px 26px; background: #fff; }
.customization-source-rule { padding: 20px 0 21px; border-bottom: 1px solid #e9f1ec; }
.customization-source-rule:first-child { border-top: 1px solid #e9f1ec; }
.customization-source-rule > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.customization-source-rule-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.customization-source-rule-index { color: #7ca18e; font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.customization-source-rule-heading .customization-rule-scene { display: inline-flex; align-items: center; gap: 5px; }
.customization-source-rule-heading .customization-rule-scene svg { width: 13px; height: 13px; }
.customization-source-rule-field + .customization-source-rule-field { margin-top: 10px; }
.customization-source-rule-field > span { display: block; margin-bottom: 6px; color: #82988d; font-size: 10px; font-weight: 700; }
.customization-source-rule-field > p { margin: 0; padding: 0 0 0 12px; border-left: 2px solid #dcebe3; color: #466858; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.customization-source-rule-field.is-answer > p { border-left-color: #96cfad; color: #315d48; }
.customization-source-rule-actions { display: flex; justify-content: flex-end; gap: 7px; }
.customization-source-rule-actions button { min-height: 28px; padding: 4px 9px; font-size: 11px; }
@keyframes customizationSourceDrawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.customization-agent-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 22px; border-top: 1px solid #edf4ef; color: #92a39a; font-size: 11px; }
.customization-agent-footer button { flex: 0 0 auto; padding: 5px 10px; color: #3b8063; font-size: 11px; }
.customization-management-loading, .customization-management-empty { display: grid; min-height: 220px; place-items: center; gap: 8px; padding: 35px; border: 1px solid var(--customization-line); border-radius: 18px; color: var(--customization-muted); background: rgba(255, 255, 255, .86); text-align: center; }
.customization-management-empty strong { color: #466a58; font-size: 15px; }
.customization-management-empty span { font-size: 12px; }
.customization-management-error strong { color: #9d5252; }

.customization-edit-mask { position: fixed; z-index: 220; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(18, 38, 29, .34); }
.customization-edit-modal { width: min(560px, 100%); max-height: min(700px, 90vh); overflow: auto; border: 1px solid #dcebe3; border-radius: 19px; background: #fff; box-shadow: 0 22px 60px rgba(18, 38, 29, .22); animation: customizationModalIn .18s ease-out; }
.customization-edit-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 18px; border-bottom: 1px solid #e7f1eb; background: linear-gradient(135deg, #f0faf4, #fff); }
.customization-edit-header h2 { margin: 6px 0 4px; color: #244b39; font-size: 20px; }
.customization-edit-header p { margin: 0; color: #7b9085; font-size: 12px; line-height: 1.55; }
.customization-edit-header button { flex: 0 0 auto; padding: 6px 10px; color: #668074; font-size: 11px; }
.customization-edit-form { display: grid; gap: 14px; padding: 21px 24px 23px; }
.customization-edit-form label { display: grid; gap: 7px; color: #466858; font-size: 12px; font-weight: 700; }
.customization-edit-form input, .customization-edit-form textarea { width: 100%; border: 1px solid #d5e7dc; border-radius: 11px; padding: 11px 12px; color: #20382c; background: #fff; font: inherit; font-size: 13px; font-weight: 400; line-height: 1.65; }
.customization-edit-form textarea { min-height: 120px; resize: vertical; }
.customization-edit-form input:focus, .customization-edit-form textarea:focus { outline: 3px solid #e5f4eb; border-color: #2f8a69; }
.customization-edit-note { margin: 0; padding: 10px 12px; border-radius: 10px; color: #648271; background: #f3faf6; font-size: 11px; line-height: 1.6; }
.customization-edit-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 3px; }
.customization-edit-actions button { min-width: 82px; }
@keyframes customizationModalIn { from { opacity: 0; transform: translateY(7px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 860px) {
  .customization-management-hero { align-items: flex-start; flex-direction: column; padding: 23px 20px; }
  .customization-management-stats { width: 100%; }
  .customization-management-stats div { flex: 1; }
  .customization-agent-header { align-items: flex-start; flex-direction: column; padding: 18px 19px; }
  .customization-agent-controls { width: 100%; justify-content: space-between; }
  .customization-agent-meta { width: 100%; justify-content: space-between; }
  .customization-rule-area { padding: 15px; }
  .customization-rule-grid { grid-auto-columns: calc((100% - 24px) / 3); }
  .customization-agent-footer { align-items: flex-start; flex-direction: column; padding: 12px 15px; }
}

@media (max-width: 700px) {
  .customization-agent-controls { align-items: flex-start; flex-direction: column; gap: 10px; }
  .customization-agent-filter { width: 100%; min-width: 0; justify-content: space-between; }
  .customization-agent-filter select { flex: 1; min-width: 0; }
  .customization-rule-grid { grid-auto-columns: calc((100% - 12px) / 2); }
  .customization-source-section-head, .customization-manual-section-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .customization-source-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .customization-management-stats { flex-direction: column; }
  .customization-management-stats div { width: 100%; }
  .customization-agent-filter { align-items: flex-start; flex-direction: column; gap: 8px; }
  .customization-agent-filter select { width: 100%; }
  .customization-rule-carousel { grid-template-columns: 31px minmax(0, 1fr) 31px; gap: 6px; }
  .customization-rule-grid { grid-auto-columns: 100%; }
  .customization-carousel-button { width: 31px; height: 31px; }
  .customization-source-drawer { width: 100%; }
  .customization-source-drawer-head, .customization-source-drawer-body { padding-right: 18px; padding-left: 18px; }
  .customization-edit-mask { padding: 10px; }
  .customization-edit-header, .customization-edit-form { padding-right: 18px; padding-left: 18px; }
}
