/* CS-Shepard: GOV.UK-inspired minimal design */

/* ========== Reset & Base ========== */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "GDS Transport", Arial, Helvetica, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: #0b0c0c;
    background-color: #f3f2f1;
}

.govuk-body {
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: #1d70b8;
    text-decoration: underline;
}

a:hover {
    color: #003078;
}

a:focus {
    outline: 3px solid #ffdd00;
    outline-offset: 0;
    background-color: #ffdd00;
    color: #0b0c0c;
    text-decoration: none;
}

/* ========== Layout ========== */
.govuk-width-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
}

.govuk-main-wrapper {
    padding: 15px 0 30px;
}

/* ========== Header ========== */
.govuk-header {
    background-color: #0b0c0c;
    border-bottom: 10px solid #1d70b8;
    padding: 8px 0;
}

.govuk-header__container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.govuk-header__content {
    display: flex;
    align-items: center;
    gap: 30px;
    width: 100%;
}

.govuk-header__link {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    padding: 5px 0;
}

.govuk-header__link:hover {
    text-decoration: underline;
    color: #ffffff;
}

.govuk-header__link:focus {
    color: #0b0c0c;
}

.govuk-header__link--service-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.govuk-header__nav {
    display: flex;
    gap: 20px;
    margin-left: auto;
}

/* ========== Phase Banner ========== */
.govuk-phase-banner {
    border-bottom: 1px solid #b1b4b6;
    padding: 8px 0;
    background-color: #ffffff;
}

.govuk-phase-banner__content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
    font-size: 13px;
    color: #505a5f;
}

.govuk-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
    background-color: #1d70b8;
    border-radius: 0;
}

.govuk-tag--orange {
    background-color: #f47738;
}

.govuk-tag--green {
    background-color: #00703c;
}

.govuk-tag--red {
    background-color: #d4351c;
}

.govuk-tag--grey {
    background-color: #505a5f;
}

/* ========== Footer ========== */
.govuk-footer {
    background-color: #f3f2f1;
    border-top: 1px solid #b1b4b6;
    padding: 20px 0;
    margin-top: 30px;
}

.govuk-footer__meta {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.govuk-footer__links {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.govuk-footer__link {
    font-size: 14px;
    color: #1d70b8;
    text-decoration: underline;
}

.govuk-footer__link:hover {
    color: #003078;
}

.govuk-footer__text {
    font-size: 12px;
    color: #505a5f;
}

/* ========== Typography ========== */
.govuk-heading-xl {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 20px;
    line-height: 1.2;
}

.govuk-heading-l {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 15px;
    line-height: 1.25;
}

.govuk-heading-m {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.3;
}

.govuk-heading-s {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
}

.govuk-body-l {
    font-size: 19px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.govuk-body-s {
    font-size: 14px;
    color: #505a5f;
}

/* ========== Buttons ========== */
.govuk-button {
    display: inline-block;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    background-color: #00703c;
    border: 2px solid transparent;
    border-bottom: 3px solid #002d18;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}

.govuk-button:hover {
    background-color: #005a30;
    color: #ffffff;
}

.govuk-button:focus {
    outline: 3px solid #ffdd00;
    outline-offset: 0;
    background-color: #ffdd00;
    color: #0b0c0c;
    border-color: #0b0c0c;
}

.govuk-button--secondary {
    background-color: #f3f2f1;
    color: #0b0c0c;
    border-bottom-color: #929191;
}

.govuk-button--secondary:hover {
    background-color: #dbdad9;
    color: #0b0c0c;
}

.govuk-button--warning {
    background-color: #d4351c;
    border-bottom-color: #6e1609;
}

.govuk-button--warning:hover {
    background-color: #aa2a16;
}

.govuk-button--small {
    font-size: 14px;
    padding: 5px 10px;
}

.govuk-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Form Elements ========== */
.govuk-form-group {
    margin-bottom: 20px;
}

.govuk-label {
    display: block;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
}

.govuk-hint {
    font-size: 14px;
    color: #505a5f;
    margin-bottom: 8px;
}

.govuk-input,
.govuk-textarea,
.govuk-select {
    font-family: inherit;
    font-size: 16px;
    padding: 8px;
    border: 2px solid #0b0c0c;
    border-radius: 0;
    width: 100%;
    background-color: #ffffff;
}

.govuk-input:focus,
.govuk-textarea:focus,
.govuk-select:focus {
    outline: 3px solid #ffdd00;
    outline-offset: 0;
    border-color: #0b0c0c;
}

.govuk-textarea {
    resize: vertical;
    min-height: 100px;
}

.govuk-radios__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
}

.govuk-radios__input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
}

.govuk-radios__label {
    font-weight: 700;
}

.govuk-radios__hint {
    font-size: 14px;
    color: #505a5f;
    margin-top: 2px;
}

/* ========== Cards & Panels ========== */
.govuk-panel {
    background-color: #ffffff;
    border: 1px solid #b1b4b6;
    padding: 20px;
    margin-bottom: 20px;
}

.govuk-panel--confirmation {
    background-color: #00703c;
    color: #ffffff;
    text-align: center;
}

.govuk-inset-text {
    border-left: 5px solid #b1b4b6;
    padding: 15px 20px;
    margin: 15px 0;
}

/* ========== Status Indicators ========== */
.status-panel {
    background-color: #ffffff;
    border: 1px solid #b1b4b6;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot--ok { background-color: #00703c; }
.status-dot--error { background-color: #d4351c; }
.status-dot--warning { background-color: #f47738; }

/* ========== Workspace (Chat Container) ========== */
.shepard-workspace {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 500px;
    background-color: #ffffff;
    border: 1px solid #dee0e2;
}

/* ---- Toolbar ---- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid #dee0e2;
    background-color: #f8f8f8;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 44px;
}

.toolbar__left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar__role {
    font-size: 14px;
    font-weight: 700;
    color: #0b0c0c;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar__right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.toolbar__select {
    font-family: inherit;
    font-size: 12px;
    padding: 3px 6px;
    border: 1px solid #b1b4b6;
    border-radius: 0;
    background-color: #ffffff;
    color: #0b0c0c;
    cursor: pointer;
    max-width: 160px;
}

.toolbar__select:focus {
    outline: 2px solid #ffdd00;
    border-color: #0b0c0c;
}

.toolbar__btn {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border: 1px solid #b1b4b6;
    background-color: #ffffff;
    color: #0b0c0c;
    cursor: pointer;
    border-radius: 0;
}

.toolbar__btn:hover {
    background-color: #f3f2f1;
}

.toolbar__btn:focus {
    outline: 2px solid #ffdd00;
}

/* ---- Conversation ---- */
.conversation {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ---- Welcome ---- */
.welcome {
    text-align: center;
    padding: 40px 20px;
    color: #505a5f;
}

.welcome__heading {
    font-size: 20px;
    font-weight: 700;
    color: #0b0c0c;
    margin: 0 0 8px;
}

.welcome__text {
    font-size: 15px;
    margin: 0 0 12px;
    line-height: 1.5;
}

.welcome__hint {
    font-size: 13px;
    color: #505a5f;
    margin: 0;
}

/* ---- Mode chips ---- */
.mode-chip {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border: 1px solid #b1b4b6;
    background-color: #ffffff;
    color: #505a5f;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.15s;
}

.mode-chip:hover {
    border-color: #0b0c0c;
    color: #0b0c0c;
}

.mode-chip--active {
    border-color: #1d70b8;
    color: #1d70b8;
    background-color: #f0f4f8;
}

.mode-chip:focus {
    outline: 2px solid #ffdd00;
}

/* ---- Exchange (Q&A pair) ---- */
.exchange {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.exchange__query {
    font-size: 15px;
    font-weight: 600;
    color: #0b0c0c;
    padding: 10px 14px;
    background-color: #f0f4f8;
    border-left: 3px solid #1d70b8;
}

.exchange__response {
    border: 1px solid #dee0e2;
    border-top: none;
}

/* ---- Perspective Tabs ---- */
.perspective-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #dee0e2;
    background-color: #f8f8f8;
    overflow-x: auto;
    scrollbar-width: thin;
}

.perspective-tab {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    border: none;
    border-bottom: 3px solid transparent;
    background: none;
    color: #505a5f;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.perspective-tab:hover {
    color: #0b0c0c;
    background-color: #f0f0f0;
}

.perspective-tab--active {
    color: #1d70b8;
    border-bottom-color: #1d70b8;
    background-color: #ffffff;
}

.perspective-tab__label {
    font-weight: 400;
    font-size: 11px;
    color: #505a5f;
    margin-left: 4px;
}

.perspective-tab--active .perspective-tab__label {
    color: #1d70b8;
}

.perspective-tab--action {
    color: #00703c;
    font-weight: 700;
}

.perspective-tab--action.perspective-tab--active {
    color: #00703c;
    border-bottom-color: #00703c;
}

.perspective-tab--subtle {
    margin-left: auto;
    font-weight: 400;
}

.perspective-tab__count {
    display: inline-block;
    font-size: 10px;
    background-color: #b1b4b6;
    color: #ffffff;
    padding: 0 5px;
    border-radius: 8px;
    margin-left: 2px;
    font-weight: 700;
}

/* ---- Perspective Views ---- */
.perspective-view {
    display: none;
    padding: 16px 18px;
}

.perspective-view--active {
    display: block;
}

.perspective-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f2f1;
}

.perspective-header strong {
    font-size: 14px;
}

.perspective-trigger {
    font-size: 12px;
    color: #505a5f;
    font-style: italic;
}

/* ---- Response Content ---- */
.response-content {
    font-size: 15px;
    line-height: 1.65;
    color: #0b0c0c;
}

.response-content p {
    margin: 0 0 10px;
}

.response-content ul,
.response-content ol {
    margin: 0 0 10px;
    padding-left: 24px;
}

.response-content strong {
    font-weight: 700;
}

/* Markdown rendered output — GOV.UK consistent */
.response-content .md-h2 {
    font-size: 17px;
    font-weight: 700;
    color: #0b0c0c;
    margin: 18px 0 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #1d70b8;
}

.response-content .md-h2:first-child {
    margin-top: 0;
}

.response-content .md-h3 {
    font-size: 15px;
    font-weight: 700;
    color: #0b0c0c;
    margin: 14px 0 6px;
}

.response-content .md-h4 {
    font-size: 14px;
    font-weight: 700;
    color: #505a5f;
    margin: 10px 0 4px;
}

.response-content .md-p {
    margin: 0 0 10px;
    line-height: 1.65;
}

.response-content .md-list {
    margin: 8px 0 12px;
    padding-left: 24px;
}

.response-content .md-list li {
    margin-bottom: 4px;
    line-height: 1.55;
}

.response-content .md-list li strong {
    color: #0b0c0c;
}

/* ---- Blockquote (citation excerpts) ---- */
.response-content .md-quote {
    border-left: 3px solid #b1b4b6;
    margin: 4px 0 10px 8px;
    padding: 4px 0 4px 12px;
    font-size: 13px;
    font-style: italic;
    color: #505a5f;
    line-height: 1.5;
}

/* ---- Citation Links (inline in responses) ---- */
.response-content .citation-link {
    color: #1d70b8;
    text-decoration: underline;
    font-weight: 600;
    font-size: 13px;
}

.response-content .citation-link:hover {
    color: #003078;
}

.response-content .citation-link:focus {
    outline: 3px solid #ffdd00;
    outline-offset: 0;
    background-color: #ffdd00;
    color: #0b0c0c;
    text-decoration: none;
}

/* ---- Inline source badges ---- */
.source-badge {
    display: inline-block;
    background: #1d70b8;
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    margin: 0 1px;
    cursor: default;
    vertical-align: super;
    line-height: 1;
}
.source-badge:hover {
    background: #003078;
}

/* ---- Action Plan ---- */
.action-plan {
    border-left: 4px solid #00703c;
    padding-left: 16px;
}

.action-plan .md-list {
    padding-left: 20px;
    margin: 4px 0;
}

.action-plan .md-list li {
    margin-bottom: 8px;
    line-height: 1.6;
    padding-left: 4px;
}

/* ---- Pathway Diagram ---- */
.pathway-view {
    padding: 12px 0;
}

.pathway-diagram {
    display: flex;
    justify-content: center;
    padding: 16px 8px;
    background: #fff;
    border: 1px solid #b1b4b6;
    border-radius: 4px;
    overflow-x: auto;
}

.pathway-diagram svg {
    max-width: 100%;
    height: auto;
}

.perspective-tab--pathway {
    border-bottom-color: #00703c !important;
}

.perspective-tab--pathway.perspective-tab--active {
    background: #00703c;
    color: #fff;
}


/* ---- Source Index Table ---- */
.source-index {
    margin-top: 1.5em;
    border-top: 2px solid #1d70b8;
    padding-top: 0.75em;
}
.si-heading {
    font-size: 1.1em;
    font-weight: 700;
    color: #0b0c0c;
    margin: 0 0 0.5em 0;
}
.si-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    line-height: 1.4;
}
.si-table thead {
    background: #f3f2f1;
}
.si-table th {
    text-align: left;
    padding: 6px 10px;
    font-weight: 700;
    color: #505a5f;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #b1b4b6;
}
.si-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #d8d8d8;
    vertical-align: top;
}
.si-table tr:hover {
    background: #f8f8f8;
}
.si-num {
    font-weight: 700;
    color: #1d70b8;
    white-space: nowrap;
    width: 2em;
}
.si-doc a {
    color: #1d70b8;
    text-decoration: underline;
}
.si-doc a:hover {
    color: #003078;
}
.si-page {
    white-space: nowrap;
    color: #505a5f;
    width: 3em;
}
.si-sec {
    color: #505a5f;
    font-style: italic;
}

/* ---- Sources ---- */
.source-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid #f3f2f1;
    font-size: 13px;
}

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

.source-row__doc {
    font-weight: 600;
    color: #0b0c0c;
}

.source-row__link {
    font-weight: 600;
    color: #1d70b8;
    text-decoration: underline;
}

.source-row__link:hover {
    color: #003078;
}

.source-row__link:focus {
    outline: 3px solid #ffdd00;
    outline-offset: 0;
    background-color: #ffdd00;
    color: #0b0c0c;
    text-decoration: none;
}

.source-row__ref {
    color: #505a5f;
    font-size: 12px;
    white-space: nowrap;
    margin-left: 12px;
}

/* ---- Exchange Actions ---- */
.exchange__actions {
    display: flex;
    gap: 0;
    border-top: 1px solid #f3f2f1;
}

.exchange__actions button {
    font-family: inherit;
    font-size: 11px;
    padding: 6px 14px;
    border: none;
    border-right: 1px solid #f3f2f1;
    background: none;
    color: #505a5f;
    cursor: pointer;
}

.exchange__actions button:hover {
    color: #0b0c0c;
    background-color: #f8f8f8;
}

.exchange__actions button:focus {
    outline: 2px solid #ffdd00;
}

/* ---- Input Area ---- */
.input-area {
    border-top: 1px solid #dee0e2;
    padding: 10px 16px 12px;
    background-color: #f8f8f8;
}

.input-area__controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.input-area__modes {
    display: flex;
    gap: 6px;
}

/* ---- Depth Selector ---- */
.depth-selector {
    display: flex;
    gap: 0;
    border: 1px solid #b1b4b6;
    background-color: #ffffff;
}

.depth-chip {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border: none;
    border-right: 1px solid #b1b4b6;
    background: none;
    color: #505a5f;
    cursor: pointer;
    transition: all 0.15s;
}

.depth-chip:last-child {
    border-right: none;
}

.depth-chip:hover {
    background-color: #f3f2f1;
    color: #0b0c0c;
}

.depth-chip--active {
    background-color: #1d70b8;
    color: #ffffff;
}

.depth-chip--active:hover {
    background-color: #003078;
    color: #ffffff;
}

.depth-chip:focus {
    outline: 2px solid #ffdd00;
    z-index: 1;
}

.input-area__row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.input-area__field {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.input-area__textarea {
    flex: 1;
    font-family: inherit;
    font-size: 15px;
    padding: 10px 40px 10px 12px;
    border: 1px solid #b1b4b6;
    border-radius: 0;
    resize: none;
    min-height: 44px;
    max-height: 140px;
    line-height: 1.4;
    background-color: #ffffff;
}

.input-area__textarea:focus {
    outline: 2px solid #ffdd00;
    border-color: #0b0c0c;
}

.input-area__textarea::placeholder {
    color: #b1b4b6;
}

.input-area__upload {
    position: absolute;
    right: 8px;
    bottom: 10px;
    cursor: pointer;
    color: #505a5f;
    display: flex;
    align-items: center;
    padding: 2px;
}

.input-area__upload:hover {
    color: #1d70b8;
}

.input-area__upload input[type="file"] {
    display: none;
}

.input-area__send {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: #1d70b8;
    color: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
}

.input-area__send:hover {
    background-color: #003078;
}

.input-area__send:focus {
    outline: 3px solid #ffdd00;
}

.input-area__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- File Indicator ---- */
.file-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    margin-top: 4px;
}

.file-indicator__name {
    font-size: 12px;
    color: #1d70b8;
    font-weight: 600;
    background-color: #f0f4f8;
    padding: 2px 8px;
    border: 1px solid #1d70b8;
}

.file-indicator__remove {
    font-size: 14px;
    border: none;
    background: none;
    color: #505a5f;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.file-indicator__remove:hover {
    color: #d4351c;
}

.input-area__session-actions {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 6px;
}

/* ---- Gherkin Template ---- */
.gherkin-template {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.gherkin-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gherkin-keyword {
    font-family: "Courier New", monospace;
    font-weight: 700;
    font-size: 13px;
    color: #1d70b8;
    width: 48px;
    text-align: right;
    flex-shrink: 0;
}

.gherkin-input {
    flex: 1;
    font-family: inherit;
    font-size: 14px;
    padding: 6px 10px;
    border: 1px solid #b1b4b6;
    border-radius: 0;
    background-color: #ffffff;
}

.gherkin-input:focus {
    outline: 2px solid #ffdd00;
    border-color: #0b0c0c;
}

.gherkin-input::placeholder {
    color: #b1b4b6;
    font-style: italic;
}

/* ========== Loading ========== */
.loading-indicator {
    display: none;
    padding: 20px;
    text-align: center;
}

.loading-indicator.active {
    display: block;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #dee0e2;
    border-top-color: #1d70b8;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-text {
    margin-top: 6px;
    font-size: 13px;
    color: #505a5f;
}

/* Translation Progress Bar */
.translation-progress {
    max-width: 360px;
    margin: 0 auto;
    text-align: left;
}

.translation-progress__status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    color: #0b0c0c;
}

.translation-progress__step {
    font-size: 12px;
    color: #505a5f;
    font-weight: 400;
}

.translation-progress__bar {
    width: 100%;
    height: 8px;
    background: #dee0e2;
    border-radius: 4px;
    overflow: hidden;
}

.translation-progress__fill {
    height: 100%;
    background: #1d70b8;
    border-radius: 4px;
    transition: width 0.3s ease;
    min-width: 2%;
}

/* ========== Admin ========== */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

.document-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.document-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f3f2f1;
}

.document-item__info {
    flex: 1;
}

.document-item__name {
    font-weight: 700;
    font-size: 15px;
}

.document-item__meta {
    font-size: 13px;
    color: #505a5f;
}

.document-item__actions {
    display: flex;
    gap: 5px;
}

.upload-area {
    border: 2px dashed #b1b4b6;
    padding: 30px;
    text-align: center;
    background-color: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #1d70b8;
    background-color: #f0f4f8;
}

.upload-area input[type="file"] {
    display: none;
}

/* ========== Role Selection ========== */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.role-card {
    background-color: #ffffff;
    border: 2px solid #b1b4b6;
    padding: 15px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.role-card:hover {
    border-color: #1d70b8;
}

.role-card.selected {
    border-color: #1d70b8;
    background-color: #f0f4f8;
    box-shadow: inset 0 0 0 2px #1d70b8;
}

.role-card__title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 5px;
}

.role-card__description {
    font-size: 13px;
    color: #505a5f;
    line-height: 1.4;
}

/* ========== Details/Summary ========== */
.govuk-details {
    margin: 10px 0;
}

.govuk-details__summary {
    cursor: pointer;
    color: #1d70b8;
    font-size: 14px;
    padding: 5px 0;
}

.govuk-details__summary:focus {
    outline: 3px solid #ffdd00;
    background-color: #ffdd00;
}

.govuk-details__text {
    padding: 10px 0 10px 20px;
    font-size: 14px;
}

/* ========== Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #ffffff;
    border: 1px solid #dee0e2;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 25px;
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal__close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    color: #505a5f;
}

.modal__close:hover {
    color: #0b0c0c;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 18px;
    background-color: #0b0c0c;
    color: #ffffff;
    font-size: 13px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s, transform 0.25s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast--error {
    background-color: #d4351c;
}

/* ========== About Page ========== */
.about-codename {
    font-size: 24px;
    font-weight: 400;
    color: #505a5f;
}

.about-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #b1b4b6;
}

.about-section:last-child {
    border-bottom: none;
}

.about-principles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.about-principle {
    background: #f3f2f1;
    padding: 20px;
    border-left: 4px solid #1d70b8;
}

.about-principle h3 {
    margin-bottom: 8px;
}

.about-principle p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* Pipeline diagram */
.about-pipeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 20px 0;
    position: relative;
}

.pipeline-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    position: relative;
}

.pipeline-step:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 17px;
    top: 48px;
    bottom: -16px;
    width: 2px;
    background: #b1b4b6;
}

.pipeline-step__number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1d70b8;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.pipeline-step__content {
    flex: 1;
}

.pipeline-step__content strong {
    font-size: 16px;
    display: block;
    margin-bottom: 4px;
}

.pipeline-step__content p {
    font-size: 14px;
    color: #505a5f;
    line-height: 1.5;
    margin: 0;
}

/* Tables */
.govuk-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.govuk-table__head {
    background: #f3f2f1;
}

.govuk-table__header {
    text-align: left;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 2px solid #505a5f;
}

.govuk-table__cell {
    padding: 10px 15px;
    font-size: 14px;
    border-bottom: 1px solid #b1b4b6;
    vertical-align: top;
    line-height: 1.5;
}

.about-table--compact .govuk-table__cell:first-child {
    width: 180px;
    white-space: nowrap;
}

/* Role chips */
.about-role-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
}

.about-role-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f2f1;
    border: 1px solid #b1b4b6;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
}

.about-role-chip--nolan {
    background: #fef7e5;
    border-color: #ffdd00;
}

.about-role-chip__short {
    font-weight: 700;
    font-size: 11px;
    color: #1d70b8;
    min-width: 40px;
}

.about-role-chip--nolan .about-role-chip__short {
    color: #594d00;
}

.about-role-chip__title {
    color: #0b0c0c;
}

/* Speed tips */
.about-speed-tips {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 15px;
}

.speed-tip {
    background: #f3f2f1;
    padding: 20px;
    border-left: 4px solid #00703c;
}

.speed-tip h3 {
    margin-bottom: 8px;
}

.speed-tip p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 8px 0;
}

.speed-tip p:last-child {
    margin-bottom: 0;
}

.about-code {
    background: #0b0c0c;
    color: #00ff41;
    padding: 12px 16px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    margin: 8px 0;
}

.about-code code {
    color: inherit;
    background: none;
}

/* Guidance Weight Chart */
.guidance-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 20px 0;
}

.guidance-chart__row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 28px;
}

.guidance-chart__label {
    flex-shrink: 0;
    width: 260px;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    color: #0b0c0c;
    line-height: 1.3;
}

.guidance-chart__bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.guidance-chart__bar {
    height: 24px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    transition: width 0.4s ease;
    min-width: 4px;
}

.guidance-chart__value {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.guidance-chart__value--inside {
    color: #ffffff;
}

.guidance-chart__value--outside {
    color: #505a5f;
    font-size: 12px;
}

/* ========== Analytics Dashboard ========== */

.analytics-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.analytics-filters__label {
    font-weight: 700;
    font-size: 14px;
    color: #505a5f;
}

.analytics-filters__btn {
    display: inline-block;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid #b1b4b6;
    border-radius: 4px;
    color: #0b0c0c;
    background: #fff;
    transition: background 0.15s, border-color 0.15s;
}

.analytics-filters__btn:hover {
    background: #f3f2f1;
    border-color: #505a5f;
    color: #0b0c0c;
}

.analytics-filters__btn--active {
    background: #1d70b8;
    border-color: #1d70b8;
    color: #fff;
}

.analytics-filters__btn--active:hover {
    background: #003078;
    border-color: #003078;
    color: #fff;
}

.analytics-filters__btn--export {
    border-color: #00703c;
    color: #00703c;
}

.analytics-filters__btn--export:hover {
    background: #00703c;
    color: #fff;
}

.analytics-filters__spacer {
    flex: 1;
}

.analytics-section {
    margin-bottom: 40px;
}

.analytics-section--half {
    flex: 1;
    min-width: 280px;
}

.analytics-two-col {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 10px;
}

.summary-card {
    background: #fff;
    border: 1px solid #b1b4b6;
    border-top: 4px solid #1d70b8;
    padding: 16px;
    text-align: center;
    border-radius: 0 0 4px 4px;
}

.summary-card__number {
    font-size: 32px;
    font-weight: 700;
    color: #0b0c0c;
    line-height: 1.1;
}

.summary-card__label {
    font-size: 13px;
    color: #505a5f;
    margin-top: 4px;
}

/* Analytics Charts (reuse guidance-chart pattern) */
.analytics-chart {
    background: #fff;
    border: 1px solid #b1b4b6;
    border-radius: 4px;
    padding: 12px 16px;
}

.analytics-chart__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.analytics-chart__label {
    width: 100px;
    font-size: 13px;
    font-weight: 600;
    color: #0b0c0c;
    text-align: right;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-chart__label--wide {
    width: 200px;
}

.analytics-chart__bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 24px;
}

.analytics-chart__bar {
    height: 100%;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    min-width: 2px;
    transition: width 0.3s ease;
}

.analytics-chart__bar--blue { background: #1d70b8; }
.analytics-chart__bar--green { background: #00703c; }
.analytics-chart__bar--purple { background: #4c2c92; }
.analytics-chart__bar--orange { background: #f47738; }

.analytics-chart__value--inside {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.analytics-chart__value--outside {
    color: #0b0c0c;
    font-size: 12px;
    font-weight: 700;
}

/* Gap badges */
.gap-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 3px;
    text-transform: uppercase;
}

.gap-badge--high {
    background: #d4351c;
    color: #fff;
}

.gap-badge--medium {
    background: #f47738;
    color: #fff;
}

/* Analytics digest */
.analytics-digest {
    background: #fff;
    border: 1px solid #b1b4b6;
    border-left: 5px solid #1d70b8;
    padding: 15px;
    margin-top: 12px;
    line-height: 1.6;
}

/* Empty state */
.analytics-empty {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid #b1b4b6;
    border-radius: 4px;
}

/* ========== Scope Filter ========== */

.scope-filter {
    border-bottom: 1px solid #dee0e2;
    background-color: #fafafa;
}

.scope-filter__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #505a5f;
    list-style: none;
    user-select: none;
}

.scope-filter__toggle::-webkit-details-marker {
    display: none;
}

.scope-filter__toggle::before {
    content: "+";
    font-weight: 700;
    font-size: 14px;
    color: #1d70b8;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.scope-filter[open] .scope-filter__toggle::before {
    content: "\2212";
}

.scope-filter__label {
    font-weight: 700;
    color: #0b0c0c;
}

.scope-filter__summary {
    color: #505a5f;
}

.scope-filter__panel {
    padding: 8px 16px 12px;
    border-top: 1px solid #dee0e2;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.scope-filter__actions {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.scope-filter__action-btn {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border: 1px solid #b1b4b6;
    background: #fff;
    color: #505a5f;
    cursor: pointer;
}

.scope-filter__action-btn:hover {
    background: #f3f2f1;
    color: #0b0c0c;
}

.scope-filter__category {
    margin-bottom: 2px;
}

.scope-filter__category-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 0;
}

.scope-filter__category-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    flex-shrink: 0;
    accent-color: #1d70b8;
}

.scope-filter__count {
    font-weight: 400;
    color: #505a5f;
    font-size: 12px;
}

.scope-filter__docs {
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.scope-filter__doc {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #0b0c0c;
    cursor: pointer;
    padding: 1px 0;
    line-height: 1.4;
}

.scope-filter__doc input[type="checkbox"] {
    width: 13px;
    height: 13px;
    margin: 0;
    flex-shrink: 0;
    accent-color: #1d70b8;
}

.scope-filter__chunks {
    color: #b1b4b6;
    font-size: 11px;
    white-space: nowrap;
    margin-left: auto;
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
    .govuk-heading-xl { font-size: 28px; }
    .govuk-heading-l { font-size: 22px; }
    .toolbar { flex-direction: column; align-items: flex-start; }
    .toolbar__right { width: 100%; overflow-x: auto; }
    .perspective-tabs { overflow-x: auto; }
    .role-grid { grid-template-columns: 1fr; }
    .source-row { flex-direction: column; gap: 2px; }
    .about-principles { grid-template-columns: 1fr; }
    .about-table--compact .govuk-table__cell:first-child { width: auto; white-space: normal; }
    .about-codename { display: block; font-size: 18px; }
    .pipeline-step__number { width: 28px; height: 28px; font-size: 13px; }
    .pipeline-step:not(:last-child)::after { left: 13px; top: 40px; }
    .guidance-chart__row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .guidance-chart__label { width: auto; text-align: left; font-size: 12px; }
    .guidance-chart__bar-container { width: 100%; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .analytics-two-col { flex-direction: column; }
    .analytics-chart__label { width: 70px; font-size: 11px; }
    .analytics-chart__label--wide { width: 120px; }
    .analytics-filters { gap: 4px; }
    .analytics-filters__btn { padding: 4px 10px; font-size: 12px; }
    .scope-filter__panel { max-height: 200px; }
    .scope-filter__doc { font-size: 11px; }
}
