/* ── Blazor framework ─────────────────────────────────────────────────────── */

h1:focus { outline: none; }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid                             { outline: 1px solid #e50000; }
.validation-message                  { color: #e50000; font-size: 13px; margin-top: 2px; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred." }

/* ── Base ─────────────────────────────────────────────────────────────────── */

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

body {
    margin: 0;
    font-family: var(--cbs-font-ui);
    font-size: 15px;
    color: var(--cbs-ink);
    background: #f5f6f8;
}

h1, h2, h3, h4 { font-family: var(--cbs-font-display); letter-spacing: var(--cbs-track-tight); }

a { color: var(--cbs-green); }

/* ── Login page ───────────────────────────────────────────────────────────── */

.login-box {
    max-width: 440px;
    margin: 80px auto;
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
}

.login-box h1 {
    margin: 0 0 8px;
    font-size: 22px;
}

/* Dual-brand row at the top of the login box: org logo on the left (if the
   society has uploaded one), CBSportal wordmark always on the right. The
   <span></span> placeholder when there's no org logo keeps flex space-between
   from collapsing the CBS logo to the left edge. */
.login-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 20px;
    min-height: 40px;
}
.login-logo-org { display: block; max-height: 48px; max-width: 200px; }
.login-logo-cbs { display: block; height: 32px; }

.login-box p { color: #555; margin: 0 0 20px; }

.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; font-weight: 600; color: #444; }
.field input {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 15px;
    width: 100%;
}
.field input:focus { outline: none; border-color: var(--cbs-green); box-shadow: 0 0 0 3px rgba(47,93,58,.15); }
.field input:disabled { background: #f5f6f8; }

button[type=submit] {
    width: 100%;
    padding: 10px;
    background: var(--cbs-green);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
button[type=submit]:hover:not(:disabled) { background: var(--cbs-green-deep); }
button[type=submit]:disabled { opacity: 0.6; cursor: default; }

.org-picker { display: flex; flex-direction: column; gap: 8px; }
.org-picker-btn {
    width: 100%;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--cbs-green);
    text-align: left;
    cursor: pointer;
}
.org-picker-btn:hover { background: #e8efe9; border-color: var(--cbs-green); }

.alert-info {
    background: #e8efe9;
    border: 1px solid rgba(47,93,58,.25);
    border-radius: 5px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--cbs-green-deep);
    font-size: 14px;
    line-height: 1.5;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 5px;
    padding: 10px 14px;
    margin-bottom: 12px;
    color: #991b1b;
    font-size: 14px;
}

/* ── Portal shell ─────────────────────────────────────────────────────────── */

.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* Top bar — CBSportal product identity. White background, claret-accented
   wordmark on the left, Log-out on the right. The chrome of the CBS suite
   sits here; the org's own branding lives in the bar below. */
.portal-top-bar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 8px 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.portal-top-logo   { display: block; height: 32px; }
.portal-top-logout {
    font-size: 13px;
    color: var(--cbs-ink-muted);
    text-decoration: none;
    font-weight: 500;
}
.portal-top-logout:hover { color: var(--cbs-ink); }

/* Brand bar — per-society colour with the society name. Background + text
   colours are set inline from OrgBrand.EffectivePrimaryHex / ContrastFg so
   this strip carries the society's identity. */
.portal-brand-bar {
    padding: 0 24px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.portal-brand-org    { font-weight: 700; font-size: 15px; }
.portal-brand-member { font-size: 13px; opacity: .9; }

.portal-nav {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 24px;
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.portal-nav a {
    display: block;
    padding: 12px 14px;
    color: #444;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.portal-nav a:hover  { color: var(--cbs-green); }
.portal-nav a.active { color: var(--cbs-green); border-bottom-color: var(--cbs-green); }

.portal-content {
    max-width: 800px;
    margin: 32px auto;
    padding: 0 24px;
    width: 100%;
}

/* ── Detail card ──────────────────────────────────────────────────────────── */

.detail-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 24px;
    overflow: hidden;
}
.detail-card-header {
    padding: 14px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
}
.detail-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0;
}
.detail-label, .detail-value {
    padding: 10px 20px;
    font-size: 14px;
    border-bottom: 1px solid #f3f4f6;
}
.detail-label { color: #6b7280; font-weight: 500; }
.detail-value { color: #111; }
.detail-grid > *:nth-last-child(-n+2) { border-bottom: none; }

.btn-primary {
    display: inline-block;
    padding: 8px 18px;
    background: var(--cbs-green);
    color: #fff;
    border: 1px solid var(--cbs-green);
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary:hover:not(:disabled) { background: var(--cbs-green-deep); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.btn-secondary {
    display: inline-block;
    padding: 8px 18px;
    background: #fff;
    color: var(--cbs-green);
    border: 1px solid var(--cbs-green);
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn-secondary:hover { background: #e8efe9; }

.member-number {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 20px;
}

.detail-hint {
    margin: 0;
    padding: 8px 20px 12px;
    font-size: 13px;
    color: #6b7280;
    background: #fff;
}

.detail-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-field-note {
    font-size: 12px;
    font-weight: 400;
    color: #9ca3af;
    line-height: 1.4;
}

/* ── Edit request form ────────────────────────────────────────────────────── */

.edit-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0;
}
.edit-grid label, .edit-grid input {
    padding: 10px 20px;
    font-size: 14px;
    border-bottom: 1px solid #f3f4f6;
}
.edit-grid label {
    color: #6b7280;
    font-weight: 500;
    display: flex;
    align-items: center;
}
.edit-grid input {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    margin: 6px 20px;
    padding: 6px 10px;
    font-size: 14px;
    width: calc(100% - 40px);
}
.edit-grid input:focus {
    outline: none;
    border-color: var(--cbs-green);
    box-shadow: 0 0 0 3px rgba(47,93,58,.12);
}
.edit-grid > *:nth-last-child(-n+2) { border-bottom: none; }

/* ── Documents list ───────────────────────────────────────────────────────── */

.doc-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.doc-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    gap: 16px;
}

.doc-row:last-child { border-bottom: none; }

.doc-info { flex: 1; }

.doc-label {
    font-size: 14px;
    font-weight: 500;
    color: #111;
    margin-bottom: 2px;
}

.doc-meta {
    font-size: 12px;
    color: #9ca3af;
}

.doc-action { display: flex; align-items: center; gap: 10px; }

.btn-download {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--cbs-green);
    border-radius: 6px;
    background: transparent;
    color: var(--cbs-green);
    cursor: pointer;
    white-space: nowrap;
}

.btn-download:hover { background: #e8efe9; }

.doc-downloading {
    font-size: 13px;
    color: #6b7280;
}

.doc-download-error {
    font-size: 13px;
    color: #dc2626;
}

/* Board-area file-type pill. Coloured by extension so the file kind is
   readable at a glance — most board docs are PDF; agendas/minutes done in
   Word still happen. */
.file-ext {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #6b7280;
    color: #fff;
    margin-right: 8px;
    min-width: 32px;
    text-align: center;
}
.file-ext.pdf  { background: #dc2626; }
.file-ext.doc, .file-ext.docx { background: #1d4ed8; }
.file-ext.xls, .file-ext.xlsx { background: #047857; }
.file-ext.note { background: #6b7280; }

.meeting-block {
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    margin-bottom: 16px;
    overflow: hidden;
}
.meeting-block .meeting-header {
    padding: 12px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.meeting-block .meeting-title {
    font-weight: 600;
    font-size: 15px;
}
.meeting-block .meeting-meta {
    color: #6b7280;
    font-size: 12px;
}

/* Login button — pushed down 60px so browser email-autocomplete dropdowns
   don't cover the "Send login link" button. */
.login-box button[type=submit] { margin-top: 60px; }

/* ── Shares page ──────────────────────────────────────────────────────────── */

.shares-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    margin-bottom: 16px;
}

.shares-card-header {
    padding: 12px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.shares-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.shares-table th,
.shares-table td {
    padding: 10px 20px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}

.shares-table thead th {
    background: #fafbfc;
    color: #6b7280;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.shares-table tbody tr:last-child td { border-bottom: 1px solid #e5e7eb; }

.shares-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.shares-table tfoot td {
    background: #f9fafb;
    border-bottom: none;
    font-weight: 600;
    color: #111;
    padding-top: 12px;
    padding-bottom: 12px;
}

.shares-table tfoot .total-label  { color: #374151; }
.shares-table tfoot .total-value  { font-size: 15px; }

.shares-table.past tbody td { color: #6b7280; }

.shares-grand-total {
    padding: 12px 20px;
    background: #e8efe9;
    border: 1px solid rgba(47,93,58,.25);
    border-radius: 6px;
    color: var(--cbs-green-deep);
    font-size: 15px;
    margin-bottom: 16px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--cbs-green);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 0;
    font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }
