@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&family=Source+Serif+4:wght@400;600;700&display=swap");

:root{
  --bg:#f2f2f7;
  --ink:#0d1624;
  --muted:#5c6676;
  --brand:#c51f2d;
  --brand-dark:#8f1620;
  --accent:#0a84ff;
  --panel:#ffffff;
  --border:#e5e5ea;
  --shadow:0 10px 30px rgba(15,23,36,.08);
  --ok:#1f8a4c;
  --warn:#f0a000;
  --bad:#c51f2d;
  --logo-url:url('/logo.png');
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:"Manrope", sans-serif;
  color:var(--ink);
  background:linear-gradient(180deg, #f6f7fb 0%, #eef1f6 100%);
}
.page{padding:28px 20px 60px}
.container{max-width:1100px;margin:auto}
.visually-hidden{
  position:absolute;
  left:-10000px;
  width:1px;
  height:1px;
  overflow:hidden;
}
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:18px;
  padding:12px 16px;
  border:1px solid var(--border);
  border-radius:16px;
  background:rgba(255,255,255,.9);
  backdrop-filter:blur(10px);
  box-shadow:var(--shadow);
}
.top-actions{margin:0}
.brand{display:flex;align-items:center;gap:12px}
.brand-text{display:flex;flex-direction:column;gap:2px}
.brand-title{
  font-family:"Source Serif 4", serif;
  font-size:26px;
  letter-spacing:.3px;
}
.brand-sub{
  font-size:12px;
  letter-spacing:2px;
  text-transform:uppercase;
  color:var(--muted);
}
.brand.centered{align-items:center;flex-direction:column;text-align:center}
.logo-badge{
  width:46px;
  height:46px;
  border-radius:50%;
  background:#0b3f5e;
  background-image:var(--logo-url);
  background-size:cover;
  background-position:center;
  border:1px solid var(--border);
  box-shadow:0 8px 18px rgba(10,20,30,.12);
}
.brand.centered .logo-badge{
  width:64px;
  height:64px;
}

.hero{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  padding:18px 20px;
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
  box-shadow:var(--shadow);
  margin-bottom:16px;
}
.hero.compact{padding:14px 16px}
.hero h1{margin:0;font-size:26px}

.card{
  background:var(--panel);
  padding:16px;
  margin:16px 0;
  border-radius:18px;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}
.card h2{margin-top:0}
.card h2{
  display:flex;
  align-items:center;
  gap:8px;
}
.card h2:before{
  content:"";
  width:10px;
  height:10px;
  border-radius:2px;
  background:linear-gradient(180deg, var(--brand), var(--accent));
}
.accordion{
  padding:0;
}
.accordion > summary{
  list-style:none;
  cursor:pointer;
  padding:16px;
  font-weight:800;
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--border);
}
.accordion > summary::-webkit-details-marker{display:none}
.accordion > summary::after{
  content:"▾";
  font-size:16px;
  color:var(--muted);
  transition:transform .2s ease;
}
.accordion[open] > summary::after{
  transform:rotate(180deg);
}
.accordion-body{
  padding:12px 16px 18px 16px;
}
.subcard{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  margin:12px 0;
  background:#fff;
}
.subcard h3{margin:0 0 8px 0}
.course-header{
  padding:14px 16px;
  border-radius:14px;
  border:1px solid var(--border);
  background:linear-gradient(135deg, #f7f8fc, #eef3f9);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.course-title{font-weight:800;font-size:18px}
.course-range{font-size:13px}
.chip-list{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.chip{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:8px 14px;
  cursor:pointer;
  font-weight:700;
}
.chip.active{
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(10,132,255,.18);
}

.btn{
  background:linear-gradient(180deg, #d72b3a, var(--brand-dark));
  color:#fff;
  border:0;
  padding:10px 14px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
  letter-spacing:.2px;
  transition:transform .12s ease, box-shadow .12s ease;
}
.btn:hover{transform:translateY(-1px);box-shadow:0 8px 18px rgba(197,31,45,.25)}
.secondary{
  background:transparent;
  color:var(--ink);
  border:1px solid var(--border);
}
.secondary.active{
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(10,132,255,.2);
}

.segmented{
  display:inline-flex;
  gap:4px;
  padding:4px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#f3f4f7;
}
.segmented .seg{
  border:0;
  background:transparent;
  padding:8px 14px;
  border-radius:999px;
  font-weight:700;
  color:var(--ink);
  cursor:pointer;
}
.segmented .seg.active{
  background:#fff;
  border:1px solid var(--border);
  box-shadow:0 6px 16px rgba(15,23,36,.1);
}
.switch{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:13px;
  color:var(--muted);
}
.switch input{
  appearance:none;
  width:44px;
  height:24px;
  background:#d1d1d6;
  border-radius:12px;
  position:relative;
  outline:none;
  cursor:pointer;
  transition:background .2s ease;
}
.switch input::before{
  content:"";
  width:20px;
  height:20px;
  border-radius:50%;
  background:#fff;
  position:absolute;
  top:2px;
  left:2px;
  box-shadow:0 4px 10px rgba(0,0,0,.18);
  transition:transform .2s ease;
}
.switch input:checked{background:#34c759}
.switch input:checked::before{transform:translateX(20px)}
.muted{color:var(--muted)}
.hint{color:var(--muted);margin-top:8px}
.badge{
  display:inline-block;
  padding:6px 12px;
  border-radius:999px;
  font-size:12px;
  background:#f8f9fb;
  border:1px solid var(--border);
}

.list-item{
  display:block;
  padding:14px;
  border:1px solid var(--border);
  border-radius:12px;
  margin:10px 0;
  text-decoration:none;
  color:var(--ink);
  background:#fff;
  transition:transform .08s ease, box-shadow .08s ease;
}
.list-item.confirmed{
  border-color:#bfe9d2;
  background:#e6f6ec;
}
.list-item.pending{
  border-color:#f0d6a8;
  background:#fff4dc;
}
.list-item.rejected{
  border-color:#f5b6b6;
  background:#ffe3e3;
}
.list-item.clickable{cursor:pointer}
.list-item:hover{transform:translateY(-1px);box-shadow:0 8px 18px rgba(13,22,36,.08)}
.list{list-style:none;padding:0;margin:10px 0}
.list-item.archived{opacity:.7;pointer-events:none}
.section-title{
  font-weight:800;
  margin:18px 0 6px 0;
  color:var(--ink);
}
.item-main{font-weight:700}
.item-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px;color:var(--muted);font-size:12px}
.pill{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  font-weight:700;
  font-size:11px;
  background:#f3f4f7;
  border:1px solid var(--border);
  color:var(--ink);
  white-space:nowrap;
}
.pill-ok{background:#e6f6ec;border-color:#bfe9d2;color:#1f8a4c}
.pill-warn{background:#fff4dc;border-color:#f0d6a8;color:#a26b00}
.pill-bad{background:#ffe3e3;border-color:#f5b6b6;color:#a33a3a}

.table tr.flash{
  outline:2px solid #6bb5ff;
  background:#eef6ff;
}

.consent-row{
  align-items:flex-start;
  gap:10px;
  margin-top:8px;
}
.modal{
  position:fixed;
  inset:0;
  background:rgba(13,22,36,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:50;
  padding:20px;
}
.modal.hidden{display:none}
.modal-card{
  background:#fff;
  border-radius:16px;
  padding:20px;
  max-width:520px;
  width:100%;
  box-shadow:0 20px 40px rgba(13,22,36,.2);
}
.modal-card h3{margin-top:0}
.note-chip{background:#eef2ff;border-color:#d8def2;color:#394b7f}
.admin-chip{background:#fde8ea;border-color:#f3c2c7;color:#8f1620}
.capacity-chip{background:#e8f2ff;border-color:#cdd9f2;color:#2a4b7a}
.small{font-size:12px}
.topic-panel{margin-top:12px;padding-top:8px;border-top:1px dashed var(--border)}
.topic-panel h3{margin:6px 0 10px 0;font-size:16px}
.topic-list-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  margin-bottom:8px;
}
.topic-cell{display:flex;flex-direction:column;gap:6px}
.topic-select{width:100%}

.calendar{
  display:grid;
  grid-template-columns:repeat(7, minmax(96px, 1fr));
  gap:8px;
  grid-auto-rows:minmax(96px, auto);
  width:100%;
  min-width:760px;
  padding:4px;
}
.day{
  padding:10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#fff;
  cursor:pointer;
  font-weight:600;
  text-align:center;
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
  flex-direction:column;
  position:relative;
}
.day.head{
  background:#f4f5f8;
  color:var(--muted);
  font-weight:700;
  cursor:default;
  align-items:center;
  justify-content:center;
}
.day.empty{
  background:transparent;
  border:0;
  cursor:default;
}
.day.today{
  border:2px solid var(--accent);
}
.day.selected{
  outline:2px solid var(--accent);
  box-shadow:0 0 0 3px rgba(44,112,255,.15);
}
.day .date{font-weight:700}
.day .who{margin-top:6px;font-size:12px;color:var(--ink)}
.mine-name{font-weight:700}
.cell-meta{margin-top:6px;display:flex;gap:6px;flex-wrap:wrap;font-size:11px;line-height:1.2}
.calendar-wrap{
  overflow-x:auto;
  overflow-y:visible;
  -webkit-overflow-scrolling:touch;
  padding:12px;
  scroll-padding-left:12px;
}
.table-wrap{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.admin-note{
  max-width:100%;
  white-space:normal;
  overflow:visible;
  text-overflow:unset;
}
.free{background:#e8f6ee}
.taken{background:#f8d7da;color:#7a1a22;cursor:not-allowed}
.rejected{background:#f8d7da;color:#7a1a22;cursor:not-allowed}
.pending{background:#fff3dc;color:#8a5b00;cursor:not-allowed}
.blocked{
  background:#f8d7da;
  color:#7a1a22;
  cursor:not-allowed;
}
.urgent-locked{
  background:#f8d7da;
  color:#7a1a22;
  cursor:not-allowed;
}
.weekend{
  background:#f1f2f4;
  color:#9aa3b2;
  cursor:not-allowed;
}
.admin-calendar .admin-green{
  background:#e8f6ee;
}
.admin-calendar .mandatory{
  background:#f8d7da;
  color:#7a1a22;
  border:2px solid #c8323a;
}
.admin-calendar .mandatory-confirmed{
  background:#e8f6ee;
  color:#1f4a2e;
  border:2px solid #c8323a;
}
.admin-calendar .urgent-locked{
  background:#fff3dc;
  color:#8a5b00;
  border:2px solid #f0c36b;
}
.admin-calendar .urgent-unlocked{
  background:#fff3dc;
  border:2px solid #86c7b4;
  color:#7a5400;
}
.admin-calendar .urgent-approved{
  background:#e8f6ee;
  border:2px solid #2c8d52;
  color:#1f4a2e;
}
.admin-calendar .pending{
  background:#fff3dc;
  color:#8a5b00;
  border:2px solid #f0c36b;
}
.mine{outline:2px solid var(--accent)}
.mine.pending{cursor:pointer}
.important{outline:2px solid var(--bad)}
.approved{outline:2px solid var(--ok)}
.course-grid{display:grid;grid-template-columns:2.2fr 1fr;gap:16px}
.course-grid > div{min-width:0}
.course-grid .calendar-wrap{
  padding:12px;
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
  box-shadow:var(--shadow);
}
.legend{display:flex;gap:10px;align-items:center;margin-top:10px;font-size:12px;flex-wrap:wrap}
.dot{display:inline-block;width:12px;height:12px;border-radius:50%}
.dot.blocked{background:#f8d7da;border:1px solid #f3c2c7}
.dot.urgent{background:#fff3dc;border:1px solid #f0d6a8}
.dot.pending{background:#fff3dc;border:1px solid #f0d6a8}
.dot.mine{background:#fff;border:2px solid #1f8a4c}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.form-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;align-items:center}
.table{width:100%;border-collapse:collapse}
.table td,.table th{border-bottom:1px solid var(--border);padding:8px;text-align:left}
.table tr:hover td{background:#f8f9fb}
.week-row td{
  background:#eef3f9;
  color:#12395a;
  font-weight:700;
  border-bottom:1px solid var(--border);
}
.table tr.week-row:hover td{background:#eef3f9}
.week-note-row{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.week-note-row .week-label{
  font-weight:700;
  min-width:110px;
}
.week-note-input{
  flex:1;
  min-width:220px;
}
.day-note-input{
  width:100%;
}
.assign-row{
  display:flex;
  gap:6px;
  align-items:center;
  margin-top:6px;
  flex-wrap:wrap;
}
.assign-row select{
  max-width:160px;
}
.day-group td{
  background:#f4f7fb;
  font-weight:700;
  border-bottom:1px solid var(--border);
}
.day-group.multi td{
  background:#e9f1ff;
}
.row-approved td{
  background:#f0fbf3;
}
.row-pending td{
  background:#fff7ec;
}
.row-rejected td{
  background:#ffe3e3;
}
.day-sep td{
  padding:6px 0;
  border-bottom:0;
  background:transparent;
}
.out-range td{
  color:#9aa3b2;
  background:#f6f7f9;
}
.out-range input,
.out-range select,
.out-range button{
  opacity:.6;
}
.t-name{cursor:pointer;text-decoration:underline;text-decoration-thickness:2px;text-decoration-color:rgba(10,132,255,.35)}
button.btn.secondary{white-space:nowrap}

input, select{
  background:#fff;
  border:1px solid var(--border);
  color:var(--ink);
  padding:10px 12px;
  border-radius:12px;
  width:100%;
}
input:focus, select:focus{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(10,132,255,.15);
}

.login-box{
  max-width:420px;
  margin:12vh auto 0 auto;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:24px;
  box-shadow:var(--shadow);
  position:relative;
}
.login-box:before{
  content:"";
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:6px;
  border-radius:16px 16px 0 0;
  background:linear-gradient(90deg, var(--brand), var(--accent));
}

@media (max-width: 980px){
  .course-grid{grid-template-columns:1fr}
  .form-row{grid-template-columns:1fr}
}

@media (max-width: 860px){
  .page{padding:16px 14px 40px}
  .container{max-width:100%}
  .topbar{flex-direction:column;align-items:flex-start;gap:10px}
  .top-actions{width:100%;justify-content:flex-end}
  .hero{flex-direction:column;align-items:flex-start}
  .hero .badge{align-self:flex-start}
  .row{align-items:stretch}
  .row > *{flex:1 1 100%}
  .btn{width:100%}
  .btn.secondary{width:100%}
  .segmented{width:100%;justify-content:space-between}
  .segmented .seg{flex:1}
  .switch{width:100%;justify-content:space-between}
  .calendar{grid-auto-rows:minmax(72px, auto);min-width:720px;padding:4px}
  .day{padding:8px;font-size:12px}
  .day .who{font-size:11px}
  .cell-meta{font-size:10px}
  .table td,.table th{padding:8px 6px;font-size:12px}
  .brand-title{font-size:22px}
  .brand-sub{letter-spacing:1.5px}
  .logo-badge{width:40px;height:40px}
}

@media (max-width: 600px){
  .topbar{position:sticky;top:0;z-index:10}
  .card{padding:14px;border-radius:16px}
  .hero h1{font-size:22px}
  .calendar{min-width:660px;padding:4px}
  .table-wrap{border-radius:14px;border:1px solid var(--border);background:#fff}
  .table{min-width:560px}
  .list-item{padding:12px}
  .login-box{margin:6vh 12px 0 12px}
  .course-grid > aside{order:2}
  .course-grid > div:first-child{order:1}
}

@media (max-width: 900px){
  .accordion > summary{font-size:17px}
  .course-header{flex-direction:column;align-items:flex-start}
  .chip{width:100%;text-align:left}
}

@media (max-width: 430px){
  .brand{gap:8px}
  .brand-title{font-size:20px}
  .brand-sub{font-size:11px}
  .btn{padding:10px 12px}
  .calendar{min-width:620px;padding:4px}
}
