:root {
  --ink: #162033;
  --muted: #69758a;
  --line: #dfe5ef;
  --surface: #ffffff;
  --canvas: #f3f6fb;
  --navy: #071f57;
  --blue: #1846db;
  --orange: #ff5e00;
  --orange-dark: #d94700;
  --green: #11875d;
  --red: #c53535;
  --shadow: 0 16px 36px rgba(18, 39, 77, .08);
}
* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif; }
body { margin: 0; min-height: 100vh; }
a { color: #1548c5; text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; }
button, .primary-button, .secondary-button { cursor: pointer; }
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px clamp(18px, 4vw, 56px); color: #fff; background: linear-gradient(120deg, #061947, #102f83); box-shadow: 0 8px 30px rgba(3, 17, 56, .22); }
.app-header > div, .app-header nav { display: flex; align-items: center; gap: 14px; }
.app-header nav { flex-wrap: wrap; justify-content: flex-end; }
.app-header nav a, .link-button { color: #dfe8ff; text-decoration: none; font-size: 14px; border: 0; background: transparent; padding: 7px 4px; }
.app-header nav a:hover, .link-button:hover { color: #fff; }
.brand { color: #fff; font-size: 20px; font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.site-chip { border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 4px 9px; font-size: 12px; }
.logout-form { display: inline-flex; margin: 0; }
.app-main { width: min(1480px, calc(100% - 34px)); margin: 0 auto; padding: 34px 0 86px; }
.auth-main { display: grid; place-items: center; min-height: 100vh; padding: 28px 0; }
.auth-card { width: min(500px, 100%); padding: clamp(26px, 5vw, 46px); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card h1, .page-heading h1 { margin: 5px 0 8px; font-size: clamp(27px, 4vw, 42px); letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; font-weight: 500; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading .muted { margin: 6px 0 0; max-width: 800px; }
.panel { margin-bottom: 22px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 14px; font-size: 21px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2, .ranking-group-head h3 { margin: 3px 0 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric-grid article { position: relative; overflow: hidden; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.metric-grid article::after { content: ""; position: absolute; right: -22px; bottom: -28px; width: 90px; height: 90px; border-radius: 50%; background: rgba(24,70,219,.08); }
.metric-grid span { display: block; color: var(--muted); font-size: 13px; }
.metric-grid strong { display: block; margin-top: 8px; font-size: 35px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; padding: 11px 17px; text-decoration: none; font-weight: 750; border: 1px solid transparent; }
.primary-button { background: linear-gradient(135deg, var(--orange), #ef4200); color: #fff; box-shadow: 0 9px 20px rgba(255,94,0,.22); }
.primary-button:hover { background: var(--orange-dark); }
.secondary-button { color: #173f9e; background: #eef3ff; border-color: #cbd8fb; }
.danger-link { border: 0; color: var(--red); background: transparent; padding: 5px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.stack-form { display: grid; gap: 16px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #28354c; font-size: 14px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid #cfd7e5; border-radius: 9px; padding: 10px 11px; color: var(--ink); background: #fff; font-weight: 500; line-height: 1.5; }
textarea { resize: vertical; min-height: 46px; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(24,70,219,.13); border-color: var(--blue); }
.form-grid { display: grid; gap: 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 18px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.notice { margin-bottom: 18px; padding: 12px 15px; border-radius: 9px; border: 1px solid; }
.notice.success { color: #0a6947; background: #e9fbf3; border-color: #a8dfc8; }
.notice.error { color: #8c2525; background: #fff0f0; border-color: #efb9b9; }
.notice.warning { color: #7b4a00; background: #fff8e6; border-color: #edcd7d; }
.tabs { display: flex; gap: 3px; }
.tabs a { padding: 12px 18px; color: var(--muted); text-decoration: none; border: 1px solid transparent; border-bottom: 0; border-radius: 11px 11px 0 0; }
.tabs a.active { color: var(--navy); background: #fff; border-color: var(--line); font-weight: 800; }
.no-top-radius { border-top-left-radius: 0; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table.wide { min-width: 1100px; }
.admin-table th { color: #58657b; background: #f6f8fc; font-size: 12px; text-align: left; letter-spacing: .03em; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid #e6eaf1; vertical-align: top; }
.admin-table tbody tr:hover { background: #fbfcff; }
.url-cell { max-width: 280px; word-break: break-all; }
.actions { white-space: nowrap; }
.actions a + a { margin-left: 12px; }
.status { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #eaf0ff; color: #173f9e; font-size: 12px; white-space: nowrap; }
.status-done { background: #e7f8f0; color: #0a704a; }
.status-failed { background: #fff0f0; color: #a52a2a; }
.empty-state { padding: 46px 20px; text-align: center; color: var(--muted); }
.ranking-group { margin: 22px 0; padding: 22px; border: 2px solid #cbd8fb; border-radius: 15px; background: #f9fbff; }
.ranking-group-head, .ranking-item-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.group-number, .item-number { display: inline-block; color: #fff; border-radius: 6px; padding: 4px 8px; font-size: 12px; font-weight: 800; }
.group-number { background: var(--blue); }
.item-number { background: var(--orange); margin-right: 8px; }
.ranking-item { margin: 18px 0; padding: 19px; border: 1px solid #d9dee9; border-left: 5px solid var(--orange); border-radius: 11px; background: #fff; }
.is-disabled { opacity: .45; filter: grayscale(.4); }
.switch { display: flex; grid-auto-flow: column; align-items: center; gap: 8px; }
.switch input { width: 20px; height: 20px; }
.sticky-save { position: sticky; bottom: 16px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 24px; padding: 14px 18px; border: 1px solid #c7d1e4; border-radius: 14px; background: rgba(255,255,255,.94); box-shadow: 0 14px 34px rgba(17,35,74,.18); backdrop-filter: blur(12px); }
.sticky-save span { color: var(--muted); font-size: 13px; }
.validation-grid { display: grid; grid-template-columns: minmax(280px,.8fr) minmax(400px,1.2fr); gap: 22px; }
.validation-status { display: inline-block; border-radius: 999px; padding: 7px 12px; font-weight: 800; }
.validation-status.pass { color: #0b714d; background: #e8f8f1; }
.validation-status.fail { color: #992c2c; background: #ffeded; }
.code-output { min-height: 360px; font-family: Consolas, monospace; font-size: 12px; }
.article-preview { max-width: 900px; margin-left: auto; margin-right: auto; }
.preview-label { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.article-preview table { width: 100%; border-collapse: collapse; margin: 15px 0 24px; }
.article-preview td, .article-preview th { padding: 10px; border: 1px solid #cdd4df; }
.article-preview .killer-rank-badge-placeholder { display: table; margin: 14px auto; padding: 6px 12px; border-radius: 999px; color: #fff; background: linear-gradient(#f1b52e,#c88200); font-weight: 900; }
.article-preview .btn-wrap { margin: 20px auto; text-align: center; }
.article-preview .btn-wrap a { display: inline-block; min-width: 280px; padding: 14px 22px; border-radius: 8px; color: #fff; background: linear-gradient(#ff7200,#da3c00); text-decoration: none; font-weight: 800; }
.article-preview .killer-site-mockup { display: block; max-width: 600px; width: 100%; height: auto; margin: 14px auto; }
.token-reveal code { display: block; overflow-wrap: anywhere; padding: 16px; background: #101827; color: #bfe0ff; border-radius: 9px; }
.inline-form { display: flex; align-items: end; gap: 14px; }
.inline-form label { flex: 1; }
.settings-list dl { margin: 0; }
.settings-list dl div { display: grid; grid-template-columns: 190px 1fr; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.settings-list dt { color: var(--muted); }
.settings-list dd { margin: 0; word-break: break-all; font-weight: 700; }
.preset-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.preset-grid article { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--line); border-radius: 11px; }
.preset-grid span, .preset-grid small { color: var(--muted); }
.error-panel { max-width: 700px; margin: 50px auto; }
.workflow-panel { border-top: 4px solid #1846db; }
.workflow-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.workflow-source-fields,
.workflow-translation-fields { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
[hidden] { display: none !important; }
.advanced-options { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.advanced-options summary { cursor: pointer; padding: 13px 16px; font-weight: 700; color: #24324a; }
.advanced-options[open] summary { border-bottom: 1px solid var(--line); }
.advanced-options > :not(summary) { margin: 14px 16px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 16px; }
.checkbox-grid label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.checkbox-grid input { width: auto; }
.compact-grid { margin-top: 14px; }
.snapshot-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 18px; padding: 14px 16px; border: 1px solid #b8d8c2; border-radius: 12px; background: #effaf2; color: #214b2e; }
.snapshot-status code { padding: 3px 7px; border-radius: 6px; background: #dff2e5; }
.danger-zone { margin-top: 12px; }
.danger-button { border: 1px solid #b42318; border-radius: 9px; padding: 10px 14px; background: #fff; color: #b42318; font-weight: 700; cursor: pointer; }
.danger-button:hover { background: #fff1f0; }
.notice.warning { padding: 12px 14px; border-radius: 10px; background: #fff7df; color: #6b4c00; }
.diff-columns { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.diff-columns article { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fafcff; }
.diff-columns h3 { margin-top: 0; }
.small-value { font-size: 15px !important; }
@media (max-width: 980px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid.cols-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-grid.cols-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .span-3 { grid-column: span 2; }
  .validation-grid { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .app-main { width: min(100% - 20px, 1480px); padding-top: 22px; }
  .page-heading, .panel-heading, .sticky-save { align-items: stretch; flex-direction: column; }
  .metric-grid, .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4, .preset-grid { grid-template-columns: 1fr; }
  .diff-columns { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .panel, .ranking-group { padding: 17px; }
  .settings-list dl div { grid-template-columns: 1fr; gap: 5px; }
  .inline-form { align-items: stretch; flex-direction: column; }
}
