:root {
  --bg: #eef2f6;
  --bg-accent: #e3ebf3;
  --surface: #ffffff;
  --ink: #1f2a37;
  --muted: #5b6b7c;
  --line: #d5dee8;
  --brand: #0f4c5c;
  --brand-deep: #0a3540;
  --brand-soft: #d7e8ec;
  --accent: #c36f09;
  --accent-soft: #f8e8d4;
  --danger: #9b2c2c;
  --danger-soft: #f8e0e0;
  --ok: #1f6f4a;
  --ok-soft: #d9f0e4;
  --warn: #8a5a00;
  --warn-soft: #fff0cc;
  --shadow: 0 10px 30px rgba(15, 40, 60, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9ecef 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #f3e4cb 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--brand), var(--brand-deep));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}
a.brand-mark:hover {
  color: #fff;
  text-decoration: none;
  filter: brightness(1.08);
}
.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
  margin-right: 12px;
}
.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.nav a:hover { background: rgba(15, 76, 92, 0.08); color: var(--brand-deep); text-decoration: none; }
.nav a.active { background: var(--brand); color: #fff; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
}
.user-chip strong { display: block; font-size: 0.92rem; }
.user-chip span { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 1.55rem; font-weight: 700; margin-top: 4px; color: var(--brand-deep); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}
.toolbar .grow { flex: 1 1 220px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 35%, white);
  border-color: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-secondary { background: var(--brand-soft); color: var(--brand-deep); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
table.data tr:hover td { background: #f7fafc; }
.staff-cell { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #d9e2ec;
  border: 1px solid var(--line);
}
.avatar.lg { width: 110px; height: 110px; border-radius: 18px; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-active { background: var(--ok-soft); color: var(--ok); }
.badge-resigned { background: #edf2f7; color: #4a5568; }
.badge-terminated { background: var(--danger-soft); color: var(--danger); }
.badge-leave { background: var(--warn-soft); color: var(--warn); }
.badge-neutral { background: #edf2f7; color: #4a5568; }

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 600;
}
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--brand-soft); color: var(--brand-deep); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.section-title {
  grid-column: 1 / -1;
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--brand-deep);
  font-size: 0.95rem;
}
.section-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-grid .section-title { margin: 8px 0 0; padding-top: 8px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.meta { color: var(--muted); font-size: 0.85rem; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.login-card h1 { margin: 0 0 6px; font-size: 1.6rem; color: var(--brand-deep); }
.login-card .sub { color: var(--muted); margin: 0 0 22px; }
.login-card .field { margin-bottom: 14px; }
.login-hub {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.login-hub .btn { text-decoration: none; }
.hint {
  margin-top: 18px;
  padding: 12px;
  border-radius: 10px;
  background: #f7fafc;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
.hint code {
  background: #eef2f6;
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--brand-deep);
}

.profile-head {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}
.profile-head h2 { margin: 0 0 6px; font-size: 1.45rem; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.detail {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.detail .k { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.detail .v { font-weight: 600; word-break: break-word; }
.detail.full { grid-column: 1 / -1; }
.payroll-lock {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, white);
}

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .nav { margin: 0; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .profile-head { flex-direction: column; align-items: flex-start; }
}
