:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #64748b;
  --line: #d7dde5;
  --panel: #ffffff;
  --bg: #eef2f6;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --theme: #0f766e;
  --theme-soft: #e0f2f1;
}

body.theme-admin {
  --theme: #0f766e;
  --theme-soft: #e0f2f1;
}

body.theme-company {
  --theme: #1d4ed8;
  --theme-soft: #dbeafe;
}

body.theme-brand {
  --theme: #be185d;
  --theme-soft: #fce7f3;
}

body.theme-employee {
  --theme: #7c3aed;
  --theme-soft: #ede9fe;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(247, 249, 251, 0.94), rgba(238, 242, 246, 0.98)),
    radial-gradient(circle at 18% 10%, color-mix(in srgb, var(--theme) 12%, transparent), transparent 30%),
    repeating-linear-gradient(135deg, rgba(15, 118, 110, 0.045) 0 1px, transparent 1px 18px);
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(23, 32, 42, 0.08);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--theme), #14b8a6, #60a5fa);
}

.brand-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  color: var(--theme);
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
}

.login-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.login-hero h1 {
  margin-bottom: 4px;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.stack {
  display: grid;
  gap: 16px;
  max-width: 460px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}

button {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

a {
  color: var(--accent-dark);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.tile {
  min-height: 84px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  background: #f8fafc;
  transition: transform .15s ease, box-shadow .15s ease;
}

.tile-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--theme-soft);
  color: var(--theme);
  font-size: 13px;
  font-weight: 800;
}

.tile-icon img {
  width: 23px;
  height: 23px;
  display: block;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  font-weight: 700;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}

.stat-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, #fff, var(--theme-soft));
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.stat-box strong {
  font-size: 32px;
  color: var(--theme);
}

.portal-logo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}

.portal-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.form-row,
.form-grid {
  display: grid;
  gap: 12px;
  margin: 18px 0 24px;
}

.form-row {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.id-card {
  width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 18px;
  background: #fff;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 18px 0 24px;
}

.action-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.action-panel h2 {
  margin: 0;
}

.locked-time {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--theme-soft);
  color: #334155;
}

.employee-profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.employee-profile-card strong,
.employee-profile-card span {
  display: block;
}

.employee-profile-card strong {
  font-size: 20px;
  color: var(--text);
}

.profile-photo {
  width: 96px;
  flex: 0 0 auto;
}

.card-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.pvc-card {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1.58;
  border-radius: 14px;
  padding: 18px;
  color: #17202a;
  border: 1px solid #c7d2de;
  box-shadow: 0 14px 32px rgba(23, 32, 42, .14);
  overflow: hidden;
}

.pvc-front {
  background: linear-gradient(135deg, #ffffff 0%, var(--theme-soft) 58%, #dbeafe 100%);
}

.pvc-back {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.card-head strong,
.card-head span {
  display: block;
}

.card-head strong {
  color: var(--theme);
  font-size: 18px;
}

.card-head {
  display: flex;
  gap: 10px;
  align-items: center;
}

.card-logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--theme);
  font-weight: 800;
  overflow: hidden;
}

.card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.card-logo-missing {
  padding: 4px;
  color: #b91c1c;
  font-size: 9px;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
}

.card-head span {
  color: var(--muted);
  margin-top: 3px;
}

.card-body {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  margin-top: 18px;
}

.card-body h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.card-body p {
  margin: 5px 0;
}

.photo-box {
  width: 112px;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  color: var(--muted);
  font-weight: 700;
}

.photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-box {
  display: grid;
  align-content: start;
  gap: 8px;
}

.qr-pattern {
  width: 120px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 8px solid #111827;
  background:
    repeating-linear-gradient(90deg, #111827 0 6px, #fff 6px 12px),
    repeating-linear-gradient(0deg, rgba(17, 24, 39, .55) 0 6px, transparent 6px 12px);
  color: #fff;
  font-size: 10px;
  text-align: center;
  word-break: break-all;
}

.id-card strong,
.id-card span {
  display: block;
}

.id-card span {
  color: var(--muted);
  margin-top: 4px;
}

.policy-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin: 16px 0;
  background: #fff;
}

.policy-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.check-group {
  display: grid;
  gap: 8px;
  align-self: stretch;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.check input {
  width: auto;
  min-height: 0;
}

.inline-form {
  display: inline-block;
  margin: 6px 0 0 8px;
}

.inline-form button {
  min-height: 34px;
  padding: 6px 10px;
}

.scanner {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.scanner video {
  width: min(100%, 520px);
  border-radius: 8px;
  background: #111827;
}

.salary-summary {
  display: grid;
  gap: 6px;
  max-width: 420px;
  margin: 18px 0;
  padding: 18px;
  border-radius: 8px;
  background: var(--theme-soft);
  border: 1px solid var(--line);
}

.salary-summary span {
  color: var(--muted);
  font-weight: 700;
}

.salary-summary strong {
  font-size: 36px;
  color: var(--theme);
}

.top-action {
  font-size: 14px;
  color: var(--theme);
  text-decoration: none;
  font-weight: 700;
}

.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 6px;
  background: #dc2626;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  border: 1px solid #b91c1c;
}

.logout-button:hover {
  background: #b91c1c;
}

.details {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 16px;
  max-width: 720px;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1040px);
    padding: 20px 0;
  }

  .panel {
    padding: 20px;
  }

  .details {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .shell,
  .panel {
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  button,
  a,
  .brand-line {
    display: none;
  }
}
