:root {
    --bg: #f4efe6;
    --panel: rgba(255, 252, 246, 0.86);
    --panel-strong: #fffdf8;
    --panel-border: rgba(88, 61, 27, 0.12);
    --text: #26190f;
    --muted: #7a6657;
    --line: rgba(88, 61, 27, 0.1);
    --brand: #cb5c2f;
    --brand-deep: #a23d1d;
    --accent: #147a6c;
    --accent-soft: rgba(20, 122, 108, 0.12);
    --warning: #f2b64c;
    --danger: #cc4b37;
    --success: #2f8f63;
    --shadow-lg: 0 28px 60px rgba(62, 39, 16, 0.12);
    --shadow-md: 0 18px 30px rgba(62, 39, 16, 0.08);
    --shadow-sm: 0 10px 20px rgba(62, 39, 16, 0.06);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --font-sans: "Space Grotesk", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    --font-mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 206, 124, 0.38), transparent 28%),
        radial-gradient(circle at top right, rgba(20, 122, 108, 0.22), transparent 22%),
        linear-gradient(180deg, #f8f2e9 0%, #f4efe6 46%, #f2ece1 100%);
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: none;
    cursor: pointer;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    padding: 12px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(203, 92, 47, 0.5);
    box-shadow: 0 0 0 4px rgba(203, 92, 47, 0.12);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.app-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.hero-panel,
.stat-card,
.context-card,
.subscriptions-section,
.modal-content,
.toast {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    gap: 28px;
    padding: 34px;
    margin-bottom: 24px;
    border-radius: var(--radius-xl);
    background:
        linear-gradient(135deg, rgba(49, 31, 16, 0.94) 0%, rgba(95, 47, 14, 0.9) 50%, rgba(203, 92, 47, 0.88) 100%);
    color: #fff4ea;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero-panel::after {
    content: "";
    position: absolute;
    inset: auto -12% -45% auto;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 236, 194, 0.4), transparent 65%);
}

.hero-copy {
    position: relative;
    z-index: 1;
    max-width: 640px;
}

.hero-copy h1 {
    font-size: clamp(2.2rem, 4vw, 3.6rem);
    line-height: 1;
    margin-bottom: 12px;
}

.hero-copy p {
    max-width: 560px;
    color: rgba(255, 244, 234, 0.86);
    line-height: 1.7;
    font-size: 1rem;
}

.hero-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-content: flex-start;
    gap: 12px;
    min-width: 280px;
}

.hero-btn,
.section-action-btn,
.btn,
.btn-modal,
.inline-copy-btn {
    border-radius: 999px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.hero-btn,
.section-action-btn,
.btn-modal-primary,
.btn-primary,
.inline-copy-btn {
    background: linear-gradient(135deg, var(--brand) 0%, #df7a42 100%);
    color: white;
    box-shadow: 0 10px 18px rgba(203, 92, 47, 0.24);
}

.hero-btn:hover,
.section-action-btn:hover,
.btn-primary:hover,
.btn-modal-primary:hover,
.inline-copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 22px rgba(203, 92, 47, 0.3);
}

.hero-btn {
    padding: 12px 18px;
    font-weight: 600;
}

.hero-btn-secondary {
    background: rgba(255, 255, 255, 0.14);
    color: #fff5eb;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: none;
}

.hero-btn-secondary:hover {
    box-shadow: none;
    background: rgba(255, 255, 255, 0.2);
}

.hero-btn-ghost {
    background: transparent;
    color: rgba(255, 245, 235, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: none;
}

.hero-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card,
.context-card,
.subscriptions-section {
    border: 1px solid var(--panel-border);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    padding: 22px;
    border-radius: var(--radius-lg);
}

.stat-kicker {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-number {
    font-size: clamp(2rem, 2vw, 2.6rem);
    font-weight: 700;
    color: var(--brand-deep);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--muted);
    font-size: 0.95rem;
}

.workspace-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.workspace-sidebar {
    display: grid;
    gap: 18px;
    position: sticky;
    top: 22px;
}

.context-card {
    padding: 22px;
    border-radius: var(--radius-lg);
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-heading h2 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.panel-heading p,
.section-subtitle,
.modal-description,
.group-summary p {
    color: var(--muted);
    line-height: 1.6;
}

.field-stack {
    display: grid;
    gap: 10px;
}

.field-label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--muted);
}

.native-select-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(100%) !important;
    white-space: nowrap !important;
    pointer-events: none !important;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.custom-select-trigger {
    position: relative;
    width: 100%;
    min-height: 48px;
    padding: 0 46px 0 14px;
    border-radius: 14px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
    text-align: left;
    box-shadow: 0 6px 14px rgba(62, 39, 16, 0.04);
}

.custom-select-trigger:hover {
    border-color: rgba(203, 92, 47, 0.32);
    background: rgba(255, 255, 255, 0.92);
}

.custom-select.is-open .custom-select-trigger,
.custom-select-trigger:focus-visible {
    outline: none;
    border-color: rgba(203, 92, 47, 0.5);
    box-shadow: 0 0 0 4px rgba(203, 92, 47, 0.12);
}

.custom-select-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 16px;
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(122, 102, 87, 0.8);
    border-bottom: 2px solid rgba(122, 102, 87, 0.8);
    transform: translateY(-65%) rotate(45deg);
    transition: transform 0.18s ease;
}

.custom-select.is-open .custom-select-trigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-select-value {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 40;
    display: none;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid rgba(88, 61, 27, 0.14);
    background: rgba(255, 251, 244, 0.98);
    box-shadow: 0 18px 30px rgba(62, 39, 16, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.custom-select.is-open .custom-select-dropdown {
    display: block;
}

.custom-select-options {
    display: grid;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}

.custom-select-option {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
    outline: none;
    background: rgba(203, 92, 47, 0.08);
}

.custom-select-option.is-selected {
    background: rgba(203, 92, 47, 0.12);
    color: var(--brand-deep);
    font-weight: 700;
}

.custom-select-option.is-placeholder {
    color: var(--muted);
}

.group-summary {
    margin-top: 18px;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.68) 0%, rgba(255, 248, 237, 0.96) 100%);
    border: 1px solid rgba(203, 92, 47, 0.12);
}

.group-summary-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.group-summary-header strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.status-chip,
.subscription-status,
.subscription-type,
.attach-sub-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-chip {
    height: fit-content;
    padding: 8px 12px;
    background: rgba(122, 102, 87, 0.12);
    color: var(--muted);
    white-space: nowrap;
}

.status-chip.is-active {
    background: rgba(47, 143, 99, 0.14);
    color: var(--success);
}

.inline-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.inline-copy-btn {
    padding: 0 16px;
    min-width: 76px;
}

.group-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.9rem;
}

.sidebar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.sidebar-actions.stacked {
    grid-template-columns: 1fr;
}

.section-action-btn {
    min-height: 46px;
    padding: 0 16px;
    font-weight: 600;
}

.section-action-btn-muted {
    background: rgba(38, 25, 15, 0.08);
    color: var(--text);
    box-shadow: none;
}

.section-action-btn-muted:hover {
    box-shadow: none;
    background: rgba(38, 25, 15, 0.13);
}

.section-action-btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(20, 122, 108, 0.24);
    box-shadow: none;
}

.section-action-btn-outline:hover {
    background: var(--accent-soft);
    box-shadow: none;
}

.section-action-btn:disabled,
.inline-copy-btn:disabled,
.hero-btn:disabled,
.btn:disabled,
.btn-modal:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.subscriptions-section {
    padding: 24px;
    border-radius: var(--radius-xl);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.35rem;
    margin-bottom: 8px;
}

.results-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 16px;
    border-radius: 999px;
    background: rgba(20, 122, 108, 0.08);
    color: var(--accent);
    font-weight: 700;
}

.results-separator {
    opacity: 0.4;
}

.subscriptions-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 22px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid var(--line);
}

.search-field {
    display: grid;
    gap: 8px;
    min-width: min(100%, 360px);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.toolbar-filters .custom-select {
    flex: 0 0 190px;
}

.field-stack .custom-select,
.form-group .custom-select {
    width: 100%;
}

.filter-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(38, 25, 15, 0.06);
    color: var(--muted);
    font-weight: 600;
}

.filter-chip:hover {
    background: rgba(38, 25, 15, 0.1);
}

.filter-chip.is-active {
    background: rgba(203, 92, 47, 0.12);
    color: var(--brand-deep);
    border-color: rgba(203, 92, 47, 0.2);
}

#subscriptionsList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.subscription-item {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(88, 61, 27, 0.1);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 250, 243, 0.86) 100%);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.subscription-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(203, 92, 47, 0.2);
}

.subscription-item.inactive {
    opacity: 0.62;
    background: linear-gradient(180deg, rgba(237, 237, 237, 0.96) 0%, rgba(229, 229, 229, 0.92) 100%);
    border-color: rgba(118, 118, 118, 0.22);
    box-shadow: none;
    filter: grayscale(100%);
}

.subscription-item.inactive:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(118, 118, 118, 0.22);
}

.subscription-item.inactive .subscription-url {
    background: rgba(120, 120, 120, 0.06);
    border-color: rgba(120, 120, 120, 0.18);
    color: #5f6368;
}

.subscription-item.inactive .subscription-url small,
.subscription-item.inactive .subscription-description,
.subscription-item.inactive .subscription-footnote,
.subscription-item.inactive .meta-label,
.subscription-item.inactive .meta-value {
    color: #7a7f87;
}

.subscription-item.inactive .subscription-meta {
    background: rgba(120, 120, 120, 0.05);
    border-color: rgba(120, 120, 120, 0.14);
}

.subscription-item.inactive .subscription-actions {
    opacity: 0.8;
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.subscription-title {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.subscription-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.subscription-type {
    padding: 6px 10px;
    background: rgba(20, 122, 108, 0.1);
    color: var(--accent);
}

.subscription-status {
    padding: 7px 12px;
}

.status-active {
    background: rgba(47, 143, 99, 0.14);
    color: var(--success);
}

.status-inactive {
    background: rgba(204, 75, 55, 0.12);
    color: var(--danger);
}

.subscription-description {
    color: var(--muted);
    line-height: 1.6;
    font-size: 0.94rem;
}

.subscription-url {
    display: block;
    padding: 14px;
    border-radius: 18px;
    border: 1px dashed rgba(20, 122, 108, 0.2);
    background: rgba(20, 122, 108, 0.05);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #23544d;
    word-break: break-all;
}

.subscription-url-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subscription-url small {
    display: block;
    margin-top: 6px;
    color: rgba(35, 84, 77, 0.76);
}

.subscription-meta {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(38, 25, 15, 0.03);
    border: 1px solid var(--line);
}

.subscription-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.meta-label {
    color: var(--muted);
    font-size: 0.82rem;
}

.meta-value {
    font-weight: 700;
    color: var(--text);
}

.meta-value.pending {
    color: var(--muted);
}

.usage-bar {
    display: flex;
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(38, 25, 15, 0.08);
}

.usage-download {
    background: linear-gradient(90deg, #2aa0f5 0%, #1865f2 100%);
}

.usage-upload {
    background: linear-gradient(90deg, #49c27a 0%, #15935f 100%);
}

.subscription-footnote {
    color: var(--muted);
    font-size: 0.8rem;
}

.subscription-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    font-weight: 600;
}

.btn-sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.84rem;
}

.btn-primary {
    color: white;
}

.btn-success {
    background: rgba(47, 143, 99, 0.14);
    color: var(--success);
    box-shadow: none;
}

.btn-warning {
    background: rgba(242, 182, 76, 0.18);
    color: #8e6307;
    box-shadow: none;
}

.btn-danger {
    background: rgba(204, 75, 55, 0.12);
    color: var(--danger);
    box-shadow: none;
}

.btn-neutral {
    background: rgba(38, 25, 15, 0.08);
    color: var(--text);
    box-shadow: none;
}

.btn-success:hover,
.btn-warning:hover,
.btn-danger:hover,
.btn-neutral:hover,
.btn-modal-secondary:hover {
    transform: translateY(-1px);
    box-shadow: none;
}

.loading,
.empty-state {
    grid-column: 1 / -1;
}

.loading,
.empty-state,
.error-state {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 220px;
    padding: 28px;
    border-radius: 24px;
    border: 1px dashed rgba(88, 61, 27, 0.18);
    background: rgba(255, 255, 255, 0.42);
    color: var(--muted);
}

.empty-state strong,
.error-state strong {
    display: block;
    font-size: 1.12rem;
    color: var(--text);
    margin-bottom: 10px;
}

.empty-state p,
.error-state p {
    max-width: 420px;
    line-height: 1.7;
    margin-bottom: 18px;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(36, 22, 12, 0.46);
    z-index: 1000;
}

.modal.is-open {
    display: flex;
}

.modal-content {
    width: min(100%, 640px);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 28px;
    background: rgba(255, 251, 244, 0.96);
    border: 1px solid rgba(88, 61, 27, 0.12);
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.22s ease;
}

.modal-content-wide {
    width: min(100%, 980px);
}

.modal-content-medium {
    width: min(100%, 760px);
}

.modal-content-compact {
    width: min(100%, 440px);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 24px;
    color: white;
    background: linear-gradient(135deg, #341e10 0%, #7a3715 100%);
}

.modal-title {
    font-size: 1.25rem;
}

.close {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 1.6rem;
}

.close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-form,
.form-grid {
    display: grid;
    gap: 18px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
    grid-column: 1 / -1;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text);
}

.form-help,
.confirm-message {
    color: var(--muted);
    line-height: 1.6;
}

.section-inline-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.inline-checkbox-group {
    align-content: end;
}

.section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.fixed-random-actions input {
    width: 96px;
    min-height: 34px;
    padding: 7px 9px;
    font-size: 0.84rem;
}

.fixed-healthy-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(47, 143, 99, 0.12);
    color: var(--success);
    font-size: 0.84rem;
    font-weight: 700;
}

.fixed-healthy-toggle input {
    width: auto;
}

.inline-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}

.inline-checkbox-group input {
    width: auto;
}

.fixed-inbounds-list {
    display: grid;
    gap: 10px;
}

.fixed-inbounds-empty {
    padding: 14px 16px;
    border: 1px dashed var(--panel-border);
    border-radius: 16px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.42);
}

.fixed-inbounds-hint {
    color: var(--muted);
    font-size: 0.86rem;
}

.fixed-inbound-row {
    display: grid;
    grid-template-columns: 72px 96px 96px 130px minmax(180px, 1fr) 120px 150px auto;
    gap: 10px;
    align-items: center;
}

.fixed-inbound-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--muted);
}

.fixed-inbound-toggle input {
    width: auto;
}

.fixed-proxy-field {
    display: grid;
    gap: 6px;
}

.fixed-node-health {
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}

.fixed-node-health.alive {
    background: rgba(47, 143, 99, 0.14);
    color: var(--success);
}

.fixed-node-health.dead {
    background: rgba(204, 75, 55, 0.12);
    color: var(--danger);
}

.fixed-node-health.unknown {
    background: rgba(122, 102, 87, 0.12);
    color: var(--muted);
}

.fixed-link-output {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(20, 122, 108, 0.16);
    background: rgba(20, 122, 108, 0.06);
}

.fixed-link-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fixed-link-output-header > div {
    display: grid;
    gap: 4px;
}

.fixed-link-output-header small {
    color: var(--muted);
    font-size: 0.78rem;
}

.fixed-link-output textarea {
    min-height: 96px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.code-editor-ace {
    height: 360px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(88, 61, 27, 0.14);
}

.code-editor-ace .ace_gutter {
    background: #0f172a !important;
}

.code-editor-ace .ace_scroller {
    background: #111827 !important;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 24px 24px;
}

.btn-modal {
    min-height: 44px;
    padding: 0 18px;
    font-weight: 600;
}

.btn-modal-secondary {
    background: rgba(38, 25, 15, 0.08);
    color: var(--text);
    box-shadow: none;
}

.modal-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.token-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.group-list,
.attach-sub-list {
    display: grid;
    gap: 12px;
}

.group-item,
.attach-sub-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid var(--line);
}

.group-item-info,
.attach-sub-info {
    display: grid;
    gap: 6px;
}

.group-item-name,
.attach-sub-name {
    font-weight: 700;
    color: var(--text);
}

.group-item-token {
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 0.84rem;
}

.group-item-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.attach-sub-type {
    width: fit-content;
    padding: 5px 10px;
    background: rgba(38, 25, 15, 0.08);
    color: var(--muted);
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: grid;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: min(420px, calc(100vw - 32px));
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 251, 245, 0.96);
    border: 1px solid rgba(88, 61, 27, 0.12);
    box-shadow: var(--shadow-md);
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.24s ease, opacity 0.24s ease;
}

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

.toast.success {
    border-color: rgba(47, 143, 99, 0.28);
}

.toast.error {
    border-color: rgba(204, 75, 55, 0.28);
}

.toast.info {
    border-color: rgba(20, 122, 108, 0.22);
}

.toast-icon {
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: 700;
    background: rgba(38, 25, 15, 0.08);
}

.toast.success .toast-icon {
    color: var(--success);
    background: rgba(47, 143, 99, 0.12);
}

.toast.error .toast-icon {
    color: var(--danger);
    background: rgba(204, 75, 55, 0.12);
}

.toast.info .toast-icon {
    color: var(--accent);
    background: rgba(20, 122, 108, 0.1);
}

.toast-content {
    flex: 1;
    color: var(--text);
    line-height: 1.6;
}

.toast-close {
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
    padding: 0;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    gap: 12px;
    background: rgba(255, 252, 247, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1200;
}

.loading-overlay.visible {
    display: grid;
}

.spinner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid rgba(203, 92, 47, 0.12);
    border-top-color: var(--brand);
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: var(--brand-deep);
    font-weight: 700;
}

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

@media (max-width: 1180px) {
    .workspace-layout {
        grid-template-columns: 1fr;
    }

    .workspace-sidebar {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .stats,
    #subscriptionsList,
    .form-grid,
    .fixed-inbound-row {
        grid-template-columns: 1fr;
    }

    .hero-panel,
    .section-header,
    .subscriptions-toolbar {
        flex-direction: column;
    }

    .hero-actions {
        justify-content: flex-start;
        min-width: 0;
    }
}

@media (max-width: 720px) {
    .app-shell {
        padding: 18px 14px 32px;
    }

    .hero-panel,
    .subscriptions-section,
    .context-card,
    .stat-card {
        padding: 18px;
        border-radius: 22px;
    }

    .workspace-sidebar {
        grid-template-columns: 1fr;
    }

    .sidebar-actions,
    .token-row,
    .inline-field {
        grid-template-columns: 1fr;
    }

    .group-summary-header,
    .group-item,
    .attach-sub-item,
    .subscription-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .group-item-actions,
    .subscription-actions {
        width: 100%;
    }

    .modal {
        padding: 12px;
    }

    .modal-content {
        max-height: calc(100vh - 24px);
        border-radius: 22px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .btn-modal {
        width: 100%;
    }
}
