:root {
  --navy: #0b3f6f;
  --navy-dark: #082f54;
  --navy-soft: #eef5fb;
  --gold: #e8b64a;
  --red: #d6292f;
  --text: #1f2937;
  --muted: #667085;
  --line: #d7dee7;
  --surface: #ffffff;
  --background: #f5f7fa;
  --success: #1f7a4d;
  --danger: #b42318;
  --shadow: 0 12px 32px rgba(11, 63, 111, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 182, 74, 0.10), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, var(--background) 100%);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 22px 18px 42px;
}

.staff-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 22px 18px 42px;
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.brandbar .brand-left,
.brandbar .brand-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand-logo.jagatara { width: 58px; height: 58px; }

.brand-copy strong {
  display: block;
  color: var(--navy);
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

.brand-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(11, 63, 111, 0.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.hero-card {
  text-align: center;
  padding: 34px 26px 30px;
}

.hero-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.hero-logos img:first-child { width: 84px; height: 84px; object-fit: contain; }
.hero-logos img:last-child { width: 78px; height: 78px; object-fit: contain; }

.app-title {
  color: var(--navy);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 3rem);
  margin: 0;
  letter-spacing: 0.02em;
}

.app-subtitle {
  margin: 8px auto 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 560px;
}

.office-name {
  margin-top: 8px;
  color: var(--navy-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

.section-title {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 1.45rem;
}

.section-lead {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.55;
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.language-btn {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 14px;
  transition: 0.18s ease;
}

.language-btn:hover,
.language-btn:focus-visible {
  border-color: var(--navy);
  color: var(--navy);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(11, 63, 111, 0.09);
  outline: none;
}

.language-btn.full { grid-column: 1 / -1; }

.progress-wrap { margin-bottom: 18px; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 8px;
}
.progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: #e8edf3;
  border-radius: 999px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), #2c6fa8);
  border-radius: inherit;
}
.progress-50 { width: 50%; }
.progress-100 { width: 100%; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }

label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #344054;
}

.required-mark { color: var(--red); }
.optional { color: var(--muted); font-weight: 500; font-size: 0.82rem; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
  min-height: 46px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

textarea { min-height: 104px; resize: vertical; line-height: 1.45; }

input:focus, select:focus, textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(11, 63, 111, 0.10);
}

input.invalid, select.invalid, textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.08);
}

.field-error {
  min-height: 17px;
  color: var(--danger);
  font-size: 0.78rem;
}

.subsection {
  padding: 20px;
  border: 1px solid #e1e7ee;
  border-radius: 15px;
  background: #fbfcfe;
  margin-bottom: 16px;
}

.subsection:last-child { margin-bottom: 0; }
.subsection h3 {
  margin: 0 0 16px;
  color: var(--navy);
  font-size: 1.08rem;
}

.confirm-box {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border: 1px solid #dfe6ee;
  border-radius: 12px;
  background: #fff;
}

.confirm-box input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 2px 0 0;
  flex: 0 0 auto;
}

.confirm-box label { font-weight: 500; line-height: 1.5; }

.actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
}

.btn {
  min-height: 48px;
  border-radius: 12px;
  border: 0;
  padding: 11px 20px;
  font-weight: 800;
  transition: 0.16s ease;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 63, 111, 0.18);
}
.btn-primary:hover { background: var(--navy-dark); transform: translateY(-1px); }
.btn-secondary { background: #eef3f7; color: var(--navy); }
.btn-secondary:hover { background: #e5edf4; }
.btn-danger { background: #fff0ef; color: var(--danger); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid #cfd9e4; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.notice {
  border-left: 4px solid var(--gold);
  background: #fff8e8;
  color: #5d4a1b;
  padding: 12px 14px;
  border-radius: 10px;
  line-height: 1.48;
  font-size: 0.9rem;
  margin: 18px 0 0;
}

.alert {
  display: none;
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 11px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.alert.show { display: block; }
.alert.error { background: #fff0ef; color: var(--danger); border: 1px solid #ffd2ce; }
.alert.success { background: #ecf8f1; color: var(--success); border: 1px solid #c8ecd8; }

.review-section {
  border-top: 1px solid #e4e9ef;
  padding: 18px 0;
}
.review-section:first-of-type { border-top: 0; padding-top: 0; }
.review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.review-heading h3 { margin: 0; color: var(--navy); font-size: 1.05rem; }
.review-list {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.5fr);
  gap: 8px 14px;
}
.review-key { color: var(--muted); font-size: 0.88rem; }
.review-value { font-weight: 650; word-break: break-word; }

.success-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin: 0 auto 18px;
  background: #e9f7ef;
  color: var(--success);
  font-size: 2.4rem;
  font-weight: 900;
}
.reference-box {
  margin: 20px auto 0;
  padding: 14px 18px;
  background: var(--navy-soft);
  border: 1px dashed #9ab9d4;
  border-radius: 12px;
  max-width: 380px;
}
.reference-box span { display: block; color: var(--muted); font-size: 0.8rem; }
.reference-box strong { display: block; margin-top: 4px; color: var(--navy); font-size: 1.2rem; letter-spacing: 0.04em; }

.footer {
  text-align: center;
  color: #7c8794;
  font-size: 0.78rem;
  margin-top: 20px;
  line-height: 1.5;
}

/* Staff */
.staff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.staff-header h1 { margin: 0; color: var(--navy); font-size: 1.55rem; }
.staff-header p { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; }
.staff-header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.login-card { max-width: 460px; margin: 6vh auto 0; }
.login-card .hero-logos { margin-bottom: 12px; }
.login-card h1 { text-align: center; color: var(--navy); margin: 0 0 4px; }
.login-card .section-lead { text-align: center; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.searchbox { flex: 1; max-width: 520px; position: relative; }
.searchbox input { padding-right: 94px; }
.searchbox button {
  position: absolute;
  right: 5px;
  top: 5px;
  bottom: 5px;
  border: 0;
  border-radius: 9px;
  background: var(--navy);
  color: #fff;
  padding: 0 15px;
  font-weight: 700;
}

.table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid #e7ebf0; vertical-align: middle; }
th { background: #f3f7fb; color: var(--navy-dark); font-size: 0.82rem; letter-spacing: 0.02em; }
td { font-size: 0.9rem; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfdff; }
.table-link { color: var(--navy); font-weight: 800; text-decoration: none; }
.table-link:hover { text-decoration: underline; }
.empty-state { padding: 36px 20px; text-align: center; color: var(--muted); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.pagination span { color: var(--muted); font-size: 0.85rem; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.detail-section {
  border: 1px solid #e1e7ee;
  border-radius: 14px;
  padding: 18px;
}
.detail-section.full { grid-column: 1 / -1; }
.detail-section h3 { margin: 0 0 13px; color: var(--navy); font-size: 1.02rem; }
.detail-item { margin-bottom: 10px; }
.detail-item:last-child { margin-bottom: 0; }
.detail-label { color: var(--muted); font-size: 0.78rem; }
.detail-value { margin-top: 2px; font-weight: 700; line-height: 1.4; word-break: break-word; }

.qr-card { max-width: 520px; margin: 0 auto; text-align: center; }
.qr-image { width: min(100%, 340px); height: auto; border: 1px solid #e1e7ee; border-radius: 16px; padding: 10px; background: #fff; }
.qr-url { margin-top: 12px; color: var(--muted); word-break: break-all; font-size: 0.85rem; }

[dir="rtl"] .actions { flex-direction: row-reverse; }
[dir="rtl"] .review-list { direction: rtl; }
[dir="rtl"] .confirm-box { flex-direction: row-reverse; }

@media (max-width: 660px) {
  .app-shell, .staff-shell { padding: 14px 12px 28px; }
  .brandbar { margin-bottom: 13px; }
  .brand-logo { width: 42px; height: 42px; }
  .brand-logo.jagatara { width: 46px; height: 46px; }
  .brand-copy span { display: none; }
  .card { padding: 20px 16px; border-radius: 16px; }
  .hero-card { padding: 27px 17px 24px; }
  .hero-logos img:first-child { width: 70px; height: 70px; }
  .hero-logos img:last-child { width: 64px; height: 64px; }
  .language-grid { grid-template-columns: 1fr; }
  .language-btn.full { grid-column: auto; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .field.full, .detail-section.full { grid-column: auto; }
  .actions { gap: 8px; }
  .actions .btn { flex: 1; padding-left: 12px; padding-right: 12px; }
  .review-list { grid-template-columns: 1fr; gap: 2px; }
  .review-value { margin-bottom: 9px; }
  .staff-header { align-items: flex-start; flex-direction: column; }
  .staff-header-actions { width: 100%; justify-content: flex-start; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .searchbox { max-width: none; }
}

@media print {
  body { background: #fff; }
  .no-print, .brandbar, .footer, .staff-header-actions { display: none !important; }
  .staff-shell { width: 100%; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .detail-section { break-inside: avoid; }
}

.actions.center { justify-content: center; }
.staff-brand { display: flex; align-items: center; gap: 12px; }
.compact-title { font-size: 1.25rem !important; }
.compact-lead { margin: 3px 0 0 !important; }
.mt-14 { margin-top: 14px; }
.login-submit { width: 100%; margin-top: 18px; }
