:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --primary:#dc2626;
  --primary2:#991b1b;
  --danger:#b91c1c;
  --shadow: 0 10px 25px rgba(0,0,0,.08);
  --radius: 16px;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: linear-gradient(180deg, #ffffff, var(--bg));
  color:var(--text);
  padding-bottom:72px;
}
a{color:inherit; text-decoration:none}
.container{max-width:1100px; margin:0 auto; padding:18px}
.topbar{
  position:sticky; top:0; z-index:50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom:1px solid var(--border);
  padding:10px 16px;
  display:flex; align-items:center; justify-content:space-between;
}
.brand{display:flex; align-items:center; gap:10px}
.logo{width:34px; height:34px; border-radius:10px; box-shadow: var(--shadow)}
.brand-name{font-weight:800; letter-spacing:.3px}
.top-actions{display:flex; align-items:center; gap:10px}
.bottombar{
  position:fixed; left:0; right:0; bottom:0; z-index:60;
  background: rgba(255,255,255,.96);
  border-top:1px solid var(--border);
  display:flex; justify-content:space-around; padding:10px 8px;
}
.navitem{
  padding:8px 10px;
  border-radius:999px;
  color:#111;
  font-weight:600;
}
.navitem.active{
  background:#fff0f0;
  color:var(--primary2);
  border:1px solid #ffd0d0;
}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
  margin:14px 0;
}
.narrow{max-width:520px; margin:24px auto}

/* Calendar */
.cal-wrap{display:grid; grid-template-columns: 300px 1fr; gap:14px; align-items:start}
.cal-top{grid-column:1 / -1; display:flex; justify-content:space-between; align-items:end; margin-top:6px}
.cal-title h1{margin:0; font-size:30px}
.cal-range{color:var(--muted); margin-top:4px; font-weight:600}
.cal-controls{display:flex; gap:8px; align-items:center}
.cal-controls .btn{padding:8px 12px}

.cal-side .section-title{font-weight:800; margin:6px 0 8px}
.cal-side .pill{display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 10px; border:1px solid var(--border); border-radius:12px; margin:8px 0; background:#fff}
.cal-side .pill small{color:var(--muted)}
.cal-side .emp{cursor:grab}
.cal-side .job{cursor:grab}

.cal-main{min-height:520px}
.week-grid{display:grid; grid-template-columns: repeat(7, 1fr); gap:10px}
.day-col{border:1px solid var(--border); border-radius:16px; background:#fff; box-shadow: var(--shadow); min-height:360px; padding:10px; position:relative}
.day-col.drag-over{outline:3px solid #ffd0d0}
.day-head{display:flex; justify-content:space-between; align-items:center; padding:2px 2px 8px 2px; border-bottom:1px solid var(--border); margin-bottom:8px}
.day-head .dow{font-weight:900}
.day-head .dnum{color:var(--muted); font-weight:700}

.job-card{border:1px solid #ffd0d0; background:#fff5f5; border-radius:14px; padding:10px; margin:8px 0; cursor:grab}
.job-card.drag-over{outline:3px solid #c7f9cc}
.job-card .row{display:flex; justify-content:space-between; gap:10px; align-items:center}
.job-card .title{font-weight:900}
.job-card .meta{color:var(--muted); font-weight:600; font-size:12px; margin-top:4px}
.job-card .badge{background:#fff; border:1px solid var(--border); border-radius:999px; padding:3px 8px; font-size:12px; font-weight:800}
.job-card .assigned{margin-top:6px; display:flex; flex-wrap:wrap; gap:6px}
.job-card .chip{background:#fff; border:1px solid var(--border); border-radius:999px; padding:3px 8px; font-size:12px; font-weight:800}

@media (max-width: 980px){
  .cal-wrap{grid-template-columns:1fr}
  .week-grid{grid-template-columns:1fr}
}
h1{margin:0 0 12px 0; font-size:30px}
h2{margin:0 0 10px 0; font-size:18px}
hr{border:none; border-top:1px solid var(--border); margin:14px 0}
.form label{display:block; margin-top:10px; font-weight:700; font-size:13px; color:#111}
input, select, textarea{
  width:100%;
  padding:10px 12px;
  margin-top:6px;
  border:1px solid var(--border);
  border-radius:12px;
  font-size:14px;
  color:var(--text);
  background:#fff;
}
textarea{resize:vertical}
.row{display:flex; align-items:center}
.row.space{justify-content:space-between}
.row.gap{gap:10px}
.row.wrap{flex-wrap:wrap}
.right{text-align:right}
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  font-weight:800;
  cursor:pointer;
}
.btn:hover{border-color:#d1d5db}
.btn-primary{
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  border-color: transparent;
  color:white;
}
.btn-danger{background: var(--danger); border-color: transparent; color:white}
.btn-ghost{background: transparent}
.pill{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  background:#f3f4f6;
  border:1px solid var(--border);
  font-weight:800;
  font-size:12px;
}
.muted{color:var(--muted)}
.small{font-size:12px}
.flash-wrap{margin:10px 0}
.flash{padding:10px 12px; border-radius:12px; border:1px solid var(--border); margin-bottom:10px; background:#fff}
.flash.ok{border-color:#bbf7d0; background:#f0fdf4}
.flash.error{border-color:#fecaca; background:#fef2f2}
.grid2{display:grid; grid-template-columns: 1fr; gap:14px}
.grid3{display:grid; grid-template-columns: 1fr; gap:14px}
.grid4{display:grid; grid-template-columns: 1fr; gap:14px}
@media(min-width:900px){
  .grid2{grid-template-columns: 1fr 1fr}
  .grid3{grid-template-columns: 1fr 1fr 1fr}
  .grid4{grid-template-columns: 1fr 1fr 1fr 1fr}
}
.stat{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background:#fff;
}
.stat-k{color:var(--muted); font-weight:800; font-size:12px}
.stat-v{font-weight:900; font-size:24px; margin-top:6px}
.bigmoney{font-weight:950; font-size:42px; margin-top:6px}
.list{display:flex; flex-direction:column; gap:10px}
.listitem{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.listitem:hover{border-color:#d1d5db}
.stack{display:flex; flex-direction:column; gap:10px}
.note{border:1px solid var(--border); border-radius:14px; padding:10px; background:#fff}
.code{white-space:pre-wrap; font-size:12px; background:#f9fafb; border:1px solid var(--border); border-radius:12px; padding:10px}
.table{width:100%; border-collapse:collapse; font-size:13px}
.table th, .table td{border-bottom:1px solid var(--border); padding:10px; text-align:left; vertical-align:top}
.table th{color:var(--muted); font-weight:900; font-size:12px}
.chips{display:flex; flex-wrap:wrap; gap:8px}
.chip{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:8px 10px;
  font-size:13px;
  font-weight:700;
  display:flex; align-items:center; gap:8px;
}
.photo-grid{display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px}
@media(min-width:900px){ .photo-grid{grid-template-columns: repeat(3, minmax(0,1fr));} }
.photo{border:1px solid var(--border); border-radius:14px; overflow:hidden; background:#fff}
.photo img{width:100%; height:150px; object-fit:cover; display:block}
.photo .muted{padding:8px}
.calendar-grid{
  display:grid;
  grid-template-columns: repeat(7, minmax(0,1fr));
  gap:10px;
}
.cal-col{
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  min-height:240px;
}
.cal-head{
  padding:10px;
  background:#f9fafb;
  border-bottom:1px solid var(--border);
}
.cal-day{font-weight:900}
.cal-date{color:var(--muted); font-size:12px; font-weight:700}
.cal-body{padding:10px; display:flex; flex-direction:column; gap:8px; min-height:190px}
.cal-job{
  border:1px solid #ffd0d0;
  background:#fff5f5;
  border-radius:12px;
  padding:8px;
  cursor:grab;
}
.cal-title{font-weight:900; font-size:12px}
.cal-meta{color:var(--muted); font-size:11px; font-weight:700}

/* --- Scheduler (Calendar v2) responsive layout --- */
.cal-wrap{display:grid; grid-template-columns:360px 1fr; gap:12px; align-items:start;}
.cal-side .card{margin-bottom:12px}
.job-pill{cursor:grab; user-select:none; background:#fff; border:1px solid var(--border)}
.job-pill small{color:var(--muted)}

/* FullCalendar tweaks */
.fc .fc-button{border-radius:12px}
.fc .fc-event{border-radius:12px; border:1px solid rgba(0,0,0,.08)}
.fc .fc-timegrid-slot{height:38px}

@media(max-width:900px){
  .cal-wrap{grid-template-columns:1fr}
}
