:root {
  --brand: #1a5fc4;
  --brand-dark: #124a99;
  --green: #4caf50;
  --green-dark: #3d9140;
  --bg: #f4f6f9;
  --border: #e0e4ea;
  --text: #2a2f3a;
  --muted: #6b7280;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}
.login-card {
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  width: 340px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-logo {
  height: 40px; width: auto; border-radius: 4px; object-fit: contain;
}
.login-title { font-weight: 700; font-size: 16px; }
.login-sub { font-size: 12px; color: var(--muted); }
.login-card label { display: block; font-size: 12px; font-weight: 600; margin: 12px 0 4px; }
.login-card input {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px;
}
.login-hint { margin-top: 16px; font-size: 11px; color: var(--muted); text-align: center; }
.error-text { color: #c0392b; font-size: 12px; margin-top: 8px; min-height: 14px; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 56px;
  gap: 24px;
}
.brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; }
.brand-mark { height: 32px; width: auto; border-radius: 4px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  background: transparent; border: none; color: rgba(255,255,255,0.85);
  padding: 10px 16px; font-size: 14px; cursor: pointer; border-radius: 6px 6px 0 0;
}
.tab.active { background: #fff; color: var(--brand); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 6px; padding: 9px 16px; font-size: 13px;
  cursor: pointer; font-weight: 600;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #e8edf5; color: var(--brand-dark); }
.btn-ghost { background: rgba(255,255,255,0.15); color: #fff; }
.btn-add { background: var(--green); color: #fff; margin: 12px 0; }
.btn-add:hover { background: var(--green-dark); }
.btn-block { width: 100%; margin-top: 16px; }
.btn-icon { background: #eef1f6; border-radius: 50%; width: 30px; height: 30px; padding: 0; }
.btn-approve { background: var(--green); color: #fff; padding: 5px 10px; font-size: 12px; }
.btn-reject { background: #e15353; color: #fff; padding: 5px 10px; font-size: 12px; margin-left: 6px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Content ---------- */
.content { padding: 20px; max-width: 1200px; margin: 0 auto; }
.panel-header {
  background: var(--brand); color: #fff; display: flex; align-items: center;
  gap: 14px; padding: 12px 16px; border-radius: 8px 8px 0 0;
}
.week-label { font-weight: 600; flex: 1; text-align: center; }
.badge { background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.badge.status-approved { background: #2e7d32; }
.badge.status-pending { background: #b8860b; }
.badge.status-draft { background: rgba(255,255,255,0.2); }
.badge.status-rejected { background: #c0392b; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-top: none; }
.ts-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ts-table th, .ts-table td { border: 1px solid var(--border); padding: 8px; text-align: center; }
.ts-table thead th { background: #eef2f8; font-weight: 600; }
.col-proj, .col-task { text-align: left; min-width: 160px; }
.ts-table input[type=number] { width: 56px; text-align: center; border: 1px solid var(--border); border-radius: 4px; padding: 4px; }
.ts-table input[type=number]:disabled { background: #f0f0f0; color: var(--text); opacity: 1; cursor: not-allowed; border-color: #d5d9e0; }
.ts-table select:disabled { background: #f0f0f0; color: var(--muted); cursor: not-allowed; }
.ts-table select { width: 100%; padding: 4px; font-size: 12px; }
.day-blocked { background: #f0f0f0; color: var(--muted); font-size: 11px; }
.totals-row { background: #f7f9fc; font-weight: 700; }
.del-btn { background: transparent; border: none; color: #c0392b; cursor: pointer; font-size: 16px; }

.actions-row { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }
.msg { font-size: 12px; margin-top: 8px; min-height: 16px; }
.msg.error { color: #c0392b; }
.msg.success { color: #2e7d32; }
.note { font-size: 11px; color: var(--muted); margin-top: 6px; }
.reject-note { background: #fdecea; color: #c0392b; padding: 8px 12px; border-radius: 6px; font-size: 12px; margin-top: 10px; }
.other-week-note { background: #eef2f8; color: var(--brand-dark); padding: 8px 12px; border-radius: 6px; font-size: 12px; margin-top: 10px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 18px; }
.card h3 { margin-top: 0; font-size: 15px; }
.card label { display: block; font-size: 12px; font-weight: 600; margin: 10px 0 4px; }
.card input, .card select, .card textarea {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.simple-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.simple-table th, .simple-table td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: left; }
.status-pill { padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-pill.pending { background: #fff3cd; color: #8a6500; }
.status-pill.approved { background: #d4edda; color: #2e7d32; }
.status-pill.rejected { background: #fdecea; color: #c0392b; }
.status-pill.cancelled { background: #eee; color: var(--muted); }
.status-pill.draft { background: #e8edf5; color: var(--brand-dark); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-card {
  background: #fff; padding: 24px; border-radius: 10px; width: 340px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal-card h3 { margin-top: 0; }
.modal-card label { display: block; font-size: 12px; font-weight: 600; margin: 12px 0 4px; }
.modal-card input {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
