
:root{
  --bg:#F9FAFB;
  --card:#FFFFFF;
  --text:#374151;
  --muted:#6B7280;
  --border:#E5E7EB;
  --accent:#64748B;
  --accent2:#475569;
  --shadow:0 1px 2px rgba(15,23,42,0.06);
  --chip:#F1F5F9;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  line-height:1.35;
}

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  background:rgba(249,250,251,0.92);
  backdrop-filter:saturate(160%) blur(8px);
  border-bottom:1px solid var(--border);
  padding:12px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand{font-weight:650; letter-spacing:0.2px}
.topbar-actions{display:flex; gap:8px; align-items:center}

.wrap{
  max-width:980px;
  margin:0 auto;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  box-shadow:var(--shadow);
}

h2{margin:0 0 10px 0; font-size:18px}

label{
  display:block;
  font-size:14px;
  margin:10px 0 6px 0;
  color:var(--text);
}

.helper{font-size:13px; color:var(--muted); margin-top:6px}

.grid2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
@media (max-width:720px){ .grid2{grid-template-columns:1fr} }

input[type="text"], input[type="number"], input[type="date"]{
  width:auto;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#FFFFFF;
  color:var(--text);
  font-size:15px;
}
input[type="date"]{color-scheme:light}
input:focus{
  outline:none;
  border-color:#CBD5E1;
  box-shadow:0 0 0 3px rgba(100,116,139,0.12);
}

.spacer{height:6px}
.row{margin-top:10px}
.check{display:flex; gap:10px; align-items:center; font-size:14px; color:var(--text)}
.check input{width:18px; height:18px}
.actions{margin-top:14px; display:flex; gap:10px; flex-wrap:wrap}

.btn{
  border:1px solid var(--border);
  background:#FFFFFF;
  color:var(--accent2);
  padding:10px 12px;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
}
.btn:hover{border-color:#CBD5E1}
.btn.primary{
  background:var(--accent);
  color:#FFFFFF;
  border-color:transparent;
}
.btn.primary:hover{background:var(--accent2)}
.btn.ghost{background:transparent}

.tableWrap{overflow:auto; border-radius:12px; border:1px solid var(--border)}
.table{
  width:100%;
  border-collapse:collapse;
  min-width:0;
  table-layout:fixed;
}
.table th, .table td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
  font-size:14px;
}
.table thead th{
  background:#F8FAFC;
  color:var(--muted);
  font-weight:700;
}
.table tfoot td{
  background:#F8FAFC;
  font-weight:700;
}
.num{text-align:right; white-space:nowrap}
.pctInput{width:92px; text-align:right}
.badTotal{color:#B91C1C}

.summary{
  display:flex;
  flex-wrap:wrap;
  gap:10px 18px;
  margin:8px 0 12px 0;
  color:var(--muted);
  font-size:14px;
}
.summary span{white-space:nowrap}

.resultsHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:6px;
}
.viewToggle{
  display:inline-flex;
  border:1px solid var(--border);
  background:#FFFFFF;
  border-radius:12px;
  padding:2px;
  gap:2px;
}
.seg{
  border:none;
  background:transparent;
  padding:8px 10px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  color:var(--muted);
}
.seg.active{
  background:var(--chip);
  color:var(--text);
}

/* Weekday pills */
.weekdayRow{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:6px;
}
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--border);
  background:#FFFFFF;
  border-radius:999px;
  padding:8px 10px;
  cursor:pointer;
  user-select:none;
  color:var(--text);
}
.pill input{width:16px; height:16px}

/* Calendar */
#calendarView{display:none}
.calMonth{
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  margin:12px 0;
}
.calMonthHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px;
  background:#F8FAFC;
  border-bottom:1px solid var(--border);
}
.calMonthTitle{font-weight:750; color:var(--text)}
.calLegend{font-size:12px; color:var(--muted)}
.calGrid{
  display:grid;
  grid-template-columns:repeat(7, 1fr);
}
.calDow{
  padding:8px 10px;
  font-size:12px;
  color:var(--muted);
  background:#FFFFFF;
  border-bottom:1px solid var(--border);
}

/* Make every calendar cell the same height */
.calCell{
  height: 110px;
  padding:8px 10px;
  border-bottom:1px solid var(--border);
  border-right:1px solid var(--border);
  background:#FFFFFF;
  overflow:hidden;
}
.calCell:nth-child(7n){border-right:none}
.calCell.outside{background:#FBFCFE; color:var(--muted)}
.calDateRow{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px}
.calDateNum{font-weight:750; color:var(--text)}
.calHours{font-size:12px; color:var(--muted)}
.calBlocks{font-size:12px; color:var(--text)}
.calBlocks div{margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.calTag{
  display:inline-block;
  background:var(--chip);
  border:1px solid var(--border);
  border-radius:999px;
  padding:2px 6px;
  font-size:11px;
  color:var(--muted);
}

/* Header credit */
.brandWrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
}

.credit{
  text-align:center;
  font-size:15px;
  line-height:1.4;
  color:var(--text-primary);
}

.credit a{
  color:var(--accent2);
  font-weight:500;
  text-decoration:none;
  border-bottom:1px solid rgba(71,85,105,0.35);
}

.credit a:hover{
  border-bottom-color: rgba(71,85,105,0.7);
}

.mobile-note{
  display:block;
  margin-top:8px;
  font-size:14px;
  color:var(--muted);
}



/* Mobile table tweaks */
@media (max-width:720px){
  .table th, .table td{ padding:8px 8px; font-size:13px; }
  .pctInput{ width:76px; }
  /* Let long category names wrap instead of forcing horizontal scroll */
  .table td:first-child, .table th:first-child{
    white-space:normal;
    word-break:break-word;
  }
}
@media (max-width:420px){
  /* Blueprint table: hide Days column */
  #bpTable th:nth-child(4), #bpTable td:nth-child(4){ display:none; }
  /* Plan list: hide Hours column */
  #planTable th:nth-child(3), #planTable td:nth-child(3){ display:none; }
}

/* Compact percentage inputs */
.pctInput{
  width:56px;
  min-width:56px;
  padding:6px 6px;
  text-align:right;
}

/* FORCE compact percentage inputs */
.pctInput{
  width: 7ch !important;
  min-width: 7ch !important;
  max-width: 7ch !important;
  padding: 4px 4px !important;
  box-sizing: content-box;
  text-align: right;
}

/* Form input sizing – FINAL */
input[type="date"]{
  width: auto;
  min-width: 170px;
  max-width: 190px;
}


}

/* Add vertical spacing between form lines */
label{
  display: block;
  margin-top: 16px;
  margin-bottom: 6px;
}

input,
textarea{
  margin-bottom: 12px;
}

small,
.helper-text{
  display: block;
  margin-top: 6px;
  margin-bottom: 12px;
  line-height: 1.4;
}

input[type="checkbox"]{
  margin-top: 16px;
}
/* Auto-fit number inputs to content */
input[type="number"]{
  width: fit-content;
  min-width: 3ch;
  max-width: 6ch;
}

@media print {
  .no-print {
    display: none !important;
  }

  .calendarView {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  body {
    background: white;
  }
}
