/* GNAFF registration: additions layered on top of the shared Hello Farmer dashboard styles
   (assets_site.css / assets_console.css / assets_admin.css are copied unchanged).
   Uses the same --gcap-* tokens so it follows any future palette change in those files. */

/* The GNAFF logo is a tight circular crop, unlike the padded Hello Farmer mark. */
.reg-app .admin-brand-mark img,
.reg-app .console-brand-mark img {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    object-fit: contain;
}

.reg-flash { margin-bottom: 1rem; }

.reg-heading-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.reg-heading-row .admin-page-heading { flex: 1 1 22rem; }
.reg-heading-action,
.reg-heading-actions { flex: 0 0 auto; }
.reg-heading-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.reg-heading-action,
.reg-heading-actions a,
.reg-form-actions a,
.reg-form-actions button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    width: auto;
    text-decoration: none;
}

.reg-narrow { max-width: 36rem; }

/* Filters: five fields instead of the dashboard's eight. */
.reg-filter-grid .registry-bulk-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.reg-missing {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--gcap-danger-bg);
    color: var(--gcap-danger-text);
    font-size: 0.72rem;
    font-weight: 700;
}
.registry-row-actions { gap: 0.4rem; }

/* The dashboard table sizes columns by position for its own 7-column layout (checkbox
   first). This table has 6 columns, so reset those widths. */
.reg-app .registry-table-console.reg-table { min-width: 900px; }
.reg-app .registry-table-console.reg-table :is(th, td) { width: auto; min-width: 0; text-align: left; }
.reg-app .registry-table-console.reg-table :is(th, td):nth-child(1) { min-width: 260px; width: 30%; }
.reg-app .registry-table-console.reg-table :is(th, td):nth-child(2) { min-width: 140px; }
.reg-app .registry-table-console.reg-table :is(th, td):nth-child(3) { min-width: 200px; width: 24%; }
.reg-app .registry-table-console.reg-table :is(th, td):nth-child(5) { white-space: nowrap; }
.reg-app .registry-table-console.reg-table :is(th, td):nth-child(6) { min-width: 140px; white-space: nowrap; }
.reg-app .registry-table-console.reg-table tbody tr { height: auto; }

/* -- Register / edit form --------------------------------------------- */

.reg-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
    grid-template-areas: "main aside" "actions actions";
    gap: 1.25rem;
    align-items: start;
}
.reg-form-main { grid-area: main; display: grid; gap: 1.25rem; min-width: 0; }
.reg-form-aside { grid-area: aside; display: grid; gap: 1.25rem; }
.reg-form-actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 0 0.5rem;
    border-top: 1px solid var(--gcap-border);
}

.reg-section .card-gcap-title { margin-bottom: 1rem; }

.reg-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem 1.1rem;
}
.reg-span-2 { grid-column: span 2; }
.reg-coords { grid-column: span 2; }

.reg-field label,
.reg-label {
    display: block;
    margin-bottom: 0.4rem;
    color: #2f5042;
    font-size: 0.86rem;
    font-weight: 700;
}
.reg-req { color: var(--gcap-danger-text); }

.reg-field input,
.reg-field select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #e3ddce;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    color: #274438;
    padding: 0.6rem 0.85rem;
    font: inherit;
    transition: border-color 0.16s, box-shadow 0.16s;
}
.reg-field input:focus,
.reg-field select:focus {
    outline: none;
    border-color: #8abf5b;
    box-shadow: 0 0 0 4px rgba(138, 191, 91, 0.16);
}
.reg-field.has-error input,
.reg-field.has-error select {
    border-color: var(--gcap-danger-text);
    background: var(--gcap-danger-bg);
}
.reg-field-error {
    margin: 0.35rem 0 0;
    color: var(--gcap-danger-text);
    font-size: 0.8rem;
    font-weight: 600;
}
.reg-hint {
    margin: 0.45rem 0 0;
    color: var(--gcap-text-muted);
    font-size: 0.8rem;
}
.reg-hint:empty { display: none; }
.reg-static {
    margin: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    color: var(--gcap-text-muted);
    font-weight: 600;
}

.reg-coords-row { display: flex; gap: 0.6rem; }
.reg-coords-row input { flex: 1 1 0; min-width: 0; }
.reg-coords-row button { flex: 0 0 auto; width: auto; white-space: nowrap; }

/* Photo */
.reg-photo-frame {
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    border: 3px solid var(--gcap-primary);
    background: var(--gcap-indigo-50);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.9rem;
}
.reg-photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.reg-photo-empty { color: var(--gcap-text-muted); font-weight: 600; }
.reg-photo-card.has-error .reg-photo-frame { border-color: var(--gcap-danger-text); }
.reg-photo-button {
    display: flex;
    justify-content: center;
    width: 100%;
    cursor: pointer;
    text-decoration: none;
}
.reg-photo-button:focus-within,
#fld-photo:focus + .reg-photo-button { outline: 2px solid var(--gcap-primary); }
.reg-photo-alert { margin: 0; font-size: 0.85rem; }
.reg-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Miniature of the GNAFF ID card so the registrar sees what will be printed. */
.reg-card-preview-label {
    margin: 0 0 0.5rem;
    color: var(--gcap-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.reg-mini-card {
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--gcap-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    text-align: center;
}
.reg-mini-card-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem;
    background: #fff;
    color: #0b4f2c;
    font-weight: 800;
    letter-spacing: 0.04em;
    border-bottom: 5px solid #f7d117;
    box-shadow: 0 3px 0 #ce1126;
}
.reg-mini-card-head img { width: 34px; height: 34px; }
.reg-mini-card-photo {
    width: 104px;
    height: 120px;
    margin: 0.8rem auto 0;
    border-radius: 10px;
    background: #eef1ee;
    overflow: hidden;
    position: relative;
    z-index: 1;
}
.reg-mini-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.reg-mini-card-body {
    margin-top: -40px;
    padding: 48px 0.8rem 0.8rem;
    background: #0b4a29;
    color: #fff;
}
.reg-mini-card-name { display: block; font-size: 1.15rem; font-weight: 800; overflow-wrap: anywhere; }
.reg-mini-card-status {
    display: inline-block;
    margin: 0.3rem 0 0.7rem;
    padding: 0.15rem 1.4rem;
    border-radius: 999px;
    background: #f7d117;
    color: #07190c;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3em;
}
.reg-mini-card-details {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.6rem;
    align-items: center;
    text-align: left;
    font-size: 0.74rem;
    font-weight: 700;
}
.reg-mini-card-details p { margin: 0; grid-column: 1; overflow-wrap: anywhere; }
.reg-mini-card-qr {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 42px;
    height: 42px;
    border: 3px solid #f7d117;
    border-radius: 6px;
    background:
        conic-gradient(#111 25%, #fff 0 50%, #111 0 75%, #fff 0) 0 0 / 10px 10px,
        #fff;
    background-clip: content-box;
    padding: 4px;
}
.reg-mini-card-foot {
    padding: 0.5rem;
    background: #f7d117;
    color: #07190c;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

/* -- Farmer detail ---------------------------------------------------- */

.reg-show-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
    gap: 1.25rem;
    align-items: start;
}
.reg-show-main { display: grid; gap: 1.25rem; min-width: 0; }
.reg-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem 1.25rem;
    margin: 0;
}
.reg-details-stacked { grid-template-columns: 1fr; gap: 0.6rem; margin-top: 1rem; }
.reg-details dt { color: var(--gcap-text-muted); font-size: 0.76rem; font-weight: 650; }
.reg-details dd { margin: 0.15rem 0 0; color: var(--gcap-text); font-weight: 750; overflow-wrap: anywhere; }
.reg-muted { color: var(--gcap-text-muted); font-weight: 500; }

/* -- Account --------------------------------------------------------- */

.reg-logout-form { margin: 0; }
.reg-logout-form button,
.reg-link-button {
    display: flex;
    align-items: center;
    gap: inherit;
    width: 100%;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    padding: inherit;
}
.reg-inline-form { margin-top: 1rem; }
.reg-details .reg-inline-form { margin-top: 0.35rem; }
.reg-link-button { display: inline; width: auto; padding: 0; color: var(--gcap-primary); font-weight: 700; text-decoration: underline; }

@media (max-width: 1100px) {
    .reg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .reg-form,
    .reg-show-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "aside" "actions"; }
    .reg-form-aside { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
}
@media (max-width: 600px) {
    .reg-grid { grid-template-columns: minmax(0, 1fr); }
    .reg-span-2,
    .reg-coords { grid-column: auto; }
    .reg-coords-row { flex-wrap: wrap; }
    .reg-coords-row button { flex: 1 1 100%; }
    .reg-photo-frame { max-width: 15rem; margin-left: auto; margin-right: auto; }
    .reg-form-actions > * { flex: 1 1 100%; justify-content: center; }
}

.reg-form-page,
.reg-show-page { display: grid; gap: 1.25rem; }
.reg-form-page .admin-page-heading,
.reg-show-page .admin-page-heading { margin-bottom: 0; }

/* -- Users ----------------------------------------------------------- */

.reg-users-page { display: grid; gap: 1.25rem; }
.reg-users-page .admin-page-heading { margin-bottom: 0; }
.reg-users-grid { display: grid; gap: 1.25rem; }
.reg-users-page > *,
.reg-users-grid > * { min-width: 0; }
.reg-add-user-form { display: grid; gap: 1rem; }
.reg-add-user-form .reg-hint { margin: 0; }
.reg-add-user-form .btn-gcap-primary { justify-self: start; width: auto; }
.reg-users-table a:not(.registry-view-btn) { color: var(--gcap-primary); font-weight: 700; }
.reg-users-table { min-width: 720px; }
.reg-users-table tbody td { vertical-align: middle; }
.reg-users-table .is-disabled-row td { opacity: 0.6; }
.reg-stack-form { display: grid; gap: 1rem; }
.reg-stack-form .btn-gcap-primary { justify-self: start; width: auto; }
.reg-ok,
.reg-pending {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.reg-ok { background: var(--gcap-success-bg); color: var(--gcap-success-text); }
.reg-pending { background: #fff6dc; color: #8a6100; }

.reg-issued {
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--gcap-success-border);
    border-radius: var(--radius-lg);
    background: var(--gcap-success-bg);
}
.reg-issued h2 { margin: 0 0 0.35rem; font-size: 1rem; color: var(--gcap-primary-dark); }
.reg-issued p { margin: 0 0 0.75rem; color: var(--gcap-text); }
.reg-issued-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.reg-issued code {
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    background: #fff;
    border: 1px dashed var(--gcap-success-border);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--gcap-text);
}
.reg-issued-row button { width: auto; }

.reg-access-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.25rem; }
.reg-access-actions form { margin: 0; }
.reg-access-actions button { width: auto; }
.reg-danger-button { color: var(--gcap-danger-text) !important; border-color: var(--gcap-danger-border) !important; }


/* -- ID cards -------------------------------------------------------- */

.reg-card-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    background: var(--gcap-indigo-50);
}
.reg-card-actions { display: grid; gap: 0.6rem; margin-top: 1rem; }
.reg-card-actions a { display: flex; justify-content: center; text-decoration: none; }
.reg-card-actions .reg-text-link { color: var(--gcap-primary); font-weight: 700; font-size: 0.86rem; }
.reg-print-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    padding: 1.25rem 1.5rem;
}
.reg-print-bar h2 { margin: 0 0 0.25rem; font-size: 1rem; color: var(--gcap-primary-dark); }
.reg-print-bar p { margin: 0; max-width: 46rem; color: var(--gcap-text-muted); }
.reg-print-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.reg-print-actions a { width: auto; text-decoration: none; }

.reg-field select:disabled { opacity: 0.6; cursor: not-allowed; }

.reg-static-id { font-family: inherit; font-weight: 800; letter-spacing: 0.04em; color: var(--gcap-text); }
.reg-codes-table td:first-child, .reg-codes-table td:nth-child(2) { font-weight: 800; letter-spacing: 0.05em; white-space: nowrap; }

/* "hidden" must win over the dashboard styles that set display on rows, buttons, etc. */
.reg-app [hidden] { display: none !important; }

/* -- Public self-registration (/join): phone first ----------------------- */

.join-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gcap-surface);
    color: var(--gcap-text);
}
.join-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #0b4a29;
    color: #fff;
    border-bottom: 5px solid #f7d117;
}
.join-header img { width: 44px; height: 44px; border-radius: 50%; background: #fff; }
.join-header strong { display: block; font-size: 1.15rem; letter-spacing: 0.04em; }
.join-header span { display: block; font-size: 0.82rem; opacity: 0.85; }
.join-main {
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
    padding: 1.25rem 1rem 2rem;
    flex: 1;
}
.join-main h1 { margin: 0 0 0.5rem; font-size: 1.6rem; line-height: 1.2; color: var(--gcap-primary-dark); }
.join-lead { margin: 0 0 1.25rem; font-size: 1rem; color: var(--gcap-text); }
.join-main .alert-gcap-danger { margin-bottom: 1rem; }
.join-form { display: grid; gap: 1rem; }
.join-card {
    background: #fff;
    border: 1px solid var(--gcap-border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1rem 1.25rem;
    display: grid;
    gap: 0.9rem;
}
.join-card.has-error { border-color: var(--gcap-danger-border); }
.join-card h2 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    font-size: 1.1rem;
    color: var(--gcap-primary-dark);
}
.join-card h2 span {
    display: inline-grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: #f7d117;
    color: #07190c;
    font-size: 0.95rem;
    font-weight: 800;
}
.join-card .reg-field label small { font-weight: 500; color: var(--gcap-text-muted); }
.join-card .reg-field input,
.join-card .reg-field select { min-height: 48px; font-size: 1rem; } /* 16px stops iOS zooming in */
.join-card .reg-hint { margin: 0; }
.join-location { width: 100%; justify-content: center; }
.join-photo-frame { max-width: 14rem; width: 100%; margin: 0 auto; }
.join-fee {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--gcap-indigo-50);
    font-weight: 700;
}
.join-fee strong { font-size: 1.35rem; color: var(--gcap-primary-dark); }
.join-consent label {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.4;
    margin: 0;
}
.join-consent input[type="checkbox"] {
    width: 1.35rem;
    min-height: 1.35rem;
    height: 1.35rem;
    margin-top: 0.1rem;
    flex: 0 0 auto;
    accent-color: var(--gcap-primary);
}
.join-submit {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    text-decoration: none;
}
.join-secure { text-align: center; }
/* Honeypot: off screen for people, still in the form for scripts. */
.join-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.join-footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--gcap-text-muted);
}
.join-footer a { color: var(--gcap-primary); }

.join-result { text-align: center; }
.join-result-icon {
    width: 4rem;
    height: 4rem;
    margin: 1rem auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 2rem;
    font-weight: 800;
}
.join-result-icon.is-ok { background: var(--gcap-success-bg); color: var(--gcap-success-text); }
.join-result-icon.is-wait { background: #fff6dc; color: #8a6100; }
.join-result-icon.is-bad { background: var(--gcap-danger-bg); color: var(--gcap-danger-text); }
.join-member-id {
    display: inline-block;
    margin: 0 0 1.25rem;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    background: #0b4a29;
    color: #fff;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}
.join-email-note { margin: 0 0 1rem; padding: 0.75rem 1rem; border-radius: 12px; background: var(--gcap-indigo-50); font-size: 0.92rem; text-align: left; overflow-wrap: anywhere; }
.join-summary {
    display: grid;
    gap: 0.6rem;
    margin: 0 0 1.25rem;
    padding: 1rem;
    text-align: left;
    background: #fff;
    border: 1px solid var(--gcap-border);
    border-radius: var(--radius-lg);
}
.join-summary dt { font-size: 0.78rem; color: var(--gcap-text-muted); font-weight: 650; }
.join-summary dd { margin: 0.1rem 0 0; font-weight: 750; overflow-wrap: anywhere; }
.join-result form { margin: 0 0 0.5rem; }
@media (min-width: 40rem) {
    .join-card { padding: 1.4rem 1.5rem 1.5rem; }
}

/* -- Settings / payments ---------------------------------------------- */
.reg-fee-form { max-width: 26rem; }
.reg-money { display: flex; align-items: stretch; }
.reg-money span {
    display: grid;
    place-items: center;
    padding: 0 0.9rem;
    border: 1px solid #e3ddce;
    border-right: 0;
    border-radius: 12px 0 0 12px;
    background: var(--gcap-indigo-50);
    font-weight: 800;
}
.reg-money input { border-radius: 0 12px 12px 0 !important; }
.reg-code { font-size: 0.85rem; overflow-wrap: anywhere; background: var(--gcap-indigo-50); padding: 0.1rem 0.35rem; border-radius: 6px; }
.reg-app .registry-table-console.reg-payments-table { min-width: 1040px; table-layout: auto; }
.reg-app .registry-table-console.reg-payments-table :is(th, td):nth-child(1) { min-width: 220px; width: auto; }
.reg-app .registry-table-console.reg-payments-table :is(th, td):nth-child(3) { min-width: 120px; width: auto; }
.reg-app .registry-table-console.reg-payments-table :is(th, td):nth-child(n+5) { white-space: nowrap; min-width: 0; }
.reg-payments-table .reg-code { white-space: nowrap; overflow-wrap: normal; }

/* Registration fee: ticked as paid by staff */
.reg-paid { color: var(--gcap-primary); font-weight: 800; margin-right: 0.25rem; }
.reg-fee-paid-form { margin-top: 0.6rem; padding: 0.85rem; border: 1px solid var(--gcap-border, #e3e6df); border-radius: 12px; background: var(--gcap-surface-muted, #f8f7f2); }
.reg-fee-paid-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; margin-bottom: 0.7rem; }
.reg-fee-paid-grid label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; font-weight: 700; color: var(--gcap-text-muted, #5b6b60); }
.reg-fee-paid-grid input, .reg-fee-paid-grid select { width: 100%; min-height: 2.4rem; font-weight: 500; color: inherit; }
.reg-fee-paid-grid small { font-weight: 500; }
.reg-fee-tick label { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 700; }
.reg-fee-tick input { margin-top: 0.2rem; width: auto; }
.reg-details > .reg-details-wide { grid-column: 1 / -1; }

/* "Mark paid" on the farmers list */
.reg-row-pay { margin: 0; }
.reg-row-pay .reg-mark-paid { cursor: pointer; font: inherit; background: var(--gcap-primary); border-color: var(--gcap-primary); color: #fff; }
.reg-row-pay .reg-mark-paid:hover { filter: brightness(1.1); }
.reg-app .registry-table-console.reg-table .registry-row-actions { flex-wrap: wrap; }
.reg-row-pay { flex-basis: 100%; }
.reg-row-pay .reg-mark-paid { width: 100%; }
.reg-app .registry-table-console.reg-table:not(.reg-payments-table) :is(th, td):nth-child(6) { min-width: 160px; width: 160px; }
