:root { --card: #ffffff; --bg: #f6f7f9; --border: #e5e7eb; --text: #111827; --muted: #6b7280; --primary: #111827; }
* { box-sizing: border-box; }
body { margin: 0; font-family: Calibri, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
header { background: var(--card); border-bottom: 1px solid var(--border); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.brand h1 { font-size: 18px; margin: 0; }
.brand .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.nav { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-top: 16px; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .grid.two { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="date"], select {
  width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.btn { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.danger { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.muted { color: var(--muted); }
.alert { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.alert.ok { border-color: #86efac; background: #f0fdf4; }
.alert.err { border-color: #fecaca; background: #fef2f2; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; text-align: left; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
th { font-size: 12px; color: var(--muted); font-weight: 700; }
.pill { display: inline-block; padding: 3px 8px; font-size: 12px; border-radius: 999px; border: 1px solid var(--border); }
.pill.on { background: #ecfdf5; border-color: #86efac; }
.pill.off { background: #fff; border-color: #fca5a5; }


.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.day-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.day-name { font-size: 12px; color: var(--muted); font-weight: 700; }
.day-date { font-size: 14px; margin-top: 6px; font-weight: 700; }
.day-weekend { border-color: #fca5a5; background: #fff5f5; }


.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.calendar-table th, .calendar-table td { white-space: nowrap; }
.calendar-table th.weekend, .calendar-table td.weekend { background: #fff5f5; }
.calendar-table th.sticky-left, .calendar-table td.sticky-left {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}
.calendar-table th.sticky-left-2, .calendar-table td.sticky-left-2 {
  position: sticky;
  left: 170px;
  background: #fff;
  z-index: 2;
}
@media (max-width: 700px){
  .calendar-table th.sticky-left-2, .calendar-table td.sticky-left-2 { left: 150px; }
}


/* --- Mobile responsiveness (320px+) --- */
@media (max-width: 420px) {
  .wrap { padding: 10px; }
  .card { padding: 12px; border-radius: 12px; }
  .row { flex-wrap: wrap; gap: 8px; }
  .btn { width: auto; }
  .btn.small { padding: 8px 10px; }
  .grid.two { grid-template-columns: 1fr; }
  input[type="text"], input[type="password"], input[type="date"], select {
    width: 100%;
    min-width: 0;
  }
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }
  .table-scroll { overflow-x: auto; }
}

/* Extremely small devices */
@media (max-width: 360px) {
  .wrap { padding: 8px; }
  .card { padding: 10px; }
  h1 { font-size: 18px; }
  h2 { font-size: 16px; }
  .btn { padding: 9px 10px; }
  th, td { padding: 7px 8px; }
  .calendar-table th.sticky-left, .calendar-table td.sticky-left { left: 0; }
  .calendar-table th.sticky-left-2, .calendar-table td.sticky-left-2 { left: 140px; }
}

/* 320px baseline */
@media (max-width: 320px) {
  .btn.small { font-size: 12px; }
  .calendar-table th { font-size: 11px; }
  .muted { font-size: 12px; }
}

.footer-muted{
  margin-top:24px;
  padding:12px 0;
  text-align:center;
  font-size:12px;
  color:#6b7280;
  border-top:1px solid #e5e7eb;
}
