:root{
  --bg:#f6f8fc;
  --card:#fff;
  --line:#dfe5ef;
  --ink:#14233f;
  --muted:#6c7891;
  --blue:#1769ef;
  --blue2:#2d79ef;
  --green:#078457;
  --sidebar:#f8faff;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:var(--bg);color:var(--ink);font-family:system-ui,-apple-system,"Segoe UI","Noto Sans JP",sans-serif}
header{
  position:sticky;top:0;z-index:50;
  height:72px;padding:0 26px;
  display:flex;align-items:center;justify-content:space-between;
  background:#fff;border-bottom:1px solid var(--line);
}
.brand{display:flex;align-items:baseline;gap:16px}
header strong{font-size:24px;letter-spacing:-.4px}
.sub{font-size:14px;color:var(--muted)}
#summary{font-size:15px;font-weight:700;color:#263a62}

.app-layout{
  display:grid;
  grid-template-columns:360px minmax(0,1fr);
  min-height:calc(100vh - 72px)
}
.sidebar{
  position:sticky;top:72px;height:calc(100vh - 72px);overflow-y:auto;
  padding:28px 24px 34px;background:var(--sidebar);border-right:1px solid var(--line)
}
.filter-section{margin-bottom:30px}
.filter-section h2{font-size:16px;margin:0 0 13px}
.filter-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.filter-buttons button{
  min-height:48px;padding:8px 10px;border-radius:8px;
  border:1px solid #d6deeb;background:#fff;color:#243556;
  font:inherit;font-weight:700;cursor:pointer;
  box-shadow:0 1px 2px rgba(20,35,63,.04);
  white-space:nowrap;
}
.filter-buttons button:hover{border-color:#9ab7ef;background:#f8fbff}
.filter-buttons button.active{
  background:linear-gradient(135deg,var(--blue),var(--blue2));
  border-color:var(--blue);color:#fff;
  box-shadow:0 4px 12px rgba(23,105,239,.18)
}
.filter-buttons button.all{grid-column:1/-1}
.textbook-buttons button{
  min-height:50px;
  font-size:14px;
}
.subject-buttons button{min-height:46px}
.reset-btn{
  width:100%;height:50px;border:1px solid #cfd8e8;border-radius:9px;
  background:#fff;color:#344868;font:inherit;font-weight:700;cursor:pointer
}
.reset-btn:hover{background:#f1f6ff;border-color:#a9bee4}

main{padding:25px 28px 40px;min-width:0}
.search-wrap{position:relative;margin-bottom:20px}
.search-icon{
  position:absolute;left:20px;top:50%;transform:translateY(-50%);
  color:#6a7893;font-size:24px;pointer-events:none
}
#q{
  width:100%;height:56px;padding:0 20px 0 60px;
  border:1px solid #cfd9e8;border-radius:10px;background:#fff;
  font:inherit;font-size:17px;color:var(--ink);outline:none
}
#q:focus{border-color:#7ea7ef;box-shadow:0 0 0 3px rgba(23,105,239,.08)}

.result-card{
  background:#fff;border:1px solid var(--line);border-radius:12px;
  overflow:hidden;box-shadow:0 1px 3px rgba(20,35,63,.03)
}
.result-head{
  height:66px;padding:0 18px;display:flex;align-items:center;gap:28px;
  border-bottom:1px solid var(--line)
}
.result-head strong{font-size:21px}
#resultCount{color:#6b7993;font-size:15px}
#resultCount b{color:var(--blue);font-size:18px}

.table-wrap{overflow:auto;position:relative;isolation:isolate}
table{width:100%;min-width:980px;border-collapse:separate;border-spacing:0}
thead{position:relative;z-index:5}
th{
  position:sticky;top:0;z-index:6;background:#f0f3f8;
  padding:13px 16px;border-bottom:1px solid var(--line);
  text-align:left;color:#67758e;font-size:13px;font-weight:700
}
td{
  padding:14px 16px;border-bottom:1px solid var(--line);
  background:#fff;vertical-align:middle;font-size:15px
}
tbody tr:hover td{background:#fbfcff}
.col-textbook{width:190px;min-width:190px}
.col-grade{width:85px}
.col-subject{width:120px}
.col-unit{min-width:420px}
.col-pdf{width:180px}
.unit-title{font-size:17px;font-weight:700;color:#1a2c4d}
.actions{display:flex;gap:9px;align-items:center}
.pdf{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:64px;padding:8px 13px;border-radius:7px;
  text-decoration:none;color:#fff;font-size:14px;font-weight:800
}
.pdf.problem{background:linear-gradient(135deg,#1769ef,#2d79ef)}
.pdf.answer{background:linear-gradient(135deg,#078457,#079968)}
.pdf.bundle{background:linear-gradient(135deg,#6b4be8,#7659ed)}
.pdf.off{background:#edf0f5;color:#9ca6b7;pointer-events:none}

.empty{
  padding:70px 20px;text-align:center;color:#7b879c;
  font-size:16px;line-height:1.8
}
.empty strong{display:block;color:#30425f;font-size:19px;margin-bottom:6px}

@media(max-width:1100px){
  .app-layout{grid-template-columns:320px minmax(0,1fr)}
}
@media(max-width:760px){
  header{height:62px;padding:0 14px}
  header strong{font-size:20px}.sub{display:none}
  .app-layout{display:block}
  .sidebar{
    position:relative;top:0;height:auto;border-right:0;border-bottom:1px solid var(--line);
    padding:16px
  }
  .filter-section{margin-bottom:18px}
  .filter-buttons{grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
  .textbook-buttons,.subject-buttons{grid-template-columns:repeat(2,minmax(0,1fr))}
  .filter-buttons button{min-height:42px;font-size:13px;white-space:normal}
  main{padding:14px}
  #q{height:50px}
  .result-head{height:58px}
}
