:root {
  --bg: #ffffff;
  --bg-alt: #faf8f3;
  --surface: #ffffff;
  --surface-hover: #faf6ea;
  --border: #e7e1d0;
  --text: #201c14;
  --text-muted: #756c5c;
  --accent: #a67c1e;
  --accent-strong: #7d5c14;
  --accent-soft: #f3e6bf;
  --success: #2f7d4f;
  --error: #b3261e;
  --warning: #a66a00;
  --font-head: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Sora", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: none;
  padding: 0 32px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.01em; }

/* Header */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.brand:hover { color: var(--text); }

.brand-logo {
  height: 36px;
  width: auto;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.brand-text span { color: var(--accent); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  white-space: nowrap;
}

.main-nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}

.main-nav a:hover { color: var(--text); }

.main-nav a.active { color: var(--text); }

.main-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-cta {
  background: var(--accent);
  color: #ffffff !important;
  padding: 9px 18px;
  border-radius: 6px;
  font-weight: 600;
}

.nav-cta:hover { background: var(--accent-strong); color: #fff !important; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 22px;
  border-left: 1px solid var(--border);
}

.user-chip {
  color: var(--text-muted);
  font-size: 0.82rem;
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav .nav-logout {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.main-nav .nav-logout:hover { color: var(--accent); }

@media (max-width: 1200px) {
  .main-nav { gap: 18px; }
  .nav-user { gap: 10px; padding-left: 16px; }
  .user-chip { max-width: 130px; }
}

/* Hamburger, shown only on narrow screens */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 960px) {
  .nav-wrap { position: relative; padding: 12px 16px; }
  .nav-toggle { display: flex; }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(32, 28, 20, 0.08);
  }

  .nav-open .main-nav { display: flex; }

  .main-nav a { padding: 12px 4px; border-bottom: 1px solid var(--border); }
  .main-nav a.active::after { display: none; }
  .main-nav a.active { color: var(--accent-strong); font-weight: 600; }
  .main-nav .nav-cta { margin-top: 12px; text-align: center; border-bottom: none; padding: 11px 18px; }

  .nav-user {
    justify-content: space-between;
    margin-top: 12px;
    padding-left: 0;
    border-left: none;
  }
  .nav-user a { border-bottom: none; }
  .user-chip { max-width: 70%; }
}

@media (max-width: 480px) {
  .brand { font-size: 1.1rem; gap: 10px; }
  .brand-logo { height: 28px; }
}

/* Hero */
.hero {
  padding: 100px 0 72px;
  text-align: center;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 2.75rem;
  margin: 0 0 16px;
  color: var(--text);
}

.tagline {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 620px;
  margin: 0 auto 32px;
}

.btn {
  display: inline-block;
  padding: 13px 30px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-strong); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid currentColor;
  margin-left: 8px;
}

.btn-outline:hover { color: var(--accent); }

/* Team / Contact sections */
.team, .contact {
  padding: 64px 0;
}

.team h2, .contact h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 8px;
}

.section-sub {
  text-align: center;
  color: var(--text-muted);
  margin: 0 0 40px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: 0 6px 20px rgba(32, 28, 20, 0.08);
  transform: translateY(-3px);
}

.team-card { text-align: center; }

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  color: #fff;
  background: var(--accent);
}

.card h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.card .role {
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 10px;
}

.card p {
  color: var(--text-muted);
  margin: 0;
}

.contact-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  margin: 6px 0 0;
}

.contact-line a {
  color: inherit;
}

.contact-line .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent-strong);
}

/* Contact form */
.contact > .container > p {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.query-form {
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
}

.form-row {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-row input,
.form-row textarea,
.form-row select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23a67c1e' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 11px;
  transition: border-color 0.15s ease;
}

.form-row select:hover {
  border-color: var(--accent);
}

.query-form .btn { width: 100%; }

/* Flash messages */
.flash-container { padding-top: 20px; }

.flash {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-weight: 500;
}

.flash-success { background: rgba(47, 125, 79, 0.08); color: var(--success); border: 1px solid var(--success); }
.flash-error { background: rgba(179, 38, 30, 0.08); color: var(--error); border: 1px solid var(--error); }
.flash-warning { background: rgba(166, 106, 0, 0.08); color: var(--warning); border: 1px solid var(--warning); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Login gate page */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-alt);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 40px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 30px rgba(32, 28, 20, 0.06);
}

.login-logo {
  height: 44px;
  width: auto;
  margin: 0 auto 24px;
  display: block;
}

.login-card h1 {
  font-size: 1.5rem;
  margin: 0 0 8px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 28px;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #ffffff;
  color: #1f1f1f !important;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: var(--font-body);
}

.google-btn:hover { background: #f7f5ef; }

.login-footnote {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Long-form pages (onboarding, admin) */
.form-page {
  padding: 56px 0 80px;
}

.form-page h1 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 8px;
}

.form-card {
  max-width: 920px;
  margin: 40px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
}

.form-section-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  color: var(--accent-strong);
  margin: 36px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.form-section-title:first-child { margin-top: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 22px;
}

.form-grid textarea { grid-column: 1 / -1; }

.photo-upload {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}

.photo-preview {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-align: center;
  flex-shrink: 0;
}

.file-input {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.repeat-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.repeat-table th, .repeat-table td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}

.repeat-table th { color: var(--text-muted); font-weight: 600; background: var(--bg-alt); }

.repeat-table input, .repeat-table textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 2px;
}

.repeat-table input:focus, .repeat-table textarea:focus { outline: 1px solid var(--accent); }

.btn-add-row {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--accent-strong);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-body);
}

.btn-add-row:hover { border-color: var(--accent); background: var(--accent-soft); }

.lang-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.lang-table th, .lang-table td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: center;
  font-size: 0.85rem;
}
.lang-table th { color: var(--text-muted); font-weight: 600; background: var(--bg-alt); }
.lang-table td:first-child, .lang-table th:first-child { text-align: left; color: var(--text-muted); }
.lang-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.lang-table input[type="text"] {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font-family: var(--font-body);
}

.declaration-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 28px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.declaration-box input { margin-top: 4px; accent-color: var(--accent); }

/* Admin tables */
.admin-table-wrap {
  margin: 40px 0 0;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.admin-table th, .admin-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  overflow-wrap: break-word;
}

.admin-table th { color: var(--text-muted); font-weight: 600; background: var(--bg-alt); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface-hover); }

.thumb {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: cover;
  vertical-align: middle;
}

.detail-photo {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 24px;
  margin-top: 8px;
}

.detail-field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-field .value {
  color: var(--text);
  white-space: pre-wrap;
}

.back-link { display: inline-block; margin-bottom: 20px; color: var(--text-muted); }

.btn-delete {
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}

.btn-word {
  display: inline-block;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-word:hover { border-color: var(--accent); color: var(--accent-strong); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Admin table's action buttons are smaller than the general .btn-word/.btn-delete used
   elsewhere (e.g. the detail page) — this list has to fit four of them per row without
   forcing the whole page into a horizontal scroll. */
.admin-table .btn-word,
.admin-table .btn-delete {
  padding: 4px 8px;
  font-size: 0.72rem;
  white-space: nowrap;
}

/* The color lives on this wrapper, not the native <select> itself — Windows/Chrome
   is unreliable about honoring background-color on <select>, so the select inside
   is made fully transparent and just inherits the badge's color. */
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  forced-color-adjust: none;
}

.status-badge.status-accepted { background: var(--success); border-color: var(--success); }
.status-badge.status-rejected { background: var(--error); border-color: var(--error); }
.status-badge.status-hold { background: var(--warning); border-color: var(--warning); }
.status-badge.status-in-progress { background: var(--accent); border-color: var(--accent-strong); }

.status-select {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='currentColor' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 9px;
  padding-right: 22px;
}

.status-badge.status-accepted .status-select,
.status-badge.status-rejected .status-select,
.status-badge.status-hold .status-select,
.status-badge.status-in-progress .status-select {
  color: #fff;
}

/* The dropdown popup list is a native OS control and ignores the select's own
   background/color — without this, options inherit the white select text and
   become invisible on the popup's default white background. */
.status-select option {
  background: #fff;
  color: var(--text);
  font-weight: 600;
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.status-filter-btn[href] { text-decoration: none; display: inline-block; }

.status-filter-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
}

.status-filter-btn:hover { border-color: var(--accent); }

.status-filter-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 0;
}

.bulk-toolbar button:disabled { opacity: 0.5; cursor: not-allowed; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 24px 0 0;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.pagination a:hover { border-color: var(--accent); color: var(--accent-strong); }

.pagination .current {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.pagination .disabled {
  color: var(--text-muted);
  opacity: 0.5;
  pointer-events: none;
}

.btn-delete:hover { background: var(--error); color: #fff; }

.detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 32px; }
.detail-actions-top { margin: 0 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }

@media (max-width: 640px) {
  .hero h1 { font-size: 2.2rem; }
}

/* Admin section tabs (Applications / KRA Forms) */
.admin-tabs { margin-bottom: 24px; }

.btn-copy { background: transparent; cursor: pointer; font-family: var(--font-body); }
.kra-table td:first-child { width: 36px; color: var(--text-muted); }
.kra-alias { color: var(--text-muted); font-size: 0.72rem; }
