.dgsch,
.dgsch-routes {
    --dgsch-ink: #1c2228;
    --dgsch-text: #3c464f;
    --dgsch-muted: #66717b;
    --dgsch-link: #2e4d69;
    --dgsch-rule: #e9edf0;
    --dgsch-rule-strong: #d7dde2;
    --dgsch-brand: #1c2228;
    color: var(--dgsch-text);
    margin: 1rem 0 2rem;
}

.dgsch [hidden] {
    display: none !important;
}

.dgsch-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem 1.5rem;
    border-bottom: 2px solid var(--dgsch-ink);
    padding-bottom: 0.6rem;
    margin-bottom: 0.9rem;
}

.dgsch-head h2 {
    margin: 0;
    color: var(--dgsch-ink);
}

.dgsch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dgsch-btn {
    display: inline-block;
    background: #fff;
    color: var(--dgsch-brand) !important;
    border: 1.5px solid var(--dgsch-brand);
    padding: 0.45rem 1.1rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.35;
    text-decoration: none !important;
    white-space: nowrap;
}

.dgsch-btn:hover {
    background: #f1f3f5;
}

.dgsch-btn-primary {
    background: var(--dgsch-brand);
    color: #fff !important;
}

.dgsch-btn-primary:hover {
    background: #3c464f;
    border-color: #3c464f;
}

.dgsch-btn span {
    font-weight: 400;
    opacity: 0.8;
}

.dgsch-intro {
    font-size: 1rem;
    margin: 0 0 1.25rem;
}

/* Filters */
.dgsch-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    background: #f6f8f9;
    border: 1px solid var(--dgsch-rule);
    border-radius: 8px;
    padding: 1rem 1.1rem;
    margin-bottom: 1.5rem;
}

.dgsch-f label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dgsch-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.dgsch-f input,
.dgsch-f select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.6rem;
    border: 1px solid #c9d0d6;
    border-radius: 5px;
    background: #fff;
    font-size: 0.95rem;
    color: var(--dgsch-ink);
    height: auto;
    margin: 0;
}

.dgsch-f input:focus,
.dgsch-f select:focus {
    outline: none;
    border-color: var(--dgsch-brand);
    box-shadow: 0 0 0 3px rgba(28, 34, 40, 0.15);
}

.dgsch-bar {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.dgsch-view {
    display: inline-flex;
    border: 1px solid #c9d0d6;
    border-radius: 5px;
    overflow: hidden;
}

.dgsch-view button,
.dgsch-clear {
    background: #fff;
    border: 0;
    padding: 0.45rem 0.9rem;
    font-size: 0.9rem;
    color: var(--dgsch-text);
    cursor: pointer;
    line-height: 1.3;
    margin: 0;
}

.dgsch-view button + button {
    border-left: 1px solid #c9d0d6;
}

.dgsch-view button[aria-pressed="true"] {
    background: var(--dgsch-brand);
    color: #fff;
    font-weight: 600;
}

.dgsch-count {
    margin: 0 auto 0 0;
    font-size: 0.9rem;
    color: var(--dgsch-muted);
}

.dgsch-clear {
    border: 1px solid #c9d0d6;
    border-radius: 5px;
}

.dgsch-clear:hover,
.dgsch-view button[aria-pressed="false"]:hover {
    background: #f1f3f5;
}

/* Results */
.dgsch-market > h3 {
    color: var(--dgsch-ink);
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--dgsch-ink);
}

.dgsch-market:first-child > h3 {
    margin-top: 0;
}

.dgsch-jur h4 {
    color: var(--dgsch-ink);
    margin: 1.4rem 0 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--dgsch-rule-strong);
}

.dgsch-area {
    margin-bottom: 1rem;
}

.dgsch-area-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1rem;
    flex-wrap: wrap;
    margin: 0 0 0.2rem;
}

.dgsch-area h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dgsch-text);
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
}

.dgsch-submit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dgsch-ink) !important;
    text-decoration: none !important;
    white-space: nowrap;
}

.dgsch-submit:hover {
    text-decoration: underline !important;
}

/* "Submissions for these rankings are due ..." bar */
.dgsch-due {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 1rem;
    background: #f6f8f9;
    border-left: 4px solid var(--dgsch-brand);
    border-radius: 0 6px 6px 0;
    padding: 0.8rem 1rem;
    margin: -0.5rem 0 1.5rem;
    font-size: 0.98rem;
    color: var(--dgsch-ink);
}

.dgsch-due p {
    margin: 0;
}

/* Submission routes ([dg_submission_routes]) */
.dgsch-routes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.75rem;
}

.dgsch-route {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid var(--dgsch-rule-strong);
    border-top: 3px solid var(--dgsch-brand);
    border-radius: 6px;
    padding: 1rem 1.1rem 1.1rem;
    background: #fff;
}

.dgsch-route h3 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
    color: var(--dgsch-ink);
}

.dgsch-route p {
    font-size: 0.93rem;
    color: var(--dgsch-text);
    margin: 0 0 1rem;
    flex: 1;
}

@media (max-width: 760px) {
    .dgsch-routes {
        grid-template-columns: 1fr;
    }
}

.dgsch-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    border: 0;
    font-size: 0.93rem;
}

.dgsch-table th,
.dgsch-table td {
    text-align: left;
    padding: 0.45rem 0.75rem 0.45rem 0;
    border: 0;
    border-bottom: 1px solid var(--dgsch-rule);
    vertical-align: top;
    background: none;
}

.dgsch-table th {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--dgsch-muted);
    padding-top: 0.2rem;
}

.dgsch-by-jurisdiction .dgsch-table th:nth-child(1) { width: 46%; }
.dgsch-by-jurisdiction .dgsch-table th:nth-child(2) { width: 14%; }
.dgsch-by-jurisdiction .dgsch-table th:nth-child(3) { width: 16%; }
.dgsch-by-jurisdiction .dgsch-table th:nth-child(4) { width: 13%; }

.dgsch-table a {
    color: var(--dgsch-link);
    text-decoration: none;
}

.dgsch-table a:hover {
    text-decoration: underline;
}

.dgsch-table small {
    display: block;
    font-size: 0.72rem;
    color: var(--dgsch-muted);
    margin-top: 0.15rem;
}

.dgsch-by-month .dgsch-table small {
    display: inline;
}

.dgsch-ed {
    font-size: 0.8rem;
    color: var(--dgsch-muted);
}

.dgsch-month {
    margin-bottom: 2rem;
}

.dgsch-month h3 {
    margin: 0 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--dgsch-ink);
    font-size: 1.3rem;
}

.dgsch-month h3 .dgsch-pill {
    font-size: 1rem;
    padding: 0.25rem 0.7rem;
}

.dgsch-month h3 small {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--dgsch-muted);
    margin-left: 0.5rem;
}

.dgsch-empty {
    padding: 1.5rem;
    text-align: center;
    background: #f6f8f9;
    border-radius: 8px;
    color: var(--dgsch-muted);
}

/* Month pills (same colours as the PDF schedule) */
.dgsch-pill {
    display: inline-block;
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.3;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    white-space: nowrap;
}

.dgsch-m01 { background: #e4ecf4; color: #2e4d69; }
.dgsch-m02 { background: #e1eee5; color: #2b5b43; }
.dgsch-m03 { background: #f5eeda; color: #6a5218; }
.dgsch-m04 { background: #f4e5e3; color: #7c3b35; }
.dgsch-m05 { background: #eae5f2; color: #4d3c74; }
.dgsch-m06 { background: #ddefef; color: #215b60; }
.dgsch-m07 { background: #f0e8df; color: #6b4826; }
.dgsch-m08 { background: #f4e4ec; color: #7a3557; }
.dgsch-m09 { background: #e8eef0; color: #36505a; }
.dgsch-m10 { background: #efece2; color: #58502e; }
.dgsch-m11 { background: #e6e6e6; color: #3a3f44; }
.dgsch-m12 { background: #e9e4ee; color: #4a3f5c; }

/* Narrow screens: filters stack, tables become cards */
@media (max-width: 760px) {
    .dgsch-filters {
        grid-template-columns: 1fr 1fr;
    }

    .dgsch-f-q {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .dgsch-filters {
        grid-template-columns: 1fr;
    }

    .dgsch-table thead {
        display: none;
    }

    .dgsch-table tr {
        display: block;
        padding: 0.55rem 0;
        border-bottom: 1px solid var(--dgsch-rule);
    }

    .dgsch-table td {
        display: flex;
        gap: 0.75rem;
        padding: 0.12rem 0;
        border: 0;
    }

    .dgsch-table td::before {
        content: attr(data-label);
        flex: 0 0 7.5rem;
        font-size: 0.75rem;
        color: var(--dgsch-muted);
        padding-top: 0.1rem;
    }

    .dgsch-table td:first-child {
        display: block;
        font-weight: 600;
        padding-bottom: 0.25rem;
    }

    .dgsch-table td:first-child::before {
        display: none;
    }

    .dgsch-table small {
        display: inline;
        margin-left: 0.35rem;
    }
}
