/* Index.cshtml */

#district-app {
        max-width: 1100px;
        margin: 0 auto;
        padding: 20px 16px;
    }

    .district-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
        gap: 16px;
        flex-wrap: wrap;
    }

    .district-heading {
        display: flex;
        align-items: baseline;
        flex-wrap: wrap;
        gap: var(--kw-space-2);
    }

    .district-title {
        font-size: 22px;
        font-weight: 600;
        color: var(--kw-text);
        margin: 0;
    }

    .district-count {
        font-size: 13px;
        color: var(--kw-text-muted);
    }

    .district-tabs {
        display: flex;
        gap: 6px;
        background: var(--kw-surface-1);
        padding: 4px;
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-pill);
    }

    .district-tab {
        padding: 6px 14px;
        font-size: 13px;
        font-weight: 500;
        color: var(--kw-text-secondary);
        text-decoration: none;
        border-radius: var(--kw-radius-pill);
        transition: all 0.15s;
    }

    .district-tab:hover {
        color: var(--kw-text);
        text-decoration: none;
    }

    .district-tab.active {
        background: var(--kw-brand);
        color: var(--kw-text-on-accent);
    }

    .district-search-bar {
        margin-bottom: 24px;
    }

    .district-search-summary {
        margin-bottom: var(--kw-space-4);
        color: var(--kw-text-secondary);
        font-size: var(--kw-font-size-sm);
    }

    .district-search-form {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 12px;
        background: var(--kw-surface-1);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-md);
        font-size: 13px;
        max-width: 600px;
    }

    .district-search-form input {
        flex: 1;
        border: none;
        background: transparent;
        font-family: var(--kw-font);
        font-size: 13px;
        color: var(--kw-text);
        outline: none;
    }

    .district-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 16px;
    }

    .district-card {
        background: var(--kw-surface-2);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-lg);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        transition: border-color 0.15s;
    }

    .district-card:hover {
        border-color: var(--kw-border-strong);
    }

    .district-card-header {
        padding: 14px 16px;
        background: var(--kw-surface-1);
        border-bottom: 1px solid var(--kw-border);
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
    }

    .district-card-name {
        font-size: 16px;
        font-weight: 600;
        color: var(--kw-text);
        text-decoration: none;
        line-height: 1.3;
    }

    .district-card-name:hover {
        color: var(--kw-brand);
    }

    .district-card-code {
        font-size: 12px;
        color: var(--kw-text-muted);
        margin-top: 2px;
    }

    .district-card-footer {
        padding: 10px 16px;
        background: var(--kw-surface-1);
        border-top: 1px solid var(--kw-border);
        text-align: right;
    }

    .district-card-link {
        font-size: 12px;
        font-weight: 500;
        color: var(--kw-brand);
        text-decoration: none;
    }

    .district-card-link:hover {
        text-decoration: underline;
    }

    /* KW Badges & Tags */
    .district-badge {
        display: inline-flex;
        align-items: center;
        padding: 3px 10px;
        font-size: 11px;
        font-weight: 600;
        border-radius: var(--kw-radius-pill);
        white-space: nowrap;
    }

    .district-badge--danger {
        background: var(--kw-danger-light);
        color: var(--kw-danger);
    }

    .district-badge--warning {
        background: var(--kw-warning-light);
        color: var(--kw-warning);
    }

    .district-badge--success {
        background: var(--kw-success-light);
        color: var(--kw-success);
    }

    .district-tag {
        font-size: 10px;
        font-weight: 600;
        padding: 1px 6px;
        border-radius: 4px;
    }

    .district-tag--danger {
        background: var(--kw-danger-light);
        color: var(--kw-danger);
    }

    .district-tag--warning {
        background: var(--kw-warning-light);
        color: var(--kw-warning);
    }

    .district-tag--secondary {
        background: var(--kw-surface-1);
        color: var(--kw-text-secondary);
        border: 1px solid var(--kw-border);
    }

    #district-ranking-app .district-tag {
        padding: 2px 8px;
        font-size: 11px;
        font-weight: 500;
    }

    .district-empty {
        text-align: center;
        padding: 40px 20px;
        color: var(--kw-text-muted);
        background: var(--kw-surface-1);
        border-radius: var(--kw-radius-lg);
        border: 1px solid var(--kw-border);
    }

    .district-empty__icon {
        margin-bottom: var(--kw-space-2);
        font-size: 32px;
    }

    .district-empty__title {
        margin-bottom: var(--kw-space-1);
        font-size: var(--kw-font-size-body);
    }

    .district-empty__text {
        font-size: var(--kw-font-size-sm);
    }

    .district-col--species { width: 28%; }
    .district-col--size { width: 22%; }
    .district-col--period { width: 20%; }
    .district-col--limit,
    .district-col--notes { width: 15%; }

    .ranking-col--rank { width: 8%; }
    .ranking-col--district { width: 25%; }
    .ranking-col--tier { width: 20%; }
    .ranking-col--score { width: 12%; }
    .ranking-col--rules { width: 35%; }
    .ranking-col--center { text-align: center; }

/* Detail.cshtml */

#district-detail-app {
        max-width: 1000px;
        margin: 0 auto;
        padding: 20px 16px;
    }

    .detail-back {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        color: var(--kw-text-secondary);
        text-decoration: none;
        margin-bottom: 16px;
    }

    .detail-back:hover {
        color: var(--kw-brand);
        text-decoration: none;
    }

    .district-header-card {
        background: var(--kw-surface-2);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-lg);
        padding: 20px;
        margin-bottom: 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        flex-wrap: wrap;
    }

    .district-rules {
        margin: 0 0 24px;
    }

    .district-rules-header {
        margin-bottom: 12px;
    }

    .district-rules-header h2 {
        margin: 0 0 4px;
        font-size: 20px;
        color: var(--kw-text);
    }

    .district-rules-header p {
        margin: 0;
        font-size: 13px;
        color: var(--kw-text-secondary);
    }

    .district-rule-scope {
        margin-bottom: 14px;
        overflow: hidden;
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-lg);
        background: var(--kw-surface-2);
    }

    .district-rule-scope-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 18px;
        background: var(--kw-surface-1);
        border-bottom: 1px solid var(--kw-border);
    }

    .district-rule-scope-header h3 {
        margin: 0;
        font-size: 16px;
        color: var(--kw-text);
    }

    .district-rule-scope-header span {
        font-size: 11px;
        color: var(--kw-text-muted);
        text-transform: uppercase;
        letter-spacing: .04em;
    }

    .district-rule-category {
        padding: 14px 18px 4px;
    }

    .district-rule-category h4 {
        margin: 0 0 8px;
        font-size: 13px;
        color: var(--kw-brand);
    }

    .district-rule-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 10px;
    }

    .district-rule-item {
        padding: 12px;
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-md);
        background: var(--kw-bg);
    }

    .district-rule-item-heading {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
        font-size: 13px;
        color: var(--kw-text);
    }

    .district-rule-value {
        flex: 0 0 auto;
        padding: 2px 7px;
        border-radius: var(--kw-radius-pill);
        background: var(--kw-brand-light);
        color: var(--kw-brand);
        font-size: 11px;
        font-weight: 600;
    }

    .district-rule-item p {
        margin: 7px 0 0;
        font-size: 12px;
        line-height: 1.5;
        color: var(--kw-text-secondary);
    }

    .district-rule-source {
        margin-top: 8px;
        font-size: 11px;
        color: var(--kw-text-muted);
    }

    .district-header-main {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .district-header-logo {
        width: 56px;
        height: 56px;
        border-radius: 8px;
        object-fit: contain;
        background: var(--kw-surface-1);
        border: 1px solid var(--kw-border);
        padding: 4px;
    }

    .district-contact-card {
        background: var(--kw-surface-2);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-lg);
        padding: 16px 20px;
        margin-bottom: 20px;
    }

    .district-contact-header {
        margin-bottom: 12px;
    }

    .district-contact-title {
        font-size: 14px;
        font-weight: 600;
        color: var(--kw-text);
        margin: 0;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--kw-text-muted);
    }

    .district-contact-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 10px 20px;
    }

    .district-contact-item {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .district-contact-key {
        font-size: 11px;
        color: var(--kw-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        font-weight: 600;
    }

    .district-contact-val {
        font-size: 13px;
        color: var(--kw-text);
        word-break: break-word;
    }

    .district-link {
        color: var(--kw-brand);
        text-decoration: none;
    }

    .district-link:hover {
        text-decoration: underline;
    }

    .district-header-title {
        font-size: 24px;
        font-weight: 600;
        color: var(--kw-text);
        margin: 0 0 4px 0;
    }

    .district-header-desc {
        font-size: 13px;
        color: var(--kw-text-secondary);
        margin: 0;
    }

    .district-table-card {
        background: var(--kw-surface-2);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-lg);
        overflow: hidden;
        margin-bottom: 24px;
    }

    .district-table-header {
        padding: 14px 20px;
        background: var(--kw-surface-1);
        border-bottom: 1px solid var(--kw-border);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .district-table-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--kw-text);
        margin: 0;
    }

    .district-header-link {
        font-size: 13px;
        color: var(--kw-brand);
        text-decoration: none;
        font-weight: 500;
    }

    .district-header-link:hover {
        text-decoration: underline;
    }

    .district-table-responsive {
        overflow-x: auto;
    }

    .district-detail-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
    }

    .district-detail-table th {
        background: var(--kw-surface-1);
        padding: 10px 16px;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--kw-text-secondary);
        border-bottom: 1px solid var(--kw-border);
        text-align: left;
    }

    .district-detail-table td {
        padding: 10px 16px;
        border-bottom: 1px solid var(--kw-border);
        color: var(--kw-text);
        vertical-align: middle;
    }

    .district-detail-table tr:hover td {
        background: var(--kw-surface-1);
    }

    .fish-item-cell {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .fish-item-img {
        width: 36px;
        height: 27px;
        border-radius: 6px;
        object-fit: cover;
        background: var(--kw-surface-1);
    }

    .fish-item-placeholder {
        width: 36px;
        height: 36px;
        border-radius: 6px;
        background: var(--kw-surface-1);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    .fish-item-name {
        font-weight: 600;
        color: var(--kw-text);
        text-decoration: none;
    }

    .fish-item-name:hover {
        color: var(--kw-brand);
    }

    .fish-item-latin {
        font-size: 11px;
        color: var(--kw-text-muted);
        font-style: italic;
    }

    .district-size-value {
        font-weight: 600;
        color: var(--kw-text);
    }

    .district-text--danger { color: var(--kw-danger); font-weight: 600; }
    .district-text--warning { color: var(--kw-warning); font-weight: 600; }
    .district-text--muted { color: var(--kw-text-muted); }

    .district-quote-row td {
        background: var(--kw-surface-1);
        padding: 8px 16px;
        border-bottom: 1px solid var(--kw-border);
    }

    .district-quote-box {
        display: flex;
        gap: 10px;
        font-size: 12px;
        color: var(--kw-text-secondary);
    }

    .district-quote-label {
        font-weight: 600;
        color: var(--kw-brand);
        white-space: nowrap;
    }

    .district-quote-text {
        font-style: italic;
    }

    /* Bottom Group Limits Section */
    .group-limits-container {
        background: var(--kw-warning-light);
        border: 1px solid var(--kw-warning);
        border-radius: var(--kw-radius-lg);
        padding: 20px;
        margin-bottom: 24px;
    }

    .group-limits-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }

    .group-limits-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--kw-warning);
        margin: 0;
    }

    .group-limits-desc {
        font-size: 13px;
        color: var(--kw-text-secondary);
        margin-bottom: 16px;
    }

    .group-limits-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 12px;
    }

    .group-limit-card {
        background: var(--kw-bg);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-md);
        padding: 12px 14px;
    }

    .group-limit-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 6px;
    }

    .group-limit-name {
        font-size: 14px;
        font-weight: 600;
        color: var(--kw-text);
    }

    .group-limit-members {
        font-size: 12px;
        color: var(--kw-text-secondary);
        margin-bottom: 6px;
    }

    .group-limit-quote {
        font-size: 11px;
        font-style: italic;
        color: var(--kw-text-muted);
        border-top: 1px dashed var(--kw-border);
        padding-top: 6px;
        margin-top: 6px;
    }



/* Matrix.cshtml */

#district-matrix-app {
        width: 100%;
        max-width: 1400px;
        margin: 0 auto;
        padding: 20px 16px;
    }



    .matrix-filter-card {
        background: var(--kw-surface-1);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-md);
        padding: 10px 14px;
        margin-bottom: 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        flex-wrap: wrap;
    }

    .matrix-filter-input {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        max-width: 400px;
    }

    .matrix-filter-input input {
        width: 100%;
        border: none;
        background: transparent;
        font-family: var(--kw-font);
        font-size: 13px;
        color: var(--kw-text);
        outline: none;
    }

    .matrix-legend {
        display: flex;
        gap: 8px;
    }

    .matrix-table-container {
        background: var(--kw-surface-2);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-lg);
        overflow: hidden;
    }

    .matrix-table-scroll {
        max-height: 75vh;
        overflow: auto;
    }

    .matrix-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 12px;
    }

    .matrix-table th {
        background: var(--kw-surface-1);
        padding: 10px 12px;
        font-weight: 600;
        border-bottom: 2px solid var(--kw-border);
        border-right: 1px solid var(--kw-border);
        white-space: nowrap;
        text-align: center;
        position: sticky;
        top: 0;
        z-index: 5;
    }

    .matrix-table td {
        padding: 8px 10px;
        border-bottom: 1px solid var(--kw-border);
        border-right: 1px solid var(--kw-border);
        text-align: center;
        vertical-align: middle;
        background: var(--kw-bg);
    }

    .matrix-table tr:hover td {
        background: var(--kw-surface-1);
    }

    .sticky-col {
        position: sticky;
        left: 0;
        background: var(--kw-surface-1) !important;
        z-index: 6;
        border-right: 2px solid var(--kw-border) !important;
        text-align: left !important;
    }

    .sticky-corner {
        z-index: 10 !important;
        color: var(--kw-text-secondary);
        font-size: 11px;
        text-transform: uppercase;
    }

    .district-name-cell {
        font-weight: 600;
        padding-left: 14px !important;
        white-space: nowrap;
    }

    .district-cell-link {
        color: var(--kw-text);
        text-decoration: none;
    }

    .district-cell-link:hover {
        color: var(--kw-brand);
    }

    .matrix-header-link {
        color: var(--kw-brand);
        text-decoration: none;
    }

    .matrix-header-link:hover {
        text-decoration: underline;
    }

    .cell-size {
        font-weight: 600;
        color: var(--kw-text);
    }

    .cell-period {
        font-size: 11px;
        color: var(--kw-text-secondary);
        margin-top: 2px;
    }

    .cell-limit {
        font-size: 11px;
        color: var(--kw-success);
        margin-top: 2px;
    }

    /* Matrix badges are intentionally denser than the shared district badge. */
    #district-matrix-app .district-badge {
        padding: 2px 8px;
        font-size: 10px;
    }


/* Ranking.cshtml */

#district-ranking-app {
        max-width: 1000px;
        margin: 0 auto;
        padding: 20px 16px;
    }



    .ranking-info-card {
        background: var(--kw-surface-1);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-md);
        padding: 14px 18px;
        margin-bottom: 20px;
    }

    .ranking-info-title {
        font-size: 14px;
        font-weight: 600;
        color: var(--kw-brand);
        margin-bottom: 4px;
    }

    .ranking-info-desc {
        font-size: 13px;
        color: var(--kw-text-secondary);
        margin: 0;
        line-height: 1.5;
    }

    .ranking-table-card {
        background: var(--kw-surface-2);
        border: 1px solid var(--kw-border);
        border-radius: var(--kw-radius-lg);
        overflow: hidden;
    }

    .ranking-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
    }

    .ranking-table th {
        background: var(--kw-surface-1);
        padding: 10px 16px;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--kw-text-secondary);
        border-bottom: 1px solid var(--kw-border);
        text-align: left;
    }

    .ranking-table td {
        padding: 12px 16px;
        border-bottom: 1px solid var(--kw-border);
        color: var(--kw-text);
        vertical-align: middle;
    }

    .ranking-table tr:hover td {
        background: var(--kw-surface-1);
    }

    .ranking-rank {
        font-size: 15px;
        font-weight: 700;
        color: var(--kw-brand);
    }

    .ranking-district-name {
        font-weight: 600;
        color: var(--kw-text);
        text-decoration: none;
    }

    .ranking-district-name:hover {
        color: var(--kw-brand);
    }

    .ranking-score {
        font-weight: 700;
        font-size: 15px;
        color: var(--kw-warning);
    }

    .ranking-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

