:root {
    --esri-blue: #0079c1;
    --esri-blue-dark: #005e95;
    /* Taken from the GEP banner: deep navy of the "Portal" title and the green of the Tamkeen logo. */
    --gep-navy: #012b5b;
    --gep-green: #0e8944;
    --ink: #1f2933;
    --ink-muted: #5f6b76;
    --line: #dde3e8;
    --surface: #ffffff;
    --background: #f4f6f8;
    --success: #2e7d32;
    --danger: #b3261e;
    --radius: 8px;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font-family: "Segoe UI", "Avenir Next", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

body { display: flex; min-height: 100vh; flex-direction: column; }

a { color: var(--esri-blue); }
h1 { font-size: 1.9rem; margin: 0 0 0.75rem; line-height: 1.2; }
h1:focus { outline: none; }
h2 { font-size: 1.2rem; margin: 0 0 0.5rem; }
.muted { color: var(--ink-muted); }

/* Header */
.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface);
    border-bottom: 3px solid var(--esri-blue);
    box-shadow: 0 2px 0 0 var(--gep-green);
}
.brand { display: flex; align-items: center; gap: 0.9rem; text-decoration: none; color: var(--ink); line-height: 1.2; }
.brand-logo { height: 28px; width: auto; display: block; }
.brand-app { font-size: 1.05rem; font-weight: 600; padding-left: 0.9rem; border-left: 1px solid var(--line); white-space: nowrap; }
.topnav { display: flex; gap: 1rem; flex: 1; }
.topnav a { text-decoration: none; color: var(--ink); padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.topnav a.active { border-bottom-color: var(--esri-blue); color: var(--esri-blue); }
.account { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.account form { margin: 0; }
.account-name { color: var(--ink-muted); font-size: 0.9rem; }

/* Layout */
.content { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.footer {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
    padding: 1rem 1.5rem; font-size: 0.85rem; color: var(--ink-muted);
    border-top: 1px solid var(--line); background: var(--surface);
}

/* Components */
.hero { margin-bottom: 1.5rem; }
.banner-hero { margin: -0.5rem 0 1.5rem; border-radius: var(--radius); overflow: hidden; background: #ffffff; box-shadow: 0 1px 3px rgba(15, 30, 45, 0.15); }
.banner-hero img { display: block; width: 100%; height: auto; }
.what-you-can-do { margin-top: 2rem; }
.what-you-can-do h2 { margin-bottom: 0.15rem; }
.what-you-can-do > .muted { margin: 0 0 1rem; }
.feature-icon { display: block; color: var(--gep-green); margin-bottom: 0.5rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.feature h3 { margin-bottom: 0.35rem; color: var(--gep-navy); }
.feature p { margin: 0; color: var(--ink-muted); font-size: 0.95rem; }
.lead { font-size: 1.1rem; color: var(--ink-muted); max-width: 60ch; }
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}
.card.empty { text-align: center; padding: 2.5rem 1.5rem; }
.signin-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.signin-options .card { margin: 0; display: flex; flex-direction: column; align-items: flex-start; }
.signin-options .card p { flex: 0; }
.signin-options .card { border-top: 3px solid var(--esri-blue); }
.signin-options .signin-client { border-top-color: var(--gep-green); }
.hint { font-size: 0.85rem; color: var(--ink-muted); margin-bottom: 0; }

.button {
    display: inline-block; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    padding: 0.55rem 1.1rem; border-radius: 6px; border: 1px solid transparent;
}
.button-primary { background: var(--esri-blue); color: #fff; }
.button-primary:hover { background: var(--esri-blue-dark); }
.button-secondary { background: var(--surface); color: var(--esri-blue); border-color: var(--esri-blue); }
.button-secondary:hover { background: #e8f3fa; }
.button-link { background: none; border: none; padding: 0; color: var(--esri-blue); font-weight: 400; }
.button-link:hover { text-decoration: underline; }
.button:focus-visible, .topnav a:focus-visible { outline: 3px solid #8cc8ea; outline-offset: 2px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.arabic { margin: 0; color: var(--ink-muted); font-size: 1.1rem; }
/* Arabic runs keep right-to-left direction but line up with the surrounding left-aligned layout. */
.rtl-text { direction: rtl; unicode-bidi: isolate; display: inline-block; }
.badge {
    background: #e8f3fa; color: var(--esri-blue-dark); border-radius: 999px;
    padding: 0.2rem 0.8rem; font-weight: 600; font-size: 0.9rem; white-space: nowrap;
}
.notice {
    background: #fff8e1; border: 1px solid #f3d27a; border-radius: var(--radius);
    padding: 0.75rem 1rem; margin-bottom: 1rem;
}

.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.5rem; margin: 0; }
.details dt { color: var(--ink-muted); }
.details dd { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.25rem; display: flex; flex-direction: column;
}
.stat-value { font-size: 1.8rem; font-weight: 600; }
.stat-label { color: var(--ink-muted); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.65rem 1rem; text-align: left; border-bottom: 1px solid var(--line); }
.table th { font-size: 0.85rem; color: var(--ink-muted); font-weight: 600; background: #fafbfc; }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; }
.status { font-size: 0.85rem; font-weight: 600; }
.status-active { color: var(--success); }
.status-inactive { color: var(--danger); }

/* Blazor framework UI */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred."; }

/* Utilities */
.small { font-size: 0.85rem; }
.pre-line { white-space: pre-line; }
.text-danger { color: var(--danger); }
.req { color: var(--danger); font-weight: 700; }
.filters { margin-bottom: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.chip { background: #e8f3fa; color: var(--esri-blue-dark); border: 1px solid #bcdcef; border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.85rem; cursor: pointer; }
.chip:hover { background: #d7ebf7; }
.notice strong { color: var(--ink); }
.validation-errors { color: var(--danger); margin: 0 0 1rem; padding-left: 1.1rem; }
.text-warning { color: #9a6700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.breadcrumb { font-size: 0.9rem; color: var(--ink-muted); margin: 0 0 0.5rem; }
.badges { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.badge-muted { background: #eceff1; color: var(--ink-muted); }
.tag {
    display: inline-block; font-size: 0.75rem; font-weight: 600; margin: 0 0.25rem 0.25rem 0;
    padding: 0.05rem 0.5rem; border-radius: 999px; background: #eef2f5; color: var(--ink-muted);
}

/* Sections, banners and tabs */
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.section-header h2 { margin: 0; }
h3 { font-size: 1.05rem; margin: 0 0 0.75rem; }
.banner {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
    border-radius: var(--radius); padding: 0.65rem 1rem; margin-bottom: 1rem;
}
.banner-success { background: #e8f5e9; border: 1px solid #a5d6a7; }
.banner-error { background: #fdecea; border: 1px solid #f5b5ae; }
.banner-close { background: none; border: none; font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--ink-muted); }
.review {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    border-radius: var(--radius); padding: 0.85rem 1.25rem; margin-bottom: 1rem;
}
.review-due { background: #fff8e1; border: 1px solid #f3d27a; }
.review-ok { background: var(--surface); border: 1px solid var(--line); }
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tab {
    font: inherit; background: none; border: none; border-bottom: 3px solid transparent; cursor: pointer;
    padding: 0.6rem 0.9rem; color: var(--ink-muted); white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab-active { color: var(--esri-blue); border-bottom-color: var(--esri-blue); font-weight: 600; }
.tab-count { font-size: 0.8rem; color: var(--ink-muted); margin-left: 0.2rem; }
.tab:focus-visible { outline: 3px solid #8cc8ea; outline-offset: -3px; }

/* Forms */
.toolbar { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar input[type=search] { flex: 1; min-width: 220px; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
    font: inherit; color: var(--ink); background: var(--surface); width: 100%;
    border: 1px solid #b8c2cc; border-radius: 6px; padding: 0.45rem 0.6rem;
}
.toolbar select { width: auto; }
input:focus, select:focus, textarea:focus { outline: 3px solid #8cc8ea; outline-offset: 0; border-color: var(--esri-blue); }
input:disabled { background: #f0f2f4; color: var(--ink-muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem 1.25rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field-wide { grid-column: 1 / -1; }
.field-check { flex-direction: row; align-items: center; gap: 0.5rem; align-self: end; padding-bottom: 0.5rem; }
.field .hint { font-size: 0.8rem; color: var(--ink-muted); }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 1rem 0 0; }
.checks label { display: flex; align-items: center; gap: 0.4rem; }
.check-emphasis { font-weight: 600; color: var(--esri-blue-dark); }
.fieldset { border: 1px dashed #b8c2cc; border-radius: var(--radius); padding: 0.75rem 1rem 1rem; margin: 0 0 1.25rem; }
.fieldset legend { font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); padding: 0 0.4rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.subform { background: #f8fafb; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.button:disabled { opacity: 0.6; cursor: default; }
.button-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.button-danger { background: var(--danger); color: #fff; }
.link-danger { color: var(--danger); }
.actions { white-space: nowrap; text-align: right; }
.actions .button-link { margin-left: 0.75rem; }
.actions-col { width: 1%; }
.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.plain-list { margin: 0 0 0.75rem; padding-left: 1.1rem; }
.plain-list li { margin-bottom: 0.4rem; }
.spaced { margin-top: 1.25rem; }
.card.notice-warning { background: #fff8e1; border-color: #f3d27a; }

/* Change history */
.history { list-style: none; margin: 0; padding: 0; }
.history-entry { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.history-entry:last-child { border-bottom: none; }
.history-meta { display: flex; flex-direction: column; font-size: 0.85rem; }
.history-when { font-weight: 600; }
.history-who { color: var(--ink-muted); word-break: break-word; }
.history-changes { margin: 0.35rem 0 0; padding-left: 1.1rem; font-size: 0.9rem; }
.history-before { text-decoration: line-through; color: var(--ink-muted); }
.tag-added { background: #e8f5e9; color: var(--success); }
.tag-changed { background: #e8f3fa; color: var(--esri-blue-dark); }
.tag-removed { background: #fdecea; color: var(--danger); }

/* Requests */
.pre-wrap { white-space: pre-wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: none; }
.timeline-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.35rem; }
.reply { margin: 0.5rem 0 0; padding: 0.1rem 0 0.1rem 0.9rem; border-left: 3px solid var(--esri-blue); background: #f8fafb; }


/* A group of tick boxes inside a form field, under a caption that looks like the other labels */
.field .label { font-weight: 600; font-size: 0.9rem; }
.field .checks { margin: 0.25rem 0 0; }
.field .checks label { font-weight: 400; }

@media (max-width: 640px) {
    .topbar { flex-wrap: wrap; gap: 0.75rem; }
    .brand { gap: 0.6rem; }
    .brand-logo { height: 22px; }
    .brand-app { font-size: 0.95rem; padding-left: 0.6rem; }
    .account-name { display: none; }
    .details { grid-template-columns: 1fr; }
    .details dd { margin-bottom: 0.5rem; }
    .actions { white-space: normal; }
    .history-entry { grid-template-columns: 1fr; gap: 0.25rem; }
    .header-actions { justify-content: flex-start; }
}

/* GEP: statuses, credits and the printable kick-off record */
.badge-active { background: #e6f4ea; color: var(--gep-green); }
.badge-waiting { background: #e8f3fa; color: var(--esri-blue-dark); }
.badge-warning { background: #fff4e0; color: #8a5300; }
.credits { font-variant-numeric: tabular-nums; }
.waiting-for-you { border-left: 4px solid var(--esri-blue); }
.stakeholders td input { min-width: 140px; }
.print-only { display: none; }
.record { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; max-width: 820px; margin: 0 auto; }
.record h1 { text-align: center; }
.record-logo { display: block; margin: 0 auto 1rem; height: 36px; width: auto; }
.kickoff-record table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
.kickoff-record th, .kickoff-record td { border: 1px solid #9aa5b1; padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; overflow-wrap: break-word; }
.kickoff-record tbody th { width: 38%; font-weight: 600; background: #f4f6f8; }
.kickoff-record thead th { background: var(--esri-blue); color: #fff; }
.kickoff-record h3 { margin-top: 1rem; }
.kickoff-record .acceptance { border: 2px solid var(--gep-green); border-radius: var(--radius); padding: 0.75rem 1rem; }

@media print {
    .topbar, .footer, .no-print, #blazor-error-ui, .components-reconnect-show { display: none !important; }
    .print-only { display: block; }
    body, .content { background: #fff; padding: 0; margin: 0; max-width: none; }
    .record { border: none; padding: 0; max-width: none; }
    .kickoff-record thead th { background: #0079c1 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
a.program-card { display: block; text-decoration: none; color: inherit; }
a.program-card:hover { border-color: var(--esri-blue); }
a.program-card:focus-visible { outline: 3px solid #8cc8ea; outline-offset: 2px; }

/* Long addresses and names wrap instead of widening the page on a phone. */
.details dd, .card a[href^="mailto:"], .table td { overflow-wrap: anywhere; }

/* Credit dashboard: one series in one hue, recessive grid and axes, text in ink colours. */
.chart { margin: 0; }
.chart svg { width: 100%; height: 240px; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--ink-muted); font-size: 11px; }
.chart-reference { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-line { fill: none; stroke: var(--esri-blue); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--esri-blue); stroke: var(--surface); stroke-width: 2; }
.chart-hit { fill: transparent; cursor: default; }
.chart-point:hover .chart-dot { r: 6; }
.stat-alert { border-color: #f3d27a; background: #fff8e1; }
.table .num { white-space: nowrap; }
.ledger td:first-child, .ledger td:nth-child(2) { white-space: nowrap; }

/* Requests: documents, stacked choices, warnings */
.file-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.file-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; padding: 0.35rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.file-list li:last-child { border-bottom: none; }
.checks-stacked { flex-direction: column; gap: 0.5rem; }
fieldset.field { border: none; margin: 0; padding: 0; min-width: 0; }
.notice.notice-warning { background: #fff8e1; border-color: #f3d27a; }
.table td.nowrap, .nowrap { white-space: nowrap; overflow-wrap: normal; }

/* Estimates */
.estimate-version { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.estimate-version:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.estimate-lines input, .estimate-lines select { min-width: 110px; }
.estimate-lines td.num input { text-align: right; max-width: 120px; }
.table tfoot th { background: #fafbfc; color: var(--ink); }
.approval-figures { margin-bottom: 0.75rem; }
.stat-value.small-value { font-size: 1rem; }
.meter { height: 8px; background: #e3e8ee; border-radius: 4px; overflow: hidden; margin: 0.25rem 0 1rem; }
.meter span { display: block; height: 100%; background: var(--esri-blue); border-radius: 4px; }
details > summary { cursor: pointer; color: var(--esri-blue-dark); font-weight: 600; }
.row-attention td { background: #fff8e1; }

/* Staff dashboard (S-11) */
.dashboard-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--esri-blue); }
a.stat:focus-visible { outline: 3px solid #8cc8ea; outline-offset: 2px; }
.dashboard-tiles .stat-value { font-size: 1.5rem; }

/* One-page guides */
.guide h2 { font-size: 1.1rem; margin: 1.1rem 0 0.4rem; }
.guide ol, .guide ul { margin: 0 0 0.5rem; padding-left: 1.25rem; }
.guide li { margin-bottom: 0.3rem; }
@media print { .guide { font-size: 9.5pt; line-height: 1.35; } .guide h1 { font-size: 15pt; margin: 0.1rem 0; } .guide h2 { font-size: 11pt; margin: 0.6rem 0 0.2rem; } .guide li { margin-bottom: 0.15rem; } .guide p { margin: 0.2rem 0 0.4rem; } .guide .record-logo { height: 24px; margin-bottom: 0.3rem; } }
