/* FX Utilities — HR System
   Visual language deliberately matches the FX Utilities Annual Leave system
   (same design tokens, card, button, and banner treatment) so the two apps
   feel like one product suite to anyone switching between them. */

:root {
  --font: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
}

/* Why something would not save, kept on screen next to the form. Every
   other module in the portal has had this rule; HR never did, so an error
   line here rendered as ordinary grey text. */
.error-text { color: var(--red); font-size: 0.92em; }

h1, h2, h3, h4 {
  color: var(--navy);
  margin: 0 0 12px 0;
}
h1 { font-size: 1.1em; }
h2 { font-size: 1.3em; }
h3, h4 { font-size: 1.05em; }

a { color: var(--navy); }

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.login-card .logo-row {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-card h2 {
  margin-bottom: 2px;
}

.login-card .company-address {
  color: var(--grey);
  font-size: 0.85em;
  margin-bottom: 18px;
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-card p {
  color: var(--grey);
  font-size: 0.9em;
  margin: 0 0 20px 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}
.btn-block { width: 100%; }
.btn-primary { background: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--grey-light); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #8f1e18; }
.btn-sm { padding: 6px 12px; font-size: 0.85em; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- App shell ---------- */
.app-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
}
.app-banner .banner-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-banner .banner-company { font-weight: 700; color: var(--navy); font-size: 0.95em; }
.app-banner .banner-app { color: var(--grey); font-size: 0.8em; }
.app-banner .spacer { flex: 1; }
.app-banner .banner-user { color: var(--grey); font-size: 0.85em; margin-right: 6px; }

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--navy);
  padding: 0 20px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  padding: 12px 16px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-family: var(--font);
}
.tab-btn:hover { color: #fff; }
.tab-btn.active { color: #fff; border-bottom-color: #fff; }
.tab-btn[hidden] { display: none; }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.panel { display: none; }
.panel.active { display: block; }

.card-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 22px;
}

/* ---------- Forms ---------- */
label { display: block; font-size: 0.85em; font-weight: 600; margin: 12px 0 4px; color: #333; }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=tel],
select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.92em;
  font-family: var(--font);
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
.field-hint { color: var(--grey); font-size: 0.78em; margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { background: var(--grey-light); color: #333; font-weight: 600; }
tr:hover td { background: #fafbfc; }
.table-wrap { overflow-x: auto; }

/* ---------- Search ---------- */
.search-row { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.search-row input[type=search] { flex: 1; max-width: 420px; }
.result-count { color: var(--grey); font-size: 0.85em; }

/* ---------- Badges / banners ---------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 700;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-grey { background: var(--grey-light); color: var(--grey); }

.banner-msg { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 0.9em; }
.banner-info { background: var(--blue-light); color: var(--navy); }
.banner-warning { background: var(--amber-bg); color: var(--amber); }
.banner-danger { background: var(--red-bg); color: var(--red); }

/* ---------- Profile view ---------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--blue-light); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.2em;
  overflow: hidden; flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--navy);
  font-weight: 700;
  font-size: 0.7em;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-thumb img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 1.2em; font-weight: 700; color: var(--navy); }
.profile-sub { color: var(--grey); font-size: 0.88em; }

.profile-header .spacer { flex: 1; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--navy);
  font-weight: 600;
  font-size: inherit;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
}
.link-button:hover { text-decoration: underline; }

.upload-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.upload-row input[type=file] { flex: 1; min-width: 220px; }

.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 30px; }
.detail-item dt { font-size: 0.78em; color: var(--grey); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
.detail-item dd { margin: 0; font-size: 0.95em; }
.detail-item { margin-bottom: 10px; }
.sensitive-lock {
  color: var(--grey);
  font-style: italic;
  font-size: 0.85em;
}

/* ---------- Toasts / loading ---------- */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,0.2); font-size: 0.9em; }
.toast-error { background: var(--red); }
.toast-success { background: var(--green); }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  vertical-align: -3px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--navy); color: #fff; font-size: 0.95em;
}
.loading-screen .spinner { border-color: rgba(255,255,255,0.3); border-top-color: #fff; width: 22px; height: 22px; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  main { padding: 14px; }
  .app-banner { padding: 10px 14px; }
  .app-nav { padding: 0 8px; overflow-x: auto; }
}

/* A tick that belongs to the field above it rather than standing alone. */
.inline-tick {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-weight: normal;
}
.inline-tick input {
  flex: 0 0 auto;
  margin: 0;
}
