/* Design tokens shared by the redesigned Users (/users) and Entities (/entities)
   pages, lifted from the forest-systems-entities mockups. Scoped by usage (only
   components under Components/Pages/Users, Components/Pages/Entities, and the
   shared License/Ring/NotWired/ClientDatabaseSwitcher components reference these
   classes/variables) rather than by CSS scoping, since custom properties need to
   be visible to plain <style> and .razor.css alike. Do not use elsewhere in the
   app without deliberately opting the rest of the UI into this palette. */

:root {
    --forest-bg: #F5F7F4;
    --forest-surface: #FFFFFF;
    --forest-ink: #1B241D;
    --forest-ink-soft: #5C655D;
    --forest-ink-faint: #8B9089;
    --forest-900: #1B5E20;
    --forest-700: #1B5E20;
    --forest-600: #2D7D32;
    --forest-500: #2D7D32;
    --forest-gold-500: #B8873F;
    --forest-slate-500: #4E699A;
    --forest-stone-400: #9A9C95;
    --forest-border: #E1E4DE;
    --forest-border-soft: #EBEDE8;

    --forest-active-bg: #E8F5E9; --forest-active-fg: #1B5E20; --forest-active-dot: #43A047;
    --forest-view-bg: #E8EDF6;   --forest-view-fg: #334F80;   --forest-view-dot: #4E699A;
    --forest-archive-bg: #EDEDEA; --forest-archive-fg: #65675F; --forest-archive-dot: #9A9C95;
    --forest-delete-bg: #FBEAE7; --forest-delete-fg: #9A3B2C; --forest-delete-dot: #C0503C;

    --forest-shadow-sm: 0 1px 2px rgba(22,40,30,0.06);
    --forest-shadow-md: 0 4px 16px rgba(22,40,30,0.08);
    --forest-radius: 10px;
}

.forest-mono { font-family: var(--fw-font-sans); font-variant-numeric: tabular-nums; }
.forest-serif { font-family: var(--fw-font-sans); }

.forest-admin-badge {
    font-family: var(--fw-font-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    color: #8A6423;
    background: #FBF3E6;
    border: 1px solid #EFDCB8;
    border-radius: 100px;
    padding: 6px 12px;
    white-space: nowrap;
    display: inline-block;
}

.forest-status-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.forest-status-tag .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.forest-status-tag.active .dot { background: var(--forest-active-dot); }
.forest-status-tag.active { color: var(--forest-active-fg); }
.forest-status-tag.view .dot { background: var(--forest-view-dot); }
.forest-status-tag.view { color: var(--forest-view-fg); }
.forest-status-tag.archive .dot { background: var(--forest-archive-dot); }
.forest-status-tag.archive { color: var(--forest-archive-fg); }
.forest-status-tag.delete .dot { background: var(--forest-delete-dot); }
.forest-status-tag.delete { color: var(--forest-delete-fg); }

/* ---- Shared modal chrome (NewUserModal, EditSettingsModal, NewEntityWizard) ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(22,40,30,0.45);
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 20px;
    overflow-y: auto;
    font-family: var(--fw-font-sans);
}
.modal-card {
    background: var(--forest-surface);
    border-radius: 14px;
    box-shadow: var(--forest-shadow-md);
    width: 100%;
    max-width: 680px;
    padding: 28px 32px 24px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h2 { font-family: var(--fw-font-sans); font-weight: 500; font-size: 19px; margin: 0; color: var(--forest-900); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--forest-ink-faint); font-size: 16px; }
.modal-close:hover { color: var(--forest-ink); }
.modal-sub { font-size: 13px; color: var(--forest-ink-soft); margin: 4px 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-field label { font-size: 12px; font-weight: 600; color: var(--forest-ink-soft); }
.form-field input, .form-field select, .form-field textarea {
    padding: 8px 10px;
    border: 1px solid var(--forest-border);
    border-radius: 7px;
    font-size: 13.5px;
    font-family: var(--fw-font-sans);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none; border-color: var(--forest-500); box-shadow: 0 0 0 3px rgba(63,125,88,0.15);
}

.btn-primary {
    padding: 8px 18px;
    background: var(--forest-700);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: var(--forest-600); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--forest-border);
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--forest-ink-soft);
    cursor: pointer;
}
.btn-secondary:hover { background: var(--forest-border-soft); }

.new-user-message { font-size: 12.5px; color: var(--forest-delete-fg); margin: 4px 0 0; }

/* ---- Shared section/card primitives (Users/Entities admin panels) ---- */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 28px 0 14px;
    font-family: var(--fw-font-sans);
}
.section-head h2 {
    font-family: var(--fw-font-sans);
    font-weight: 500;
    font-size: 17px;
    margin: 0;
    color: var(--forest-900);
}
.simple-card {
    background: var(--forest-surface);
    border: 1px solid var(--forest-border);
    border-radius: var(--forest-radius);
    box-shadow: var(--forest-shadow-sm);
    padding: 20px 24px;
    font-family: var(--fw-font-sans);
    margin-bottom: 24px;
}
.simple-card h3 { font-size: 14px; margin: 0 0 6px; color: var(--forest-900); }
.simple-card .pane-desc { font-size: 12.5px; color: var(--forest-ink-soft); margin: 0 0 12px; }

.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid var(--forest-border-soft);
}
.config-row:last-of-type { border-bottom: none; }
.config-label { font-size: 13.5px; font-weight: 600; color: var(--forest-ink); }
.config-sub { font-size: 12px; color: var(--forest-ink-faint); margin-top: 2px; }
.config-row select {
    padding: 6px 10px;
    border: 1px solid var(--forest-border);
    border-radius: 7px;
    font-size: 13px;
}

.toggle-switch { display: inline-flex; align-items: center; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-slider {
    width: 36px; height: 20px; background: var(--forest-stone-400);
    border-radius: 10px; position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-slider::after {
    content: ''; position: absolute; width: 16px; height: 16px; background: #fff;
    border-radius: 50%; top: 2px; left: 2px; transition: left .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--forest-500); }
.toggle-switch input:checked + .toggle-slider::after { left: 18px; }

/* ---- Shared license-card layout (UserLicenseCard, EntityLicenseCard) ---- */
.license-card {
    background: var(--forest-surface);
    border: 1px solid var(--forest-border);
    border-radius: var(--forest-radius);
    box-shadow: var(--forest-shadow-sm);
    padding: 24px 28px;
    display: grid;
    grid-template-columns: 1fr 1.3fr auto;
    gap: 28px;
    font-family: var(--fw-font-sans);
    margin-bottom: 24px;
}
@media (max-width: 720px) {
    .license-card { grid-template-columns: 1fr; }
}

.lic-meta { display: grid; row-gap: 16px; align-content: start; }
.lic-meta .row dt {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--forest-ink-faint);
    margin: 0 0 4px;
}
.lic-meta .row dd { margin: 0; font-size: 16px; font-weight: 600; color: var(--forest-ink); }
.lic-meta .row dd.edition { color: var(--forest-700); }

table.counts { width: 100%; border-collapse: collapse; font-size: 14px; }
table.counts thead th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--forest-ink-faint);
    font-weight: 600;
    padding: 0 10px 10px 0;
    border-bottom: 1px solid var(--forest-border-soft);
}
table.counts thead th.num-col { text-align: right; }
table.counts tbody td {
    padding: 10px 10px 10px 0;
    border-bottom: 1px solid var(--forest-border-soft);
    color: var(--forest-ink);
}
table.counts tbody tr:last-child td { border-bottom: none; }
table.counts td.num-col { text-align: right; }
table.counts tr.total td {
    font-weight: 700;
    padding-top: 12px;
    border-top: 1px solid var(--forest-border);
    border-bottom: none;
}

.license-num-input {
    font-family: var(--fw-font-sans);
    font-weight: 600;
    font-size: 14px;
    text-align: right;
    width: 52px;
    border: 1px solid var(--forest-gold-500);
    border-radius: 6px;
    padding: 2px 6px;
    background: #fff;
    color: var(--forest-ink);
}
.license-num-input:focus {
    outline: none;
    border-color: var(--forest-500);
    box-shadow: 0 0 0 3px rgba(63,125,88,0.15);
}

.license-edition-select,
.license-date-input {
    font-family: var(--fw-font-sans);
    font-weight: 600;
    font-size: 16px;
    border: 1px solid var(--forest-gold-500);
    border-radius: 6px;
    padding: 2px 8px;
    background: #fff;
    color: var(--forest-ink);
}
.license-edition-select:focus,
.license-date-input:focus {
    outline: none;
    border-color: var(--forest-500);
    box-shadow: 0 0 0 3px rgba(63,125,88,0.15);
}

.lic-save-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.usr-save-ok { font-size: 12px; color: var(--forest-500); font-weight: 600; }
.usr-save-err { font-size: 12px; color: var(--forest-delete-fg); }
.usr-section-loading { font-size: 13px; color: var(--forest-ink-faint); }

/* ---- Shared table toolbar + entities table (UserManagementTable, EntitiesPage) ---- */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    font-family: var(--fw-font-sans);
}
.toolbar-left { display: flex; align-items: center; gap: 10px; }
.count-chip {
    font-size: 12px;
    color: var(--forest-ink-faint);
    background: var(--forest-border-soft);
    padding: 4px 10px;
    border-radius: 100px;
}
.new-entity-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--forest-700);
    color: #fff;
    border: none;
    padding: 9px 16px 9px 12px;
    border-radius: 8px;
    font-family: var(--fw-font-sans);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--forest-shadow-sm);
}
.new-entity-btn:hover { background: var(--forest-600); }
.new-entity-btn svg { width: 16px; height: 16px; }

.entities-card {
    background: var(--forest-surface);
    border: 1px solid var(--forest-border);
    border-radius: var(--forest-radius);
    box-shadow: var(--forest-shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}
table.entities { width: 100%; border-collapse: collapse; font-size: 14px; }
table.entities thead th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--forest-ink-faint);
    font-weight: 600;
    padding: 13px 18px;
    background: #FBFCFA;
    border-bottom: 1px solid var(--forest-border);
}
table.entities tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--forest-border-soft);
    vertical-align: middle;
}
table.entities tbody tr:last-child td { border-bottom: none; }
table.entities tbody tr:hover { background: #FAFBF9; }
.entity-name { font-weight: 600; color: var(--forest-ink); }

.forest-not-wired {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--fw-font-sans);
    font-size: 11px;
    font-weight: 600;
    color: var(--forest-ink-faint);
    background: var(--forest-border-soft);
    border: 1px solid var(--forest-border);
    border-radius: 100px;
    padding: 3px 9px;
    white-space: nowrap;
}

/* Entities / Users toolbars while ManagementLock is on: in place of the New Entity / New User button. */
.mgmt-locked-note {
    font-size: 12.5px;
    color: var(--forest-ink-faint);
}
