:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --soft: #f6f8fb;
  --panel: #ffffff;
  --primary: #1f5f8b;
  --primary-dark: #16476a;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 12px 30px rgba(23, 32, 42, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--soft); line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }

.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-header { background: var(--panel); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; gap: 24px; align-items: center; justify-content: space-between; padding: 34px 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.05; letter-spacing: -0.04em; }
h2 { margin-bottom: 0; font-size: 1.45rem; line-height: 1.15; }
h3 { margin-bottom: 0; font-size: 1.1rem; }
.subtitle { margin-bottom: 0; color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.page-main { padding: 34px 0 70px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; text-decoration: none; font-weight: 700; transition: background .15s, border-color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.button-secondary:hover { background: #eef3f8; }
.button-danger { background: #fff4f2; border-color: #f4c7c2; color: var(--danger); }
.button-danger:hover { background: #ffe8e5; }
.control { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #c8d0da; border-radius: 8px; background: #fff; color: var(--ink); }
.control:focus, .color-control:focus { outline: 3px solid rgba(31, 95, 139, .18); border-color: var(--primary); }
.color-control { width: 48px; height: 44px; padding: 4px; border: 1px solid #c8d0da; border-radius: 8px; background: #fff; }
.muted { color: var(--muted); font-size: .92rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.filter-bar, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.filter-bar { display: grid; grid-template-columns: 1fr minmax(230px, 360px) auto; gap: 18px; align-items: end; padding: 20px; }
.filter-bar label { display: block; font-weight: 700; }
.filter-bar .control { margin-top: 0; }
.filter-bar .muted { margin: 0 0 10px; text-align: right; white-space: nowrap; }

.timeline { position: relative; max-width: 1180px; margin: 42px auto 0; padding: 4px 0 10px 48px; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px; background: #cbd5df; }
.timeline-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; margin-bottom: 28px; }
.timeline-marker { position: absolute; top: 24px; left: -41px; width: 28px; height: 28px; border: 6px solid var(--soft); border-radius: 50%; background: var(--theme-color); box-shadow: 0 0 0 2px var(--theme-color); }
.milestone-card { padding: 22px 24px; border: 1px solid var(--line); border-left: 5px solid var(--theme-color); border-radius: 12px; background: #fff; box-shadow: 0 8px 18px rgba(23,32,42,.06); }
.milestone-date { margin-bottom: 3px; color: var(--muted); font-size: .9rem; font-weight: 700; }
.milestone-text { white-space: pre-line; }
.milestone-images { display: grid; grid-template-columns: repeat(2, 150px); gap: 8px; align-content: start; }
.milestone-images figure { margin: 0; }
.milestone-image { display: block; width: 150px; height: 140px; object-fit: cover; border: 1px solid #cbd5df; border-radius: 0; background: #edf1f5; }
.empty-state { padding: 50px 20px; text-align: center; }
.empty-state h2, .empty-state h3 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); }
.compact-empty { padding: 34px 12px 8px; }
.site-footer { padding: 24px 0 34px; color: var(--muted); font-size: .85rem; text-align: center; }
.footer-admin-link { display: inline-block; margin-top: 8px; color: var(--muted); font-size: .75rem; opacity: .72; text-decoration: none; }
.footer-admin-link:hover { color: var(--primary); opacity: 1; text-decoration: underline; }

.admin-main { display: grid; gap: 24px; }
.panel { padding: 24px; }
.section-heading, .list-heading { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.form-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.compact-control { width: min(100%, 280px); }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; background: #eef3f8; color: var(--primary-dark); font-size: .8rem; font-weight: 800; }
.inline-form { display: grid; grid-template-columns: 1fr 48px auto; gap: 10px; margin-bottom: 20px; }
.theme-list { display: grid; gap: 10px; }
.theme-row { display: grid; grid-template-columns: 14px minmax(150px, 1fr) auto repeat(3, auto); gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.theme-dot { width: 12px; height: 12px; border-radius: 50%; }
.theme-total { white-space: nowrap; }
.theme-row .button { min-height: 36px; padding: 7px 10px; font-size: .85rem; }
.theme-name[readonly] { background: #f8fafc; color: #334155; cursor: default; }
.theme-row .button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.milestone-form { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.form-grid { display: grid; gap: 14px; }
.date-grid { grid-template-columns: 1.4fr 1fr 1fr; }
.field { margin-bottom: 18px; }
.field > label, .image-field > label { display: block; margin-bottom: 6px; font-weight: 700; }
.field small { display: block; margin-top: -3px; color: var(--muted); font-size: .8rem; }
.image-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.image-field { padding: 14px; border: 1px dashed #bbc7d3; border-radius: 10px; background: #fff; }
.image-field input[type=file] { padding: 7px; font-size: .85rem; }
.check-label { display: block; margin: 8px 0; color: var(--muted); font-size: .83rem; }
.preview { display: flex; align-items: center; justify-content: center; width: 160px; height: 108px; border-radius: 8px; background: #eef2f6; overflow: hidden; }
.preview-image { width: 160px; height: 108px; object-fit: cover; }
.preview-empty { color: var(--muted); font-size: .8rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.file-button { user-select: none; }
.list-heading { margin: 28px 0 10px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 650px; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { background: #eef3f8; color: var(--primary-dark); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.table-actions .button { min-height: 34px; padding: 6px 9px; font-size: .8rem; }
.notice { padding: 12px 14px; border-radius: 9px; border: 1px solid #b7d7c7; background: #eefaf2; color: var(--success); }
.notice-error { border-color: #f4c7c2; background: #fff4f2; color: var(--danger); }
.notice-info { border-color: #bfd4e6; background: #eef6fb; color: var(--primary-dark); }

@media (max-width: 760px) {
  .header-inner { align-items: flex-start; flex-direction: column; }
  .header-inner .button { width: 100%; }
  .filter-bar { grid-template-columns: 1fr; align-items: stretch; }
  .filter-bar .muted { margin: 0; text-align: left; }
  .timeline { padding-left: 34px; }
  .timeline::before { left: 10px; }
  .timeline-marker { left: -35px; width: 22px; height: 22px; border-width: 5px; }
  .milestone-card { padding: 18px; }
  .timeline-item { grid-template-columns: 1fr; }
  .milestone-images { grid-template-columns: repeat(2, 150px); }
  .theme-row { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .theme-total { grid-column: 2; }
  .theme-row .edit-theme, .theme-row .save-theme, .theme-row .delete-theme { grid-row: 3; }
  .image-fields, .date-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .compact-control { width: 100%; }
}
