:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #1c1f26;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --radius: 12px;
  --caution: #f5a623;
  --caution-dark: #1a1a1a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.brand-strip {
  background: var(--caution-dark);
  color: var(--caution);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 0.4rem;
}
.brand-strip span { color: #f4f4f4; }
.brand-strip b { color: var(--caution); }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    45deg,
    var(--caution),
    var(--caution) 6px,
    var(--caution-dark) 6px,
    var(--caution-dark) 12px
  );
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
}

.topbar a.logout {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: repeating-linear-gradient(
    45deg,
    var(--caution),
    var(--caution) 8px,
    var(--caution-dark) 8px,
    var(--caution-dark) 16px
  );
}

.card h2, .card h3 {
  margin-top: 0;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border-radius: 9px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #eef0f3; color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

.form-group { margin-bottom: 0.9rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text-muted); }
.form-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.worker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.worker-row:last-child { border-bottom: none; }
.worker-name { font-weight: 600; }
.worker-owed { color: var(--success); font-weight: 700; }

.link-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-full { background: rgba(22,163,74,.12); color: var(--success); }
.badge-half { background: rgba(217,119,6,.12); color: var(--warning); }
.badge-absent { background: rgba(220,38,38,.12); color: var(--error); }
.badge-unset { background: #eef0f3; color: var(--text-muted); }

.day-tap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.6rem;
}
.day-tap .date { font-weight: 600; }
.day-tap .actions { display: flex; gap: 0.4rem; }
.day-btn-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}
.day-btn {
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  padding: 0.6rem 0.3rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
}
.day-field-row {
  width: 100%;
  margin-top: 0.5rem;
}
.day-field-row .form-input {
  width: 100%;
}
.day-btn.active-full { background: var(--success); color: #fff; border-color: var(--success); }
.day-btn.active-half { background: var(--warning); color: #fff; border-color: var(--warning); }
.day-btn.active-absent { background: var(--error); color: #fff; border-color: var(--error); }

.reason-text { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.4rem; }

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: rgba(220,38,38,.08); color: var(--error); }
.alert-success { background: rgba(22,163,74,.08); color: var(--success); }

/* Screenshot page - sized for iPhone screenshot */
.screenshot-card {
  position: relative;
  max-width: 390px;
  margin: 1rem auto;
  background: var(--card);
  border-radius: 18px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  overflow: hidden;
}

.screenshot-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    45deg,
    var(--caution),
    var(--caution) 8px,
    var(--caution-dark) 8px,
    var(--caution-dark) 16px
  );
}
.screenshot-header { text-align: center; margin-bottom: 1.25rem; }
.screenshot-header .name { font-size: 1.4rem; font-weight: 800; }
.screenshot-header .range { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }
.screenshot-day {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.screenshot-day:last-child { border-bottom: none; }
.screenshot-day .date { font-weight: 600; }
.more-link { text-align: center; margin-top: 1rem; }
.more-link a { color: var(--primary); font-size: 0.85rem; text-decoration: none; font-weight: 600; }

.owed-total {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.1rem;
}

table.all-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.all-table th, table.all-table td { padding: 0.5rem; text-align: left; border-bottom: 1px solid var(--border); }
