/* ===== Global base (light theme) ===== */
:root {
  --bg: #eef2f7;
  --bg-soft: #f3f4f6;
  --card: #ffffff;
  --border-subtle: #d1d5db;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --accent-strong: #1d4ed8;
  --text-main: #111827;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow-soft: 0 16px 40px rgba(15, 23, 42, 0.10);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #f9fafb, #e5e7eb 55%, #e5e7eb 100%);
  color: var(--text-main);
  padding: 12px;
}

/* ===== Generic containers ===== */
.card {
  width: 110%;
  max-width: 1100px;
  margin: 0 auto 16px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-soft);
}

h1, h2, h3 {
  margin: 0 0 10px 0;
  font-weight: 600;
}

h2 { font-size: 18px; }
h3 { font-size: 16px; }

p {
  margin: 0 0 8px 0;
}

.muted,
.small,
.muted-text {
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== Forms & inputs ===== */
label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  max-width: 260px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f9fafb;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
  background: #ffffff;
}

/* --- REMOVE number input arrows (spinners) --- */
/* Chrome, Edge, Safari */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type="number"] {
  -moz-appearance: textfield;
}
/* --- end spinner fix --- */

input.cell,
.small {
  max-width: 70px;
  text-align: right;
}

/* ===== Buttons ===== */
.btn,
button,
input[type="submit"],
input[type="button"] {
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  border-color: #1d4ed8;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: #1d4ed8;
}

.btn.primary:hover {
  filter: brightness(1.03);
}

.btn.danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: #b91c1c;
  color: #fee2e2;
}

/* ===== Messages / flash ===== */
.msg {
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
}

.msg.success {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.msg.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* ===== Layout helpers ===== */
.row,
.form-row,
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 8px;
}

.controls {
  margin-bottom: 10px;
  font-size: 13px;
}

.userbox {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
}

/* Nav links used on half-month pages */
.navlinks {
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.navlinks a {
  text-decoration: none;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text-muted);
  background: #e5edff;
}

.navlinks a:hover {
  color: var(--accent-strong);
  border-color: rgba(37, 99, 235, 0.4);
}

.navlinks a.active {
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.85);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

/* ===== Tables (grid, 1–15, 16–end, tracker, report, employees) ===== */
table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th, td {
  border: 1px solid #e5e7eb;
  padding: 6px 7px;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
  color: var(--text-main);
}

th {
  background: #f3f4f6;
  color: #111827;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}

tbody tr:nth-child(odd) {
  background: #ffffff;
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

tbody tr:hover {
  background: #dbeafe;
}

.tot,
.month-total {
  font-weight: 600;
  background: #ecfdf3;
  color: #166534;
}

/* Summary box (used on index.php etc.) */
.summary {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

/* Footer note */
.footer-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Login / auth pages ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 18px;
  padding: 20px 20px 22px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
}

.login-card h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 20px;
}

.login-card .hint,
.login-card .muted,
.login-card .small {
  color: var(--text-muted);
  font-size: 12px;
}

.inline-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
}

/* ===== 404 / small pages ===== */
.centered {
  text-align: center;
}

/* ===== Mobile responsiveness ===== */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .card {
    padding: 12px 12px 14px;
    border-radius: 14px;
  }

  .row,
  .form-row,
  .controls {
    flex-direction: column;
    align-items: flex-start;
  }

  th, td {
    font-size: 11px;
    padding: 5px 6px;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 10px;
  }

  .login-card {
    padding: 18px 16px 20px;
  }

  .navlinks a {
    font-size: 12px;
    padding: 3px 8px;
  }
}
