:root {
  /* Smart IT Services brand palette, pulled from smartit.ltd */
  --brand: #819525;
  --brand-dark: #66761d;
  --accent: #a5be2f;
  --bg: #f4f7ff;
  --card-bg: #ffffff;
  --text: #1d1d1d;
  --muted: #5b6b7c;
  --border: #dde3ea;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --success: #1e7e34;
  --success-bg: #e9f7ef;
  --warn: #a5690b;
  --warn-bg: #fff4e0;
  --font-heading: 'Manrope', -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Noto Sans', -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

h1, h2, h3, .brand h1, .card h2 { font-family: var(--font-heading); }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.brand {
  text-align: center;
  padding: 24px 0 8px;
}
.brand img.logo { height: 56px; margin-bottom: 12px; }
.brand h1 { margin: 0; font-size: 1.5rem; font-weight: 800; color: var(--brand-dark); }
.brand p { margin: 4px 0 0; color: var(--muted); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { margin-top: 0; font-size: 1.05rem; color: var(--brand-dark); }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field input[type="file"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field textarea { font-family: inherit; resize: vertical; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 10px; }

.radio-row { display: flex; gap: 24px; flex-wrap: wrap; }

.checkbox-col { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.checkbox-col label { font-weight: 500; display: flex; align-items: flex-start; gap: 8px; }
.checkbox-col input[type="checkbox"] { margin-top: 3px; }
.radio-row label { font-weight: 500; display: flex; align-items: center; gap: 6px; }

.doc-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.doc-block .doc-title { font-weight: 600; margin-bottom: 8px; }
.doc-block .expiry-field { margin-top: 10px; }

.field-error, .doc-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 6px;
  display: none;
}
.field-error.show, .doc-error.show { display: block; }

input.invalid, .doc-block.invalid { border-color: var(--danger) !important; }

.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #1d1d1d;
  border: none;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.submit-btn:hover { background: var(--brand); color: #fff; }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.reject-btn { background: var(--danger); color: #fff; }
.reject-btn:hover { background: #8f291e; }
.approve-btn { background: var(--success); color: #fff; }
.approve-btn:hover { background: var(--brand-dark); }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.alert.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }

.success-panel { text-align: center; }
.success-panel h2 { color: var(--success); }

.link-btn { background: none; border: none; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.link-danger { color: var(--danger); }
.link-danger:hover { color: #8f291e; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-valid { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-expired { background: var(--danger-bg); color: var(--danger); }

.agreement-text {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 16px;
  background: #fafbfd;
  font-size: 0.88rem;
  line-height: 1.5;
}
.agreement-text h3 { font-size: 0.95rem; color: var(--brand-dark); margin: 16px 0 6px; }
.agreement-text ul { padding-left: 20px; margin: 6px 0; }
.ack-title { font-size: 0.95rem; color: var(--brand-dark); margin: 18px 0 10px; }
.field input[readonly] { background: #f1f3f6; color: var(--muted); }

.sig-wrap {
  border: 1px dashed var(--muted);
  border-radius: 8px;
  background: #fff;
  height: 160px;
  touch-action: none;
}
.sig-wrap.invalid { border: 1px solid var(--danger); }
.sig-wrap canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
#sigClear { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

.read-status { margin-top: 8px; font-weight: 600; color: var(--warn); }
.read-status.done { color: var(--success); }
.checkbox-col label.locked { color: var(--muted); cursor: not-allowed; }

/* ---- Admin section switcher (admin/includes/nav.php) ---- */
.admin-brand { padding-bottom: 4px; }
.admin-brand img.logo { display: block; margin: 0 auto 14px; }
.admin-brand p { margin-top: 10px; font-size: 0.9rem; }
.section-switch { position: relative; display: inline-block; margin-top: 4px; text-align: left; }
.section-switch summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(29, 29, 29, 0.06);
  cursor: pointer;
  user-select: none;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-dark);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.section-switch summary::-webkit-details-marker { display: none; }
.section-switch summary:hover { border-color: var(--brand); }
.section-switch summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.section-switch[open] summary { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(129, 149, 37, 0.15); }
.switch-chevron {
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.15s;
}
.section-switch[open] .switch-chevron { transform: translateY(2px) rotate(-135deg); }
.switch-count {
  display: inline-block;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--brand-dark);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}
.switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: min(360px, calc(100vw - 32px));
  padding: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(29, 29, 29, 0.14);
}
.switch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.switch-item:hover, .switch-item:focus-visible { background: var(--bg); outline: none; }
.switch-item.is-current { background: var(--success-bg); }
.switch-check { width: 16px; color: var(--brand-dark); font-weight: 700; flex-shrink: 0; }
.switch-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.switch-title { font-weight: 600; font-size: 0.95rem; }
.switch-hint { color: var(--muted); font-size: 0.8rem; }
@media (max-width: 560px) {
  .section-switch summary { font-size: 1.05rem; padding: 8px 12px 8px 16px; }
}

/* ---- Admin: change email + one-time upload link (admin/view.php) ---- */
.copy-row { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.copy-row input { flex: 1; min-width: 0; }
.copy-btn, .secondary-btn {
  padding: 8px 16px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--brand-dark);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.copy-btn:hover, .secondary-btn:hover { background: var(--brand); color: #fff; }
.edit-email { margin-top: 4px; }
.edit-email summary { color: var(--brand-dark); font-size: 0.85rem; cursor: pointer; text-decoration: underline; width: fit-content; }
.new-link { background: var(--success-bg); border: 1px solid var(--success); border-radius: 8px; padding: 12px; }
.new-link input { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; }

/* ---- Admin: previous values of corrected details (admin/view.php) ---- */
.previous-value { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.previous-value span { font-size: 0.75rem; }
.brand .previous-value { text-align: center; }
