.grid-page {
    background: linear-gradient(180deg, #f9fafb 0%, #eef2f7 100%);
    min-height: calc(100vh - 70px);
}

/* ── Asset group headers ──────────────────────────────────────────────────── */
.asset-group-header {
    grid-column: 1 / -1;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.01em;
    padding: 10px 4px 4px;
    border-bottom: 2px solid #cbd5e1;
    margin-top: 8px;
    text-transform: uppercase;
}

/* ── Channel snapshot additions ───────────────────────────────────────────── */
.ch-bars {
    font-size: 10px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 4px;
}
.ch-tv-link {
    font-size: 12px;
    text-decoration: none;
    margin-left: 2px;
}

/* ── New-channel flash animation ──────────────────────────────────────────── */
@keyframes channel-flash {
    0%   { box-shadow: 0 0 0 3px rgba(37,99,235,0.7); }
    50%  { box-shadow: 0 0 0 6px rgba(37,99,235,0.3); }
    100% { box-shadow: 0 0 0 0   rgba(37,99,235,0); }
}
.ticker-card.new-channel-flash {
    animation: channel-flash 1.2s ease-out;
}

.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.hero-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.05;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    margin-top: 6px;
    color: #475569;
    font-size: 13px;
}

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

.toolbar-panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #dbe3ef;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 16px;
}

.grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.grid-toolbar input,
.grid-toolbar select,
.grid-toolbar textarea {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fff;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    padding: 7px 11px;
}

.check-label input {
    margin: 0;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
}

.form-field label {
    font-size: 12px;
    color: #334155;
    font-weight: 600;
}

.form-field input,
.form-field select {
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    border: 1px solid transparent;
    padding: 9px 14px;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #0f766e 0%, #0891b2 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(8, 145, 178, 0.25);
}

.btn-secondary {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(51, 65, 85, 0.2);
}

.btn-ghost {
    background: #f8fafc;
    border-color: #dbe3ef;
    color: #0f172a;
}

.btn-ghost:hover {
    background: #e2e8f0;
}

.grid-toolbar button {
    border-radius: 10px;
    font-weight: 700;
}

.grid-toolbar .btn {
    border: 1px solid transparent;
}

.grid-toolbar .btn-primary {
    color: #ffffff;
}

.grid-toolbar .btn-secondary {
    color: #ffffff;
}

.grid-status {
    margin-left: auto;
    font-size: 12px;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    padding: 6px 10px;
}

.grid-status.error {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

.ticker-grid {
    display: grid;
    gap: 10px;
}

.ticker-card {
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    padding: 10px;
    min-height: 112px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.ticker-card:hover {
    transform: translateY(-2px);
    border-color: #94a3b8;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.ticker-card.has-unseen {
    animation: subtlePulse 1.15s ease-in-out infinite;
    border-color: #ea580c;
    background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
}

@keyframes subtlePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.16), 0 0 0 0 rgba(251, 146, 60, 0.12);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(234, 88, 12, 0.28), 0 0 26px 1px rgba(251, 146, 60, 0.4);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.16), 0 0 0 0 rgba(251, 146, 60, 0.12);
    }
}

.ticker-symbol {
    font-weight: 800;
    font-size: 22px;
    line-height: 1;
    color: #0f172a;
}

.ticker-card-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
}

.ticker-name {
    color: #475569;
    font-size: 12px;
    margin-top: 2px;
    min-height: 14px;
}

.asset-chip {
    flex: 0 0 auto;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: 10px;
    line-height: 1;
    padding: 4px 7px;
    font-weight: 700;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    font-size: 11px;
    border-radius: 999px;
    padding: 2px 8px;
    font-weight: 600;
}

.badge-updates {
    background: #fffbeb;
    color: #92400e;
}

.badge-channel {
    background: #ecfeff;
    color: #155e75;
}

.badge-zone {
    background: #fff7ed;
    color: #9a3412;
}

.badge-pattern {
    background: #eff6ff;
    color: #1e40af;
}

.badge-drop {
    background: #fef2f2;
    color: #991b1b;
}

.badge-alarm {
    background: #ecfdf5;
    color: #166534;
}

.badge-dynamic {
    background: #f5f3ff;
    color: #5b21b6;
}

.channel-snapshot {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    padding: 6px;
    margin-top: 8px;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
}

.channel-snapshot span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-snapshot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    padding: 5px 6px;
    margin-top: 6px;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
}

.scan-snapshot span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grid-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #64748b;
    margin-top: 8px;
}

.grid-modal {
    display: none;
    position: fixed;
    z-index: 1200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    overflow: auto;
}

.grid-modal-content {
    max-width: 1080px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    padding: 16px;
    box-shadow: 0 24px 50px rgba(2, 6, 23, 0.25);
}

.grid-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.grid-modal-close {
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f1f5f9;
    font-size: 17px;
    cursor: pointer;
    color: #334155;
    font-weight: 700;
}

.grid-modal-close:hover {
    background: #e2e8f0;
}

.settings-grid-toolbar {
    margin-bottom: 8px;
}

.grid-modal-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.findings-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    min-width: 620px;
}

.findings-table th,
.findings-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
    vertical-align: top;
}

.findings-table th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 2;
}

.findings-table tbody tr:nth-child(even) {
    background: #fcfdff;
}

.findings-table tbody tr:hover {
    background: #f4f8ff;
}

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

.btn-sm {
    padding: 7px 10px;
    font-size: 12px;
}

.settings-textarea {
    width: 100%;
    min-height: 160px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.4;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
}

.channel-config-panel {
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #f8fafc;
    padding: 12px;
    margin: 8px 0 14px;
}

.channel-config-toolbar {
    align-items: flex-end;
    margin-bottom: 0;
}

.channel-config-toolbar .form-field {
    min-width: 155px;
}

.admin-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #dbe3ef;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px;
    text-align: left;
    font-size: 13px;
}

.admin-table th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
}

.admin-table tbody tr:nth-child(even) {
    background: #fcfdff;
}

.admin-table tbody tr:hover {
    background: #f4f8ff;
}

.inline-form {
    display: inline-block;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.section-head h3 {
    margin: 0;
}

.ticker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-danger {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.2);
}

.detail-summary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.detail-summary-row-tight {
    margin-bottom: 4px;
}

.detail-anchor-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.detail-anchor-nav a {
    text-decoration: none;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
}

.detail-anchor-nav a:hover {
    background: #f1f5f9;
}

.detail-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.detail-kpi {
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 10px;
}

.detail-kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 4px;
    font-weight: 700;
}

.detail-kpi-value {
    font-size: 16px;
    line-height: 1.2;
    color: #0f172a;
    font-weight: 800;
}

.detail-section-card {
    scroll-margin-top: 90px;
}

.detail-section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.detail-section-head h3 {
    margin: 0;
}

.detail-section-note {
    font-size: 12px;
    color: #475569;
}

.detail-two-col-form {
    align-items: stretch;
}

.detail-wide-field {
    min-width: 320px;
    flex: 1;
}

.detail-pattern-override-textarea {
    min-height: 150px;
}

.detail-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
}

.summary-pill {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    color: #334155;
    font-weight: 600;
}

.finding-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.finding-card {
    border: 1px solid #dbe3ef;
    background: #ffffff;
    border-radius: 10px;
    padding: 10px;
}

.finding-card.unseen {
    border-color: #f59e0b;
    background: #fffef7;
}

.finding-head {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.finding-chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.finding-chip.kind {
    background: #e2e8f0;
    color: #0f172a;
}

.finding-chip.subtype {
    background: #dbeafe;
    color: #1e3a8a;
}

.finding-chip.tf {
    background: #dcfce7;
    color: #166534;
}

.finding-chip.status.seen {
    background: #ecfdf5;
    color: #166534;
}

.finding-chip.status.unseen {
    background: #fef3c7;
    color: #92400e;
}

.finding-meta {
    font-size: 12px;
    color: #475569;
    margin-bottom: 8px;
}

.finding-image-wrap {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.finding-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.finding-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in;
}

.finding-no-image {
    font-size: 12px;
    color: #64748b;
}

.finding-payload {
    margin-top: 8px;
}

.finding-payload summary {
    font-size: 12px;
    color: #1d4ed8;
    cursor: pointer;
}

.finding-payload pre {
    margin-top: 6px;
    max-height: 160px;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    font-size: 11px;
    line-height: 1.35;
}

.empty-note {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

.table-shell {
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    overflow: auto;
    max-height: 380px;
}

.config-guide-collapse {
    margin-top: 10px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #fcfdff;
    padding: 8px 10px;
}

.config-guide-collapse > summary {
    cursor: pointer;
    color: #0f172a;
    font-weight: 700;
    font-size: 13px;
    outline: none;
}

.config-guide {
    margin-top: 10px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 12px;
}

.config-guide-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.config-guide-head h4 {
    margin: 0;
    color: #0f172a;
    font-size: 15px;
}

.config-guide-meta {
    font-size: 12px;
    color: #475569;
}

.config-guide-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.config-sample-card {
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
}

.config-sample-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.config-sample-head h5 {
    margin: 0;
    font-size: 13px;
    color: #0f172a;
}

.config-sample-actions {
    display: inline-flex;
    gap: 6px;
}

.config-help-text {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #475569;
}

.config-code {
    margin: 0;
    max-height: 220px;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    border: 1px solid #1e293b;
    padding: 8px;
    font-size: 11px;
    line-height: 1.4;
}

.config-guide-status {
    min-height: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: #0f766e;
    font-weight: 600;
}

.config-guide-status.error {
    color: #b91c1c;
}

@media (max-width: 900px) {
    .page-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-title {
        font-size: 23px;
    }

    .hero-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .grid-status {
        margin-left: 0;
    }

    .grid-modal-content {
        margin: 16px;
    }

    .ticker-symbol {
        font-size: 18px;
    }

    .config-guide-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-section-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
