:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --gray-bg: #f3f4f6;
  --border: #e5e7eb;
  --text: #1f2937;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: #fafafa;
}

/* ---------- LOGIN ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #2563eb, #1e3a8a);
}

.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
  text-align: center;
}

.login-card .subtitle {
  margin: 0 0 20px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* previne zoom automat pe iOS */
  border: 1px solid var(--border);
  border-radius: 8px;
  -webkit-appearance: none;
}

.login-card input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.login-card button {
  width: 100%;
  margin-top: 22px;
  padding: 13px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.login-card button:active { background: var(--blue-dark); }

.alert {
  background: #fee2e2;
  color: #b91c1c;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 6px;
}

/* ---------- APP ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--blue);
  color: #fff;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-name {
  font-size: 12px;
  font-weight: 400;
  opacity: .9;
}

.btn-logout {
  color: #fff;
  background: rgba(255,255,255,.18);
  padding: 9px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-logout:active { background: rgba(255,255,255,.3); }

.content {
  padding: 14px;
  max-width: 1100px;
  margin: 0 auto;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.controls label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.controls select {
  width: 100%;
  max-width: 320px;
  padding: 11px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.grid-status {
  font-size: 13px;
  color: #6b7280;
  min-height: 18px;
  margin-bottom: 8px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.grid-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  white-space: nowrap;
}

.grid-table th, .grid-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  padding: 0;
}

.grid-table thead th {
  background: var(--gray-bg);
  font-weight: 600;
  padding: 8px 4px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.grid-table th.col-name, .grid-table td.col-name {
  position: sticky;
  left: 0;
  background: #fff;
  text-align: left;
  padding: 10px 10px;
  z-index: 6;
  box-shadow: 2px 0 4px rgba(0,0,0,.04);
  min-width: 140px;
  max-width: 200px;
  white-space: normal;
}

.grid-table thead th.col-name { z-index: 10; background: var(--gray-bg); }

.grid-table td.col-day {
  width: 34px;
  min-width: 34px;
}

.day-cell {
  width: 100%;
  height: 40px;
  min-height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.day-cell.present {
  background: var(--green-bg);
  color: var(--green);
  font-weight: 700;
}

.day-cell.weekend {
  background: #f9fafb;
}

.col-total {
  font-weight: 700;
  background: #f3f4f6;
  min-width: 46px;
}

@media (max-width: 480px) {
  .topbar-title { font-size: 16px; }
  .grid-table { font-size: 12px; }
  .day-cell { height: 36px; }
  .grid-table th.col-name, .grid-table td.col-name { min-width: 110px; padding: 8px; }
}
