:root{
  --bg:#f8fbff;
  --panel:#ffffff;
  --text:#0a1a2a;
  --muted:#5f7085;
  --line:rgba(15,39,82,0.1);
  --accent:#2b8cff;
  --danger:#ff6a6a;
  --ok:#16b889;
  --radius:14px;
  --shadow: 0 14px 40px rgba(15,39,82,0.12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; font-family:var(--sans); background:var(--bg); color:var(--text); }
a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }

.container{ max-width: 980px; margin: 0 auto; padding: 18px; }

.topbar{
  position: sticky; top:0; z-index:10;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15,39,82,0.08);
}
.topbar__inner{
  display:flex; align-items:center; justify-content:space-between;
  gap:16px;
}
.brand{ display:flex; align-items:center; gap:10px; }
.brand__logo{ height:40px; width:40px; object-fit:contain; border-radius:10px; background: transparent; }
.brand__title{ font-weight:700; letter-spacing:.2px; }
.brand__sub{ font-size:12px; color:var(--muted); margin-top:2px; }

.nav{ display:flex; gap:12px; }
.nav a{
  display:inline-block; padding:8px 10px; border-radius:10px;
  border:1px solid transparent;
  color: var(--text);
}
.nav a.active{
  border-color: var(--line);
  background: rgba(43,140,255,.08);
  box-shadow: 0 6px 18px rgba(15,39,82,0.10);
}
.nav-toggle{ display:none; }
.burger{
  display:none;
  width:32px; height:24px;
  flex-shrink:0;
  flex-direction:column;
  justify-content:space-between;
  cursor:pointer;
}
.burger span{
  display:block; height:3px; background: var(--text); border-radius: 999px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-open .burger span:nth-child(1){ transform: translateY(9px) rotate(45deg); }
.nav-open .burger span:nth-child(2){ opacity:0; }
.nav-open .burger span:nth-child(3){ transform: translateY(-9px) rotate(-45deg); }

.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
  min-width: 0;
}
@media (min-width: 900px){
  .grid.two{ grid-template-columns: 1fr 1fr; }
}

@media (max-width: 780px){
  .topbar__inner{ flex-wrap: wrap; }
  .burger{ display:flex; }
  .nav{
    width: 100%;
    flex-direction: column;
    gap:8px;
    display:none;
    padding: 10px 0 4px;
  }
  .nav a{ padding:10px 12px; }
  .nav-open .nav{ display:flex; }
}
h1,h2,h3{ margin: 0 0 10px; }
h1{ font-size: 22px; }
h2{ font-size: 18px; }
h3{ font-size: 15px; color: var(--muted); font-weight:600; }

.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.row > *{ flex: 1 1 auto; }

label{ display:block; font-size: 12px; color:var(--muted); margin: 10px 0 6px; }
input, textarea, select{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(43,140,255,.18);
  background: #eef3ff;
  color: var(--text);
  outline:none;
  box-shadow: 0 8px 22px rgba(15,39,82,0.08);
}
textarea{ min-height: 110px; resize: vertical; }

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(43,140,255,.08);
  color: var(--text);
  cursor:pointer;
  user-select:none;
  box-shadow: 0 8px 20px rgba(15,39,82,0.10);
}
.btn:hover{ background: rgba(43,140,255,.12); }
.btn.primary{ border-color: rgba(43,140,255,.25); background: linear-gradient(135deg, #0fbc8c, #1cd2ff); color:#052b3a; font-weight:700; }
.btn.danger{ border-color: rgba(255,106,106,.35); background: rgba(255,106,106,.12); color:#7a0000; }

.badge{
  display:inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  border:1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  background: rgba(43,140,255,.06);
}
.badge.ok{ color: var(--ok); border-color: rgba(22,184,137,.35); background: rgba(22,184,137,.12); }
.badge.warn{ color: #d99931; border-color: rgba(217,153,49,.35); background: rgba(217,153,49,.12); }
.badge.danger{ color: var(--danger); border-color: rgba(255,106,106,.35); background: rgba(255,106,106,.12); }

.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.table th, .table td{
  padding: 10px;
  border-bottom:1px solid var(--line);
  vertical-align: top;
}
.table th{ text-align:left; font-size:12px; color: var(--muted); background: rgba(43,140,255,.06); }
.table.scrollable{
  display:block;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}
.table.scrollable table{
  width:100%;
  border-collapse: collapse;
}
.table.scrollable th,
.table.scrollable td{
  white-space: nowrap;
}

.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.mono{ font-family: var(--mono); }

.hr{ height:1px; background: var(--line); margin: 14px 0; }

.footer{ color: var(--muted); padding-bottom: 36px; }
.notice{ color: var(--muted); font-size: 12px; line-height: 1.5; }
.error{ color: var(--danger); font-size: 12px; white-space: pre-wrap; }
.success{ color: var(--ok); font-size: 12px; white-space: pre-wrap; }

#planningHeader{
  display:grid;
  grid-template-columns: repeat(7, 110px);
  gap:8px;
  font-size:12px;
  color: var(--muted);
  width: max-content;
  min-width: calc(7 * 110px + 6 * 8px);
}
#planningHeader div{
  text-align:center;
  padding:6px 0;
}
#planningGrid{
  display:grid;
  grid-template-columns: repeat(7, 110px);
  gap:8px;
  width: max-content;
  min-width: calc(7 * 110px + 6 * 8px);
}
.calendar__cell{
  border:1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  min-height: 74px;
  text-align:left;
  cursor:pointer;
  box-shadow: 0 8px 18px rgba(15,39,82,0.08);
}
.calendar__cell:hover{ border-color: rgba(43,140,255,.45); }
.calendar__cell.is-muted{ opacity: .45; background:#f4f6fb; }
.calendar__cell.is-today{ border-color: rgba(43,140,255,.6); }
.calendar__cell.is-active{ box-shadow: 0 10px 22px rgba(43,140,255,.25); }
.calendar__cell.has-event{ background: #f1f8ff; }
.calendar__day{ font-weight:700; }
.calendar__meta{ margin-top:6px; }

#planning{
  overflow-x: scroll;
  scrollbar-gutter: stable;
  max-width: 100%;
  width: 100%;
  display: block;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

#calendarMount{
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

#planning::-webkit-scrollbar{
  height: 10px;
}
#planning::-webkit-scrollbar-track{
  background: rgba(15,39,82,0.08);
  border-radius: 999px;
}
#planning::-webkit-scrollbar-thumb{
  background: rgba(15,39,82,0.28);
  border-radius: 999px;
}

@media (max-width: 680px){
  .calendar__cell{
    padding: 8px;
    min-height: 64px;
  }
  .calendar__day{ font-size: 13px; }
}
