@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* Brand tokens — derived from opentagagent.com (dark navy + sky→cyan). */
:root {
    --navy: #04121f;
    --navy-2: #0a0f1c;
    --brand-gradient: linear-gradient(90deg, #38bdf8, #22d3ee);
    --brand-blue: #2b8cff;
    --brand-tint: rgba(56, 189, 248, 0.14);
    --ink: #0a1224;
    --muted: #6b7a99;
    --bg: #f6f8fc;
    --surface: #ffffff;
    --line: #e6e7ea;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: #1a1a1a;
}
.layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--navy);
    color: #d8d8dc;
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 22px 6px; }
.brand-logo { width: 100%; height: auto; display: block; border-radius: 8px; }
.brand-mark { width: 42px; height: 42px; flex-shrink: 0; display: block; filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.45)); }
.brand-wordmark { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -0.02em; white-space: nowrap; }
.sidebar-toggle { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: #9a9aa2; cursor: pointer; padding: 4px; border-radius: 6px; }
.sidebar-toggle:hover { background: #1c1c20; color: #fff; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #c2c2c8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav a:hover { background: #1c1c20; color: #fff; }
.nav a.active { background: #26262c; color: #fff; }
.nav a.disabled { color: #5a5a62; cursor: default; pointer-events: none; }
.nav .soon { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: #6a6a72; }
.nav .user-indicator {
    margin-top: auto;
    padding: 12px 12px 4px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid #26262c;
    overflow: hidden;
}
.nav .user-indicator strong {
    font-size: 12px;
    color: #c2c2c8;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.workspace-name-sidebar { font-size: 11px; color: #6a6a72; }
.nav .foot { margin: 0; }
.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    padding: 8px 12px;
    color: #9a9aa2;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    width: 100%;
}
.logout-btn:hover { background: #1c1c20; color: #fff; }

/* Collapsed sidebar — logo + icons only */
.sidebar { transition: width 0.18s ease; }
.sidebar.collapsed { width: 72px; padding-left: 10px; padding-right: 10px; }
.sidebar.collapsed .brand { flex-direction: column; align-items: center; gap: 16px; padding: 10px 0 22px 0; }
.sidebar.collapsed .brand-mark { width: 48px; height: 48px; }
.sidebar.collapsed .brand-wordmark { display: none; }
.sidebar.collapsed .sidebar-toggle { margin-left: 0; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar.collapsed .nav a { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .user-indicator { display: none; }
.sidebar.collapsed .logout-btn { justify-content: center; padding: 10px 0; }

/* Email-initials avatar — shown only when collapsed; pins the footer to the bottom */
.user-avatar {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    align-items: center;
    justify-content: center;
    margin: 12px auto 0;
    flex-shrink: 0;
}
.sidebar.collapsed .user-avatar { display: flex; margin-top: auto; }

/* Workspace switcher (hidden when the sidebar is collapsed) */
.ws-switcher { position: relative; margin: 0 0 18px 0; }
.ws-current {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e8eaf0; padding: 8px 10px; border-radius: 10px; cursor: pointer; font: inherit;
}
.ws-current:hover { background: rgba(255, 255, 255, 0.1); }
.ws-badge {
    width: 22px; height: 22px; border-radius: 6px; background: var(--brand-gradient);
    color: var(--navy); font-weight: 700; font-size: 11px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ws-name {
    flex: 1; min-width: 0; text-align: left; font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-caret { flex-shrink: 0; opacity: 0.7; }
.ws-menu {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
    background: #0d1a2b; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px;
    padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.ws-menu form { margin: 0; }
.ws-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: none; border: none; color: #c7ccd8; padding: 8px; border-radius: 8px;
    cursor: pointer; font: inherit;
}
.ws-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.ws-item.active { color: #fff; }
.ws-item .ws-check { margin-left: auto; color: var(--brand-blue); flex-shrink: 0; }
.sidebar.collapsed .ws-switcher { display: none; }

/* Content */
.content { flex: 1; padding: 32px 40px; overflow-y: auto; }
/* Bounded pages (usage, billing, …) center their content on wide displays
   instead of hugging the sidebar. The channels page (.content-full) is exempt. */
.content:not(.content-full) { display: flex; flex-direction: column; align-items: center; }
.content:not(.content-full) > * { width: 100%; max-width: 1000px; }
.content-full { padding: 0; max-width: none; display: flex; flex-direction: column; }
.content h1 { font-size: 22px; margin: 0 0 4px 0; }
.content .sub { color: #6a6a72; margin: 0 0 26px 0; font-size: 14px; }

.card { background: #fff; border: 1px solid #e6e7ea; border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.stats .card { flex: 1; min-width: 200px; margin-bottom: 0; }
.stat-num { font-size: 34px; font-weight: 700; line-height: 1; }
.stat-label { color: #6a6a72; font-size: 13px; margin-top: 6px; }
.btn { display: inline-block; background: var(--brand-gradient); color: #fff; text-decoration: none; padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; }
.btn:hover { opacity: 0.88; }
.btn.secondary { background: #fff; color: #111; border: 1px solid #d4d5d9; }
.banner { background: #fff6e5; border: 1px solid #f0c869; border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.banner-error { background: #fce8e6; border-color: #e0b4ae; color: #b3261e; }
.banner-success { background: #e6f4ea; border-color: #b4dbc2; color: #1a7f37; }
.banner-warning { background: #fff6e5; border-color: #f0c869; color: #8a6d00; }
.banner-info { background: #e8f0fe; border-color: #aec7e8; color: #174ea6; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid #f0f0f2; font-size: 14px; }
.row:last-child { border-bottom: none; }
.muted { color: #8a8a92; }
.pos { color: #1a7f37; font-weight: 600; }
.neg { color: #b3261e; font-weight: 600; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #eee; }
.pill.captured { background: #e6f4ea; color: #1a7f37; }
.pill.failed { background: #fce8e6; color: #b3261e; }
.pill.pending { background: #fef3d9; color: #8a6d00; }
.pill.refunded { background: #eef; color: #445; }
.grid { display: flex; gap: 18px; flex-wrap: wrap; }
.grid .col { flex: 1; min-width: 280px; }
.grid .card { margin-bottom: 0; }
h3 { font-size: 16px; margin: 0 0 12px 0; }
.spread { display: flex; justify-content: space-between; align-items: center; }
.packs { display: flex; gap: 16px; flex-wrap: wrap; }
.pack { border: 1px solid #e6e7ea; border-radius: 12px; padding: 20px; width: 200px; background: #fff; }
.pack h2 { margin: 0 0 6px 0; font-size: 18px; }

/* Channels page: Slack-style three-pane layout */
.channels-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Middle column: channel / DM list */
.channel-list {
    width: 280px;
    flex-shrink: 0;
    background: #1b1d21;
    color: #c2c2c8;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #2c2f35;
}

.channel-list-header {
    padding: 18px 16px 14px;
    border-bottom: 1px solid #2c2f35;
}

.workspace-name {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.channel-search {
    width: 100%;
    background: #0f1013;
    border: 1px solid #2c2f35;
    border-radius: 6px;
    padding: 8px 12px;
    color: #d8d8dc;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.channel-search:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 1px var(--brand-blue);
}

.channel-search::placeholder { color: #6a6a72; }

.channel-list-section {
    padding: 16px 0;
    overflow-y: auto;
    flex: 1;
}

.channel-list-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6a6a72;
    padding: 0 16px 8px;
    margin: 0;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 10px;
    padding: 6px 10px;
    border-radius: 6px;
    color: #c2c2c8;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
}

.channel-item:hover {
    background: #26282d;
    color: #fff;
}

.channel-item.active {
    background: var(--brand-blue);
    color: #fff;
}

.channel-item-muted {
    color: #6a6a72;
    cursor: default;
}

.channel-item-muted:hover {
    background: transparent;
    color: #6a6a72;
}

.channel-prefix {
    color: #6a6a72;
    font-size: 15px;
    line-height: 1;
    width: 16px;
    text-align: center;
}

.channel-item.active .channel-prefix { color: #fff; }

/* Right column: chat-area for integrations */
.integration-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 24px;
    background: #fff;
    border-bottom: 1px solid #e6e7ea;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    z-index: 10;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.chat-header-prefix {
    color: #6a6a72;
    font-size: 18px;
    font-weight: 600;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

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

.integration-search-bar {
    flex: 0 0 auto;
}

.integration-filter-tabs {
    margin-left: auto;
    display: flex;
    gap: 6px;
    background: #fff;
    border: 1px solid #e6e7ea;
    padding: 3px;
    border-radius: 8px;
}

.integration-filter-tab {
    font-size: 13px;
    font-weight: 600;
    color: #6a6a72;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.integration-filter-tab:hover { color: #1a1a1a; }

.integration-filter-tab.active {
    background: #111;
    color: #fff;
}

.integration-search {
    width: 100%;
    max-width: 360px;
    padding: 10px 14px;
    border: 1px solid #d4d5d9;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.integration-search:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 1px rgba(17, 100, 163, 0.2);
}

.integration-search::placeholder { color: #8a8a92; }

.channel-tabs {
    display: flex;
    gap: 8px;
    background: #f0f0f2;
    padding: 4px;
    border-radius: 8px;
    flex-shrink: 0;
    position: relative;
}

.channel-tab {
    font-size: 13px;
    font-weight: 600;
    color: #6a6a72;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
    overflow: hidden;
}

.channel-tab:hover { color: #1a1a1a; }

.channel-tab.active {
    background: #fff;
    color: #111;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Progress-bar indicator that grows from the left on active tab */
.channel-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--brand-blue);
    border-radius: 2px 2px 0 0;
    transform: scaleX(0);
    transform-origin: left;
    animation: progress-from-left 0.35s ease-out forwards;
}

@keyframes progress-from-left {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* Integrations tab content slides in from the left */
.tab-content.integrations-active {
    animation: slide-from-left 0.3s ease-out;
}

@keyframes slide-from-left {
    from {
        opacity: 0;
        transform: translateX(-18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.integration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    grid-auto-rows: minmax(180px, auto);
    gap: 20px;
    align-content: start;
}

.integration-card {
    position: relative;
    background: #fff;
    border: 1px solid #e6e7ea;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.integration-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border-color: #d4d5d9;
    transform: translateY(-1px);
}

.integration-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.integration-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: contain;
    background: #f6f7f9;
    border: 1px solid #e6e7ea;
    flex-shrink: 0;
}

.integration-name {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
}

.integration-auth {
    font-size: 11px;
    color: #8a8a92;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 3px;
}

.native-tag {
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #eef1ff;
    color: #4553c7;
    font-weight: 600;
}

.integration-desc {
    font-size: 13px;
    color: #6a6a72;
    line-height: 1.5;
    margin: 0;
    flex: 1;
    min-height: 0;
    max-height: 84px;
    overflow-y: auto;
    padding-right: 4px;
}

.integration-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 4px;
}

.integration-status {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}

.integration-status.connected { background: #e6f4ea; color: #1a7f37; }
.integration-status.disconnected { background: #f0f0f2; color: #6a6a72; }
.global-corner {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--brand-tint);
    color: var(--brand-blue);
    cursor: default;
}

.btn-connect {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.btn-connect.connect { background: var(--brand-gradient); color: #fff; }
.btn-connect.connect:hover { opacity: 0.85; }

.btn-connect.disconnect {
    background: #fff;
    color: #111;
    border: 1px solid #d4d5d9;
}

.btn-connect.disconnect:hover { background: #f6f7f9; }

.empty-state {
    grid-column: 1 / -1;
    padding: 80px 24px;
    text-align: center;
    color: #6a6a72;
    font-size: 14px;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f6f7f9;
}

.trigger-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 800px;
}

.trigger-card {
    background: #fff;
    border: 1px solid #e6e7ea;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.trigger-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border-color: #d4d5d9;
}

.trigger-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.trigger-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.trigger-meta {
    font-size: 12px;
    color: #6a6a72;
    margin-top: 4px;
}

.trigger-prompt {
    font-size: 13px;
    color: #6a6a72;
    line-height: 1.5;
    margin: 0;
    background: #f6f7f9;
    border: 1px solid #e6e7ea;
    border-radius: 8px;
    padding: 12px;
}

.trigger-actions {
    display: flex;
    gap: 10px;
}

.bot-pane {
    max-width: 640px;
}

.task-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-input {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid #e6e7ea;
    border-radius: 8px;
    padding: 10px 12px;
}

.task-input:focus {
    outline: none;
    border-color: var(--brand-blue, #1a1a1a);
    box-shadow: 0 0 0 3px var(--brand-tint, rgba(26,26,26,0.08));
}

.task-input::placeholder { color: #9a9aa2; }

textarea.task-input {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

.task-schedule-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.task-schedule-row .task-input { width: auto; flex: 1 1 160px; min-width: 140px; }
.task-schedule-row input[type="time"].task-input,
.task-schedule-row input[type="number"].task-input { flex: 0 0 auto; min-width: 120px; }

.task-card-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.task-history {
    font-size: 12px;
    color: #6a6a72;
    flex: 1;
    min-width: 0;
}

.task-history summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.task-history summary::-webkit-details-marker { display: none; }

.task-history-toggle {
    color: #9a9aa2;
    font-weight: 700;
}

.task-history-toggle::after { content: " ▾"; }

.task-history[open] .task-history-toggle::after { content: " ▴"; }

.task-history summary:hover .task-history-toggle { color: #1a1a1a; }

.task-history-table {
    margin-top: 10px;
    border-collapse: collapse;
    min-width: 280px;
}

.task-history-table td {
    padding: 5px 18px 5px 0;
    border-top: 1px solid #f0f0f2;
    white-space: nowrap;
}

.task-history-cost {
    text-align: right;
    color: #9a9aa2;
}

.task-run-status {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f0f0f2;
    color: #6a6a72;
}

.task-run-status.status-4 { background: #e6f4ea; color: #1a7f37; }
.task-run-status.status-5 { background: #fdecea; color: #b3261e; }
.task-run-status.status-2 { background: var(--brand-tint); color: var(--brand-blue); }

.task-actions {
    display: flex;
    gap: 10px;
}

.topup-amounts {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.topup-custom { width: 110px; }

.topup-note { font-size: 12px; margin: 0 0 14px 0; }

.topup-error { font-size: 13px; color: #b3261e; margin: 10px 0 0 0; }

/* Mobile nav: hamburger + off-canvas drawer (hidden above the breakpoint) */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 210;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: var(--navy);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
}
.sidebar.mobile-open ~ .mobile-menu-toggle { display: none; }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 18, 31, 0.55);
    z-index: 150;
}
.sidebar-backdrop.visible { display: block; }

/* Responsive breakpoints */
@media (max-width: 860px) {
    .layout { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
    .mobile-menu-toggle { display: flex; }
    .sidebar-toggle { display: none; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 240px !important;
        max-width: 82vw;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }
    .sidebar.mobile-open { transform: translateX(0); }
    /* The desktop icon-rail collapse is meaningless on mobile — always render expanded. */
    .sidebar.collapsed { width: 240px !important; padding: 22px 14px; }
    .sidebar.collapsed .brand { flex-direction: row; align-items: center; gap: 10px; padding: 4px 6px 22px 6px; }
    .sidebar.collapsed .brand-mark { width: 42px; height: 42px; }
    .sidebar.collapsed .brand-wordmark { display: inline; }
    .sidebar.collapsed .nav a { justify-content: flex-start; padding: 10px 12px; }
    .sidebar.collapsed .nav-label { display: inline; }
    .sidebar.collapsed .user-indicator { display: flex; }
    .sidebar.collapsed .logout-btn { justify-content: flex-start; padding: 8px 12px; }
    .sidebar.collapsed .user-avatar { display: none; }
    .sidebar.collapsed .ws-switcher { display: block; }

    .content { padding: 64px 16px 20px; }
    .content-full { padding: 64px 0 0 0; }

    .stats, .grid, .packs { gap: 12px; }
    .table-scroll { overflow-x: auto; }

    .channels-layout { flex-direction: column; }
    .channel-list {
        width: 100%;
        max-height: 38vh;
        border-right: none;
        border-bottom: 1px solid #2c2f35;
    }
    .integration-pane { min-height: 0; }
    .chat-header { flex-wrap: wrap; row-gap: 10px; padding: 14px 16px; }
    .chat-header-right { flex-wrap: wrap; }
    .channel-tabs { flex-wrap: wrap; }
    .tab-content { padding: 16px; }
    .integration-toolbar { gap: 10px; }
    .integration-filter-tabs { margin-left: 0; }
    .integration-search-bar, .integration-search { max-width: none; }
}

@media (max-width: 640px) {
    .task-history-table { min-width: 0; }
}

@media (max-width: 480px) {
    .auth-card { padding: 32px 22px; }
    .auth-card .brand-logo { max-width: 160px; }
    .stat-num { font-size: 26px; }
    .task-schedule-row .task-input { flex: 1 1 100%; }
}

/* Notifications modal — pick which app events ping a channel */
.notify-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 18, 31, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 60;
}

.notify-backdrop[hidden] {
    display: none;
}

.notify-modal {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    width: min(520px, 100%);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 18px 48px rgba(4, 18, 31, 0.18);
}

.notify-events {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}

.notify-event {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}

.notify-event:hover {
    border-color: var(--brand-blue);
}

.notify-event input {
    margin-top: 3px;
}

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