:root {
    --bg: #090b10;
    --surface: #11151e;
    --surface-2: #171c28;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #edf2f7;
    --muted: #8b96a8;
    --primary: #e1306c;
    --primary-hover: #c9245c;
    --info: #58a6ff;
    --success: #3fb950;
    --warn: #d29922;
    --danger: #f85149;
    --radius: 14px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Custom Scrollbars for Overflow Containers --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.26);
}

/* --- Auth --- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

/* --- App Layout: Sticky Top Header + Main Canvas --- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    width: 100%;
    background: rgba(17, 21, 30, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.header-inner {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    min-width: 0;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
    margin-left: auto;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
}

.user-meta .subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.main-area {
    width: 100%;
    max-width: 1180px;
    min-width: 0;
    margin: 0 auto;
    padding: 22px 24px 36px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* --- Brand & Typography --- */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af);
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(221, 42, 123, 0.5);
}

.brand h1 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.subtitle {
    margin: 0;
    font-size: 0.76rem;
    color: var(--muted);
}

.url-tag {
    font-size: 0.72rem;
    color: var(--info);
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.25);
    border-radius: 6px;
    padding: 2px 8px;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.92;
}

/* --- Status Pills (Inline & Scroll-Safe) --- */
.status-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.pill-ok {
    color: var(--success);
    border-color: rgba(63, 185, 80, 0.35);
    background: rgba(63, 185, 80, 0.08);
}

.pill-info {
    color: var(--info);
    border-color: rgba(88, 166, 255, 0.35);
    background: rgba(88, 166, 255, 0.08);
}

.pill-warn {
    color: var(--warn);
    border-color: rgba(210, 153, 34, 0.4);
    background: rgba(210, 153, 34, 0.08);
}

.pill-muted {
    color: var(--muted);
}

.pill-err {
    color: #ff7b8a;
    border-color: rgba(255, 86, 108, 0.4);
    background: rgba(255, 86, 108, 0.1);
}

/* --- Primary Navigation (Horizontal Sticky Tabs) --- */
.tabs-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 10px;
}

.tabs-bar::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    flex-shrink: 0;
    white-space: nowrap;
    text-align: center;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover:not(:disabled) {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #fff;
    background: rgba(225, 48, 108, 0.18);
    border-color: rgba(225, 48, 108, 0.48);
}

/* --- Sub-navigation (Segmented Control inside Operations) --- */
.op-subnav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.op-subnav::-webkit-scrollbar {
    display: none;
}

.op-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 7px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.op-tab-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.op-tab-btn.active {
    color: #fff;
    background: var(--surface-2);
    border-color: var(--border-strong);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* --- Grid & Cards (Strict min-width: 0 against Overflow) --- */
.tab-panel {
    min-width: 0;
    max-width: 100%;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 860px) {
    .grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.card-wide {
    grid-column: 1 / -1;
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px 14px;
    min-width: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-head h2,
.card-head h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    min-width: 0;
    overflow-wrap: anywhere;
}

.quotas-drawer {
    border-color: var(--border-strong);
}

/* --- Forms & Controls --- */
.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    max-width: 100%;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

.field-row-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--muted);
    min-width: 0;
}

.inline-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 0.84rem;
    cursor: pointer;
    min-width: 0;
}

.inline-check input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.inline-form input:not([type="checkbox"]),
.inline-form select {
    flex: 1 1 160px;
    min-width: 0;
}

.inline-form .input-compact {
    flex: 0 1 115px;
    max-width: 125px;
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.86rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--info);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
    border-radius: 7px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.06);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger-ghost {
    background: transparent;
    border-color: rgba(248, 81, 73, 0.35);
    color: var(--danger);
}

.btn-danger-ghost:hover:not(:disabled) {
    background: rgba(248, 81, 73, 0.12);
}

.feedback {
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 0.83rem;
    border: 1px solid var(--border);
    background: var(--surface-2);
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.feedback.ok {
    border-color: rgba(63, 185, 80, 0.4);
    color: var(--success);
    background: rgba(63, 185, 80, 0.07);
}

.feedback.err {
    border-color: rgba(248, 81, 73, 0.45);
    color: var(--danger);
    background: rgba(248, 81, 73, 0.08);
}

/* --- Quotas --- */
.quota-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 10px;
    min-width: 0;
}

.quota-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    min-width: 0;
}

.quota-item.denied {
    opacity: 0.42;
}

.quota-title {
    font-weight: 600;
    color: var(--text);
    overflow-wrap: anywhere;
}

.quota-nums {
    color: var(--muted);
    font-size: 0.75rem;
}

.quota-bar-track {
    height: 4px;
    border-radius: 999px;
    background: var(--bg);
    overflow: hidden;
}

.quota-bar-fill {
    height: 100%;
    background: var(--info);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.quota-bar-fill.warn {
    background: var(--warn);
}

.quota-bar-fill.full {
    background: var(--danger);
}

/* --- Profile Card --- */
.recent-profiles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.recent-chip {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--info);
    font-size: 0.75rem;
    cursor: pointer;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: border-color 0.15s ease;
}

.recent-chip:hover {
    border-color: var(--info);
}

.profile-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.profile-top {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.profile-top > div:last-child {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

.avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
}

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 0.85rem;
}

.profile-bio {
    margin: 0;
    font-size: 0.83rem;
    color: var(--muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-height: 160px;
    overflow-y: auto;
}

.profile-link {
    font-size: 0.81rem;
    color: var(--info);
    overflow-wrap: anywhere;
    word-break: break-all;
}

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

.badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.badge-mini {
    padding: 1px 6px;
    font-size: 0.67rem;
}

/* --- Compact User Rows (Friendships & Relationships) --- */
.filter-row {
    width: 100%;
    max-width: 360px;
}

.user-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 2px 2px 0;
    min-width: 0;
}

.user-chip {
    padding: 8px 11px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.83rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
    min-width: 0;
    max-width: 100%;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.user-chip:hover {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.03);
}

.user-chip-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 140px;
    flex: 1 1 150px;
}

.chip-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
}

.user-chip-meta {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.user-chip-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.user-chip a {
    color: var(--info);
    text-decoration: none;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip a:hover {
    text-decoration: underline;
}

.user-chip-sub {
    font-size: 0.73rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.user-chip-actions .btn-sm {
    padding: 4px 8px;
    font-size: 0.72rem;
}

.user-chip:hover .user-chip-actions,
.user-chip:focus-within .user-chip-actions {
    opacity: 1;
}

@media (hover: none) {
    .user-chip-actions {
        opacity: 1;
    }
}

/* --- Relationship Analyzer Sub-tabs --- */
.rel-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.rel-tabs::-webkit-scrollbar {
    display: none;
}

.rel-tab {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 0.81rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rel-tab:hover {
    color: var(--text);
}

.rel-tab.active {
    color: #fff;
    background: rgba(225, 48, 108, 0.18);
    border-color: rgba(225, 48, 108, 0.5);
}

/* --- Batch Operations --- */
.batch-progress {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.batch-progress-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    min-width: 0;
}

.batch-progress-head span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-track {
    height: 7px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.25s ease;
}

.batch-results {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

.batch-row {
    font-size: 0.8rem;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px 10px;
    min-width: 0;
}

.batch-row > span:first-child {
    font-weight: 600;
    min-width: 0;
    overflow-wrap: anywhere;
}

.batch-row > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: right;
    flex: 1 1 auto;
}

.batch-row.fail {
    border-color: rgba(248, 81, 73, 0.45);
    color: var(--danger);
}

/* --- Monitor & Console --- */
.audit-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 8px;
    min-width: 0;
}

.screenshot-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#screenshot-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screenshot-img {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #06080c;
}

.audit-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

.audit-row {
    font-size: 0.78rem;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.audit-row > span:first-child {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.audit-row > span:last-child {
    flex-shrink: 0;
    white-space: nowrap;
}

.audit-row.fail {
    border-color: rgba(248, 81, 73, 0.4);
}

.console {
    margin: 0;
    padding: 14px;
    background: #06080c;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    min-height: 220px;
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    color: #c9d1d9;
    min-width: 0;
}

.log-err {
    color: var(--danger);
}

/* --- Admin Users & Permissions --- */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.admin-user-row {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.admin-user-row > div:first-child {
    min-width: 0;
    flex: 1 1 240px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.editor-box {
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 16px 18px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 10px;
    min-width: 0;
}

.perm-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.perm-limits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-width: 0;
}

.perm-limits input {
    padding: 5px 8px;
    font-size: 0.8rem;
}

/* --- Watchlist & Notifications --- */
.badge-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #e1306c;
    color: #fff;
    font-size: 0.71rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 12px;
    margin-top: 6px;
    min-width: 0;
}

.watch-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.watch-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.watch-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
    overflow-wrap: anywhere;
}

.watch-card-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    min-width: 0;
}

.watch-stats {
    font-size: 0.84rem;
    color: #dbe3f4;
    line-height: 1.45;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.watch-meta,
.watch-meta-inline {
    font-size: 0.76rem;
    color: #8f9bb3;
    overflow-wrap: anywhere;
}

.watch-error {
    font-size: 0.79rem;
    color: #ff7b8a;
    background: rgba(255, 86, 108, 0.1);
    border: 1px solid rgba(255, 86, 108, 0.25);
    border-radius: 6px;
    padding: 6px 8px;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.watch-diff-box {
    margin-top: 6px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(9, 11, 16, 0.55);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

.watch-diff-summary {
    font-size: 0.81rem;
    font-weight: 600;
    color: #e6ecf8;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.watch-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 6px;
    min-width: 0;
}

.alert-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.alert-card.unread {
    border-color: rgba(225, 48, 108, 0.55);
    background: rgba(225, 48, 108, 0.08);
}

.diff-line {
    font-size: 0.81rem;
    color: #cdd6e8;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.diff-added {
    color: #4ade80;
    font-weight: 600;
}

.diff-removed {
    color: #f87171;
    font-weight: 600;
}

.muted {
    font-size: 0.83rem;
    color: var(--muted);
}

/* --- Responsive Tweaks (Tablet & Mobile) --- */
@media (max-width: 768px) {
    .header-inner {
        padding: 10px 14px 0;
        gap: 8px;
    }

    .sidebar-top {
        gap: 8px 10px;
    }

    .brand-group {
        width: 100%;
        justify-content: space-between;
    }

    .status-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .status-pills::-webkit-scrollbar {
        display: none;
    }

    .sidebar-footer {
        width: 100%;
        justify-content: space-between;
        padding-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .url-tag {
        max-width: 140px;
    }

    .main-area {
        padding: 16px 12px 28px;
        gap: 14px;
    }

    .card {
        padding: 14px;
        border-radius: 12px;
    }

    .card-head {
        gap: 8px;
    }

    .card-head .btn-row {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .field-row,
    .field-row-3,
    .audit-filters {
        grid-template-columns: minmax(0, 1fr);
    }

    .inline-form {
        align-items: stretch;
    }

    .inline-form input:not([type="checkbox"]),
    .inline-form select,
    .inline-form .input-compact,
    .inline-form .btn {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .filter-row {
        max-width: 100%;
    }
}

.hidden {
    display: none !important;
}
