.builder-layout, .ipset-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

/* Sidebar (rule builder internal sidebar) */
.rule-sidebar, .ipset-sidebar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

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

.sidebar-header h3 { font-size: 1rem; }

.policy-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.policy-section h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.policy-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 6px;
    align-items: center;
}

.policy-grid label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.policy-select {
    padding: 4px 8px !important;
    font-size: 0.78rem !important;
}

/* Rule list */
.rule-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rule-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.1s;
    font-size: 0.78rem;
}

.rule-list-item:hover { background: var(--bg-hover); border-color: var(--accent); }
.rule-list-item.selected { border-color: var(--accent); background: var(--accent-bg); }

.rule-list-item .drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 0.9rem;
    user-select: none;
}

.rule-list-item .drag-handle:active { cursor: grabbing; }

.rule-list-item .rule-brief {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rule-list-item .rule-chain-label {
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 3px;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
}

.rule-list-item .rule-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 2px;
}
.rule-list-item .rule-delete:hover { color: var(--red); }

.rule-list-item.drag-over {
    border-top: 2px solid var(--accent);
}

/* Rule editor */
.rule-editor {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.rule-editor h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.match-section {
    margin: 16px 0;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.match-header h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#add-match-select {
    font-size: 0.78rem;
    padding: 4px 8px;
}

.match-ext-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    position: relative;
}

.match-ext-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.match-ext-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
}

.match-ext-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}
.match-ext-remove:hover { color: var(--red); }

/* Target options */
#target-options {
    margin-bottom: 12px;
}

.target-opt-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 8px;
}

/* Preview */
.preview-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.preview-section h4 {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.code-preview {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--green);
    word-break: break-all;
    white-space: pre-wrap;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Validation messages */
.validation-messages {
    margin-top: 12px;
}

.validation-error, .validation-warning {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.validation-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(245,85,93,0.2);
}

.validation-warning {
    background: var(--orange-bg);
    color: var(--orange);
    border: 1px solid rgba(245,166,35,0.2);
}

/* ipset panel */
.ipset-editor {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.ipset-editor h3, .ipset-editor h4 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.ipset-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ipset-list-item {
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.ipset-list-item:hover { border-color: var(--accent); }
.ipset-list-item.selected { border-color: var(--accent); background: var(--accent-bg); }

.ipset-list-item .set-name { font-weight: 600; }
.ipset-list-item .set-type {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.ipset-list-item .set-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}
.ipset-list-item .set-delete:hover { color: var(--red); }

.entries-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}

.entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    border-bottom: 1px dotted var(--border);
}

.entry-item .entry-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
}
.entry-item .entry-delete:hover { color: var(--red); }

/* nftables sub-tabs */
.nft-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.nft-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
}

.nft-tab.active {
    background: var(--bg-secondary);
    color: var(--accent);
    border-color: var(--accent);
}

.nft-panel-inner { display: none; }
.nft-panel-inner.active { display: block; }

/* Tools tabs - reuse nft-tab style */
.tools-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.tools-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
}
.tools-tab.active {
    background: var(--bg-secondary);
    color: var(--accent);
    border-color: var(--accent);
}
.tools-panel-inner { display: none; }
.tools-panel-inner.active { display: block; }

/* Converter */
#converter-input {
    width: 100%;
    min-height: 30vh;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
}

/* Diff */
.diff-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.diff-side label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}
.diff-side textarea {
    width: 100%;
    min-height: 25vh;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.5;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
}
.diff-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.diff-stat {
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.diff-stat.diff-added { background: var(--green-bg); color: var(--green); }
.diff-stat.diff-removed { background: var(--red-bg); color: var(--red); }
.diff-stat.diff-modified { background: var(--orange-bg); color: var(--orange); }

.diff-list { display: flex; flex-direction: column; gap: 2px; }
.diff-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}
.diff-line-added { background: var(--green-bg); color: var(--green); }
.diff-line-removed { background: var(--red-bg); color: var(--red); }
.diff-line-modified { background: var(--orange-bg); color: var(--orange); }
.diff-icon { font-weight: 700; min-width: 14px; text-align: center; }

/* Simulator */
.sim-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.sim-packet-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.sim-packet-form h4 { font-size: 0.9rem; margin-bottom: 12px; }
.sim-ruleset-input h4 { font-size: 0.9rem; margin-bottom: 8px; }
#sim-ruleset {
    width: 100%;
    min-height: 30vh;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.5;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
}
.sim-verdict {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 0.95rem;
}
.sim-trace { margin-top: 12px; }
.sim-trace h4 { font-size: 0.9rem; margin-bottom: 8px; }
.sim-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    border-left: 3px solid var(--border);
    margin-bottom: 2px;
}
.sim-step-matched { border-left-color: var(--accent); background: var(--accent-bg); }
.sim-step-pass { border-left-color: var(--border); }
.sim-step-icon { min-width: 16px; text-align: center; }
.sim-step-name { font-weight: 600; min-width: 140px; }
.sim-step-result { color: var(--text-secondary); }
.sim-matched-rule { margin-top: 12px; }
.sim-matched-rule h4 { font-size: 0.9rem; margin-bottom: 8px; }

/* Templates */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.template-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.template-card h4 { font-size: 0.95rem; margin-bottom: 6px; }
.template-card p { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 8px; }
.template-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.template-tag {
    font-size: 0.68rem;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    color: var(--text-muted);
}
.template-actions { display: flex; gap: 6px; }

/* Analysis tabs */
.analysis-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.analysis-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
}
.analysis-tab.active { background: var(--bg-secondary); color: var(--accent); border-color: var(--accent); }
.analysis-panel-inner { display: none; }
.analysis-panel-inner.active { display: block; }
.analysis-input { margin-bottom: 16px; }

#analysis-ruleset {
    width: 100%;
    min-height: 20vh;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
}

/* Audit score */
.audit-score-box {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.audit-score {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.audit-score-num { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.audit-score-label { font-size: 0.7rem; color: var(--text-muted); }
.audit-risk { font-size: 1.3rem; font-weight: 700; }
.audit-stats { font-size: 0.82rem; color: var(--text-secondary); }

.audit-section { margin-top: 16px; }
.audit-section h4 { font-size: 0.9rem; margin-bottom: 8px; }

.audit-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    font-size: 0.8rem;
    border-bottom: 1px dotted var(--border);
}
.audit-check-pass .audit-check-icon { color: var(--green); }
.audit-check-fail .audit-check-icon { color: var(--red); }
.audit-check-icon { min-width: 16px; font-size: 1rem; }
.audit-check-name { min-width: 180px; font-weight: 600; }
.audit-check-desc { color: var(--text-secondary); }

/* Flow graph */
.flow-paths {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.flow-path {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.flow-path h4 { font-size: 0.85rem; margin-bottom: 4px; }
.flow-path-stats { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 12px; }
.flow-chain-list { display: flex; flex-direction: column; align-items: center; gap: 0; }
.flow-arrow { color: var(--accent); font-size: 0.8rem; line-height: 1; padding: 2px 0; }

.flow-node {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    margin: 2px 0;
}
.flow-node-active { border-color: var(--accent); background: var(--accent-bg); }
.flow-node-empty { opacity: 0.4; }
.flow-node-user { border-color: var(--purple); background: rgba(167,139,250,0.08); border-style: dashed; }
.flow-node-header { display: flex; gap: 6px; align-items: center; }
.flow-node-table { color: var(--text-muted); font-size: 0.68rem; }
.flow-node-chain { font-weight: 600; }
.flow-node-policy { font-size: 0.68rem; }
.flow-node-policy.policy-DROP { color: var(--red); }
.flow-node-policy.policy-ACCEPT { color: var(--green); }
.flow-node-rules { font-size: 0.7rem; color: var(--text-secondary); }
.flow-node-targets { font-size: 0.68rem; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.flow-node-jumps { font-size: 0.68rem; color: var(--purple); margin-top: 2px; }

.flow-user-chains { margin-top: 16px; }
.flow-user-chains h4 { font-size: 0.85rem; margin-bottom: 8px; }

@media (max-width: 900px) {
    .flow-paths { grid-template-columns: 1fr; }
    .audit-score-box { flex-wrap: wrap; }
}

/* Audit recommendation */
.audit-rec-code {
    font-family: var(--font-mono);
    font-size: 0.73rem;
    color: var(--accent);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin: 4px 0 0 0;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Conflict detail */
.conflict-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    margin-top: 2px;
}
.conflict-rule {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
}
.conflict-rule code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
}
.conflict-label {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
}
.conflict-blocker {
    background: var(--orange-bg);
}
.conflict-blocker .conflict-label {
    background: var(--orange);
    color: var(--bg);
}
.conflict-blocker code { color: var(--orange); }
.conflict-blocked {
    background: var(--red-bg);
}
.conflict-blocked .conflict-label {
    background: var(--red);
    color: var(--bg);
}
.conflict-blocked code { color: var(--red); }

/* IP Calculator */
.ipcalc-result { font-size: 0.82rem; }
.ipcalc-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.ipcalc-table td { padding: 4px 8px; border-bottom: 1px dotted var(--border); }
.ipcalc-label { color: var(--text-secondary); white-space: nowrap; width: 140px; }
.ipcalc-value { font-family: var(--font-mono); font-size: 0.8rem; }
.ipcalc-type { font-size: 0.85rem; }

/* Simulator visual layout */
.sim-dual-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}
.sim-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.sim-technical {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
}
.sim-technical h4 { font-size: 0.85rem; margin-bottom: 10px; color: var(--text-secondary); }

/* Packet box */
.sim-pkt-box {
    width: 100%;
    max-width: 340px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 16px;
}
.sim-pkt-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.sim-pkt-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    padding: 2px 0;
}
.sim-pkt-row span { color: var(--text-muted); }
.sim-pkt-row strong { color: var(--text); font-family: var(--font-mono); }

/* Flow visualization */
.sim-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 340px;
}
.sim-flow-arrow {
    color: var(--accent);
    font-size: 0.7rem;
    line-height: 1;
    padding: 3px 0;
    opacity: 0.6;
}
.sim-flow-node {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.78rem;
}
.sim-flow-node-name {
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 3px;
}
.sim-flow-node-desc { color: var(--text-secondary); font-size: 0.72rem; }
.sim-flow-node-skip { color: var(--text-muted); font-size: 0.72rem; font-style: italic; }
.sim-flow-node-nat {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--blue);
    font-weight: 600;
}

.sim-flow-pass { border-color: var(--border); background: var(--bg); opacity: 0.6; }
.sim-flow-matched { border-color: var(--accent); background: var(--accent-bg); }
.sim-flow-nat { border-color: var(--blue); background: var(--blue-bg); }
.sim-flow-terminal { border-color: var(--red); background: var(--red-bg); }
.sim-flow-accept { border-color: var(--green); background: var(--green-bg); }

.sim-flow-verdict {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    border: 2px solid;
}
.sim-flow-verdict.target-ACCEPT { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.sim-flow-verdict.target-DROP { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.sim-flow-verdict.target-REJECT { border-color: var(--orange); background: var(--orange-bg); color: var(--orange); }
.sim-flow-verdict-icon { font-size: 1.2rem; }

/* NAT summary */
.sim-nat-summary {
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--blue-bg);
    border: 1px solid rgba(91,138,245,0.2);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}
.sim-nat-line { color: var(--blue); padding: 2px 0; }

/* Explanation */
.sim-explanation {
    width: 100%;
    margin-top: 12px;
}
.sim-explanation h4 { font-size: 0.82rem; margin-bottom: 6px; }
.sim-hint {
    background: var(--orange-bg);
    border: 1px solid rgba(245,166,35,0.2);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.78rem;
    color: var(--orange);
    margin-bottom: 4px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .sim-dual-layout { grid-template-columns: 1fr; }
}

/* Scanner */
.scan-status { flex: 1; }
.scan-result-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.82rem;
}
.scan-result-box .diff-stat { display: inline-block; margin-top: 6px; }
.scanner-tabs { display: flex; gap: 6px; }

@media (max-width: 900px) {
    .diff-layout, .sim-layout { grid-template-columns: 1fr; }
}

/* nftables expression rows */
.nft-expr-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dotted var(--border);
}

.nft-expr-row select,
.nft-expr-row input[type="text"] {
    font-size: 0.82rem;
    padding: 4px 8px;
}

.nft-expr-row .form-group { margin-bottom: 0; }
.nft-expr-row .nft-expr-type { width: 90px; }
.nft-expr-row .nft-expr-field { width: 120px; }
.nft-expr-row .nft-expr-value { flex: 1; min-width: 100px; }

.nft-expr-remove {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    font-size: 1rem;
}
.nft-expr-remove:hover { color: var(--red); border-color: var(--red); }

.form-section {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.form-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.form-section-header label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* nftables chain form */
.nft-chain-form {
    margin-top: 8px;
    font-size: 0.82rem;
}

.nft-chain-form summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.78rem;
    margin-bottom: 8px;
}

.nft-chain-form .form-row { margin-bottom: 6px; }
.nft-chain-form .form-group { margin-bottom: 4px; }
.nft-chain-form label { font-size: 0.72rem; }
.nft-chain-form select, .nft-chain-form input { font-size: 0.78rem; padding: 3px 6px; }

@media (max-width: 900px) {
    .builder-layout, .ipset-layout {
        grid-template-columns: 1fr;
    }
    .rule-sidebar, .ipset-sidebar {
        position: static;
        max-height: none;
    }
    .nft-expr-row {
        flex-wrap: wrap;
    }
}
