/* ===== Brand tokens (standalone identity) ===== */
:root {
  --navy: #0b2340;
  --navy-2: #143152;
  --red: #c8102e;
  --red-2: #a50d25;
  --ink: #1a2330;
  --muted: #5b6472;
  --line: #e3e7ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --gold: #e0a11b;
  --green: #1f9e57;
  --shadow: 0 1px 2px rgba(16, 32, 56, 0.06), 0 8px 24px rgba(16, 32, 56, 0.08);
  --radius: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ===== Header ===== */
.site-header {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 18px 22px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 14px rgba(11, 35, 64, 0.25);
}
.header-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.brand-name .accent { color: #ff5a70; }
.brand-tag { font-size: 12px; opacity: 0.8; margin-top: 3px; font-weight: 500; }
.header-spacer { flex: 1; }
.plan-toggle {
  background: var(--red); color: #fff; border: none; border-radius: 999px;
  padding: 10px 18px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.35);
  transition: transform .12s ease, background .12s ease;
}
.plan-toggle:hover { background: var(--red-2); transform: translateY(-1px); }
.plan-count {
  background: #fff; color: var(--red); border-radius: 999px; min-width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; padding: 0 6px;
}

/* ===== Layout ===== */
.wrap { max-width: 1240px; margin: 0 auto; padding: 22px; }

/* ===== Controls ===== */
.controls { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  box-shadow: var(--shadow);
}
.search input { border: none; outline: none; flex: 1; font-size: 15px; background: transparent; color: var(--ink); }
.result-count { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }

.filter-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-right: 2px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  transition: all .12s ease;
}
.chip:hover { border-color: var(--navy); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.cat.active { background: var(--red); border-color: var(--red); }

/* ===== Grid ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease; cursor: pointer;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(16,32,56,.12), 0 16px 40px rgba(16,32,56,.12); }
.card-diagram { background: #eef3ea; aspect-ratio: 1 / 1; position: relative; }
.card-diagram svg { width: 100%; height: 100%; display: block; }
.card-time {
  position: absolute; left: 10px; bottom: 10px;
  background: var(--navy); color: #fff; border-radius: 8px; padding: 5px 10px;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  box-shadow: 0 2px 8px rgba(11,35,64,.3);
}
.card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-cat { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--red); }
.card-title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; margin: 0; line-height: 1.2; }
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: #eef1f5; color: var(--muted); }
.tag.skill { background: #eaf3ee; color: var(--green); }
.card-add {
  margin-top: 8px; border: 1px dashed var(--line); background: #fff; color: var(--navy);
  border-radius: 9px; padding: 8px; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .12s ease;
}
.card-add:hover { border-color: var(--red); color: var(--red); border-style: solid; }
.card-add.added { background: var(--green); border-color: var(--green); color: #fff; border-style: solid; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11, 22, 40, 0.55); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 18px; max-width: 860px; width: 100%; max-height: 90vh; overflow: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,.35); position: relative;
}
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2; border: none; background: rgba(255,255,255,.9);
  width: 36px; height: 36px; border-radius: 50%; font-size: 20px; color: var(--ink); box-shadow: var(--shadow);
}
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; }
.modal-diagram { background: #eef3ea; }
.modal-diagram svg { width: 100%; height: 100%; display: block; }
.modal-info { padding: 26px 28px; }
.modal-cat { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--red); }
.modal-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 12px; }
.modal-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.modal-meta .tag { font-size: 12px; padding: 5px 10px; }
.tag.time { background: var(--navy); color: #fff; }
.modal-desc { font-size: 15px; line-height: 1.6; color: var(--ink); margin: 0 0 18px; }
.modal-info h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.coach-list { margin: 0 0 22px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.coach-list li { font-size: 14px; line-height: 1.45; padding-left: 22px; position: relative; }
.coach-list li::before { content: ""; position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.modal-add {
  width: 100%; border: none; background: var(--red); color: #fff; border-radius: 10px; padding: 13px;
  font-weight: 800; font-size: 15px; transition: background .12s ease;
}
.modal-add:hover { background: var(--red-2); }
.modal-add.added { background: var(--green); }

/* ===== Plan drawer ===== */
.plan-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 400px; max-width: 92vw; background: #fff;
  box-shadow: -12px 0 40px rgba(0,0,0,.2); z-index: 70; transform: translateX(100%);
  transition: transform .22s ease; display: flex; flex-direction: column;
}
.plan-drawer.open { transform: translateX(0); }
.plan-head { background: var(--navy); color: #fff; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; }
.plan-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.plan-head button { background: transparent; border: none; color: #fff; font-size: 22px; }
.plan-timebar { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.plan-target { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.plan-target input { width: 64px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; font-weight: 700; text-align: center; }
.timebar-track { height: 10px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.timebar-fill { height: 100%; background: linear-gradient(90deg, var(--green), #38c172); border-radius: 999px; transition: width .2s ease; }
.timebar-fill.over { background: linear-gradient(90deg, var(--red), #e05a70); }
.plan-total { margin-top: 8px; font-size: 14px; font-weight: 800; }
.plan-total .over-txt { color: var(--red); }
.plan-list { flex: 1; overflow: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.plan-item { display: flex; align-items: center; gap: 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.plan-item .pi-diagram { width: 46px; height: 46px; flex: none; border-radius: 7px; overflow: hidden; background: #eef3ea; }
.plan-item .pi-diagram svg { width: 100%; height: 100%; }
.pi-body { flex: 1; min-width: 0; }
.pi-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-sub { font-size: 12px; color: var(--muted); }
.pi-actions { display: flex; flex-direction: column; gap: 2px; }
.pi-actions button { border: none; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 5px; }
.pi-actions button:hover { background: #e8ecf1; color: var(--ink); }
.pi-remove:hover { color: var(--red) !important; }
.plan-empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.plan-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.btn-print { flex: 1; background: var(--navy); color: #fff; border: none; border-radius: 10px; padding: 12px; font-weight: 800; font-size: 14px; }
.btn-print:hover { background: var(--navy-2); }
.btn-clear { background: #fff; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; font-weight: 700; font-size: 14px; }
.btn-clear:hover { color: var(--red); border-color: var(--red); }

/* ===== Print sheet ===== */
#print-sheet { display: none; }

@media print {
  body * { visibility: hidden; }
  #print-sheet, #print-sheet * { visibility: visible; }
  #print-sheet { display: block; position: absolute; inset: 0; width: 100%; padding: 0; background: #fff; }
  @page { size: portrait; margin: 12mm; }
}

.ps-header { text-align: center; border-bottom: 3px solid var(--navy); padding-bottom: 10px; margin-bottom: 16px; }
.ps-title { background: var(--navy); color: #fff; display: inline-block; padding: 8px 22px; border-radius: 8px; font-size: 20px; font-weight: 800; letter-spacing: .02em; }
.ps-sub { color: var(--muted); font-size: 12px; margin-top: 8px; }
.ps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ps-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; break-inside: avoid; }
.ps-card .ps-diagram { background: #eef3ea; aspect-ratio: 1/1; }
.ps-card .ps-diagram svg { width: 100%; height: 100%; }
.ps-card .ps-body { padding: 8px 10px 10px; }
.ps-card .ps-name { color: var(--red); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
.ps-card .ps-time { color: var(--navy); font-weight: 800; font-size: 12px; margin: 2px 0 4px; }
.ps-card .ps-desc { font-size: 10.5px; color: var(--ink); line-height: 1.4; }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .modal-grid { grid-template-columns: 1fr; }
  .modal-diagram { aspect-ratio: 4/3; }
  .brand-tag { display: none; }
  .ps-grid { grid-template-columns: repeat(2, 1fr); }
}
