/*
 * FarmSphere design tokens + auth-page recipes, ported server-side from
 * Demeter.Portal's Vue auth views and DESIGN.md (lines 21-101, 984-1014).
 * Namespaced under .fs-root on <body> to avoid touching the Bootstrap-themed
 * quickstart pages (Consent, Grants, Admin, Device, Ciba, Diagnostics, etc.)
 * that still use the Duende _Layout.cshtml.
 */

:root {
    --mint:    #5DCE97;
    --mint-d:  #3EAF78;
    --mint-dd: #2A8A5C;
    --mint-l:  #EBF9F3;
    --mint-ll: #F4FCF8;
    --teal:    #4A7C8E;
    --teal-d:  #2E5F70;
    --teal-l:  #E8F4F8;
    --dk:      #1a2e1a;

    --bg:   #F0F1EF;
    --wh:   #FFFFFF;
    --txt:  #2C2C2A;
    --mut:  #7A8A80;
    --brd:  #E2E8E4;
    --brd2: #C0CCC4;

    --gold:    #F4A623;  --gold-l:  #FEF5E7;
    --red:     #C62828;  --red-l:   #FFEBEE;
    --amber:   #E67E00;  --amber-l: #FFF3E0;
    --blue:    #1565C0;  --blue-l:  #E3F2FD;

    --shd: 0 1px 4px rgba(0, 0, 0, 0.09);
    --rad: 5px;
}

/* baseline */
.fs-root {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--txt);
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

.fs-root *,
.fs-root *::before,
.fs-root *::after {
    box-sizing: border-box;
}

/* Restore the HTML5 boolean `hidden` attribute behaviour. Our `.fs-field`,
 * `.fs-auth-block`, etc. declare `display:flex`/`block`, which (without this)
 * out-specifies the UA `[hidden] { display:none }` rule and leaves toggled
 * fields visible. */
.fs-root [hidden] { display: none !important; }

/* page shell */
.fs-auth-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-height: 100dvh;
}

.fs-auth-shell {
    width: 100%;
    max-width: 420px;
    background: var(--wh);
    border-radius: var(--rad);
    box-shadow: var(--shd);
    border-top: 3px solid var(--mint);
    overflow: hidden;
}

.fs-auth-card {
    color: var(--txt);
    padding: 32px 32px 28px;
    text-align: center;
}

/* brand block */
.fs-auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 18px;
}

.fs-auth-logo {
    display: block;
    width: 64px;
    height: auto;
    user-select: none;
}

.fs-auth-wordmark {
    font-size: 20px;
    font-weight: 300;
    color: var(--teal);
    letter-spacing: -0.3px;
    line-height: 1.1;
    margin-top: 8px;
}

.fs-auth-tagline {
    font-size: 10.5px;
    color: var(--mut);
    letter-spacing: 0.2px;
}

.fs-auth-welcome {
    font-size: 13px;
    color: #5a6a60;
    margin: 0 0 14px;
    line-height: 1.5;
}

.fs-auth-heading {
    font-size: 16px;
    font-weight: 500;
    color: var(--txt);
    margin: 0;
}

.fs-auth-message {
    font-size: 13px;
    color: #5a6a60;
    margin: 0;
    max-width: 320px;
}

.fs-auth-note {
    font-size: 12px;
    color: var(--mut);
    margin: 4px 0 0;
}

.fs-auth-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* mode toggle (signup email/mobile) */
.fs-auth-modes {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
}

.fs-auth-mode {
    background: transparent;
    border: 1px solid #d6dcd6;
    color: #5a6a60;
    border-radius: 4px;
    padding: 6px 16px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.14s, color 0.14s, border-color 0.14s;
}

.fs-auth-mode.active {
    background: var(--mint);
    border-color: var(--mint);
    color: var(--wh);
}

.fs-auth-mode:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* form: native HTML inputs styled to mirror Vuetify variant="underlined" density="compact" */
.fs-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.fs-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fs-field-label {
    font-size: 11.5px;
    color: var(--mut);
    line-height: 1.2;
}

.fs-field-input {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--brd2);
    background: transparent;
    padding: 6px 0 5px;
    font-family: inherit;
    font-size: 13px;
    color: var(--txt);
    outline: none;
    transition: border-color 0.14s;
}

.fs-field-input::placeholder {
    color: #b0bcb4;
}

.fs-field-input:focus {
    border-bottom-color: var(--mint);
}

.fs-field-input:disabled {
    color: var(--mut);
    cursor: not-allowed;
}

.fs-field--error .fs-field-input {
    border-bottom-color: #c14b4b;
}

.fs-field-error {
    font-size: 11.5px;
    color: #c14b4b;
    line-height: 1.3;
    margin-top: 2px;
}

/* password reveal toggle wraps the input + button in a row */
.fs-field-row {
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 1px solid var(--brd2);
    transition: border-color 0.14s;
}

.fs-field-row:focus-within {
    border-bottom-color: var(--mint);
}

.fs-field--error .fs-field-row {
    border-bottom-color: #c14b4b;
}

.fs-field-row .fs-field-input {
    border-bottom: 0;
    flex: 1;
}

.fs-field-reveal {
    background: transparent;
    border: 0;
    color: var(--mut);
    cursor: pointer;
    padding: 4px;
    line-height: 0;
}

.fs-field-reveal:hover {
    color: var(--txt);
}

/* checkbox */
.fs-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #5a6a60;
    cursor: pointer;
    user-select: none;
}

.fs-check input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--mint);
    cursor: pointer;
    margin: 0;
}

/* banners */
.fs-auth-error {
    font-size: 12.5px;
    color: #c14b4b;
    background: #fdecec;
    border: 1px solid #f3c8c8;
    border-radius: 4px;
    padding: 8px 10px;
    margin: 0 0 12px;
    text-align: left;
}

.fs-auth-error ul {
    margin: 0;
    padding-left: 18px;
}

.fs-auth-success {
    font-size: 12.5px;
    color: #2f7a52;
    background: #e6f5ec;
    border: 1px solid #b9e2c9;
    border-radius: 4px;
    padding: 8px 10px;
    margin: 0 0 12px;
    text-align: left;
}

/* buttons */
.fs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 24px;
    border-radius: 5px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.14s, color 0.14s, border-color 0.14s;
    line-height: 1.2;
}

.fs-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* In-flight submit state: keep the mint fill readable (don't dim as hard as a
 * plain disabled button) and block pointer interaction while the request runs. */
.fs-btn--loading {
    opacity: 0.85;
    cursor: progress;
    pointer-events: none;
}

@keyframes fs-spin {
    to { transform: rotate(360deg); }
}

.fs-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fs-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.fs-btn-mint {
    background: var(--mint);
    color: var(--wh);
}

.fs-btn-mint:hover:not(:disabled) {
    background: var(--mint-d);
    color: var(--wh);
}

.fs-btn-out {
    background: transparent;
    color: #5a6a60;
    border: 1px solid var(--brd2);
}

.fs-btn--xs {
    padding: 5px 14px;
    font-size: 12px;
}

.fs-btn-out:hover:not(:disabled) {
    background: #f4f6f3;
    color: var(--txt);
}

.fs-btn-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.fs-btn-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.fs-auth-cta {
    min-width: 160px;
    margin-top: 4px;
}

/* Duende front-channel-logout iframe: it still fires its src to sign the
 * user out of every client, but the 0x0 element renders a stray default
 * border. display:none removes the artifact without stopping the request. */
.signout {
    display: none;
}

/* footer link block */
.fs-auth-foot {
    font-size: 12.5px;
    color: #5a6a60;
    margin-top: 18px;
}

.fs-auth-link {
    color: var(--teal);
    font-weight: 500;
    text-decoration: none;
}

.fs-auth-link:hover {
    text-decoration: underline;
}

.fs-auth-link--sm {
    font-size: 12.5px;
}

.fs-auth-subline {
    font-size: 12px;
    color: var(--mut);
}

.fs-mt-1 { margin-top: 4px; }
.fs-mt-2 { margin-top: 6px; }
.fs-mt-3 { margin-top: 18px; }
.fs-center { text-align: center; }

.fs-auth-fine {
    font-size: 11px;
    color: var(--mut);
    margin-top: 14px;
    line-height: 1.5;
}

.fs-auth-fine a {
    color: var(--teal);
    text-decoration: none;
}

.fs-auth-fine a:hover {
    text-decoration: underline;
}

/* inline SVG icon sizing */
.fs-icon {
    display: inline-block;
    width: 36px;
    height: 36px;
}

.fs-icon-mint { color: var(--mint); }
.fs-icon-red { color: #c14b4b; }

/* ─── App shell (authenticated Identity pages: Grants, etc.) ─── */
.fs-app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--dk);
    color: #f4f7f4;
    height: 44px;
    padding: 0 18px;
    gap: 16px;
}

.fs-app-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f4f7f4;
    text-decoration: none;
    font-size: 14px;
    font-weight: 300;
    letter-spacing: -0.3px;
}

.fs-app-brand img {
    width: 22px;
    height: auto;
}

.fs-app-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    color: #d9e3da;
}

.fs-app-user a {
    color: var(--mint);
    text-decoration: none;
    font-weight: 500;
}

.fs-app-user a:hover { text-decoration: underline; }

.fs-app-content {
    max-width: 820px;
    margin: 0 auto;
    padding: 28px 20px 40px;
}

.fs-page-hdr {
    margin: 0 0 18px;
}

.fs-page-hdr h1 {
    font-size: 17px;
    font-weight: 500;
    color: var(--txt);
    margin: 0 0 4px;
    letter-spacing: -0.2px;
}

.fs-page-hdr p {
    font-size: 12.5px;
    color: var(--mut);
    margin: 0;
    line-height: 1.5;
}

.fs-card-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fs-card {
    background: var(--wh);
    border: 1px solid var(--brd);
    border-radius: var(--rad);
    box-shadow: var(--shd);
    overflow: hidden;
}

.fs-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--brd);
    background: linear-gradient(to right, #fafbf9, #ffffff 60%);
}

.fs-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--txt);
}

.fs-card-title img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
}

.fs-card-body {
    padding: 10px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fs-meta-row {
    display: flex;
    gap: 8px;
    font-size: 12.5px;
    color: var(--txt);
}

.fs-meta-row dt {
    color: var(--mut);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex: 0 0 110px;
    margin: 2px 0 0;
}

.fs-meta-row dd {
    margin: 0;
    flex: 1;
}

.fs-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.fs-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 10px;
    background: var(--mint-l);
    color: var(--mint-dd);
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1.6;
}

.fs-pill--blue {
    background: var(--blue-l);
    color: var(--blue);
}

.fs-btn-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid #f3c8c8;
    padding: 5px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.14s, color 0.14s;
}

.fs-btn-danger:hover:not(:disabled) {
    background: var(--red);
    color: var(--wh);
}

.fs-empty-note {
    background: var(--teal-l);
    color: var(--teal-d);
    border-radius: var(--rad);
    padding: 14px 16px;
    font-size: 12.5px;
}

/* ─── Consent / Device / CIBA scope list ─── */
.fs-client-lead {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.fs-client-lead img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid var(--brd);
    background: var(--wh);
    object-fit: contain;
    padding: 2px;
}

.fs-client-lead-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fs-client-lead-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--txt);
    line-height: 1.2;
}

.fs-client-lead-sub {
    font-size: 12px;
    color: var(--mut);
}

.fs-binding {
    background: var(--mint-l);
    color: var(--mint-dd);
    border: 1px dashed var(--mint);
    border-radius: var(--rad);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    margin: 12px 0;
    letter-spacing: 0.5px;
}

.fs-section-head {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: #b0bcb4;
    padding: 0 0 6px;
    margin: 0;
}

.fs-scope-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    border: 1px solid var(--brd);
    border-radius: var(--rad);
    background: var(--wh);
    overflow: hidden;
}

.fs-scope-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--brd);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fs-scope-item:last-child { border-bottom: 0; }

.fs-scope-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.fs-scope-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--mint);
    cursor: pointer;
    margin: 0;
}

.fs-scope-row input[type="checkbox"]:disabled { cursor: not-allowed; }

.fs-scope-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--txt);
}

.fs-scope-required {
    font-size: 10.5px;
    color: var(--mut);
    margin-left: 4px;
}

.fs-scope-emphasize {
    color: var(--gold);
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
}

.fs-scope-desc {
    font-size: 12px;
    color: var(--mut);
    padding-left: 23px;
    line-height: 1.5;
}

.fs-scope-resources {
    font-size: 11.5px;
    color: var(--mut);
    padding-left: 23px;
}

.fs-scope-resources ul {
    margin: 4px 0 0;
    padding-left: 16px;
}

/* ─── Diagnostics: claim list ─── */
.fs-claim-grid {
    display: grid;
    grid-template-columns: minmax(140px, 30%) 1fr;
    gap: 4px 16px;
    margin: 0;
    font-size: 12.5px;
}

.fs-claim-grid dt {
    color: var(--mut);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    word-break: break-word;
    padding: 2px 0;
}

.fs-claim-grid dd {
    color: var(--txt);
    margin: 0;
    word-break: break-word;
    padding: 2px 0;
}

/* ─── Data table (Ciba/All) ─── */
.fs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    background: var(--wh);
    border: 1px solid var(--brd);
    border-radius: var(--rad);
    overflow: hidden;
}

.fs-table th {
    background: #fafbf9;
    color: var(--mut);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--brd);
}

.fs-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--brd);
    color: var(--txt);
    vertical-align: middle;
}

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

.fs-table tr:hover td { background: var(--mint-ll); }

/* small responsive tweak — keep card readable below 360px */
@media (max-width: 380px) {
    .fs-auth-bg {
        padding: 12px;
    }
    .fs-auth-card {
        padding: 24px 18px 22px;
    }
    .fs-auth-cta {
        width: 100%;
    }
}
