:root {
    --bg: #f6f3ee;
    --ink: #1c1917;
    --muted: #756b61;
    --line: #e4ddd3;
    --panel: #fffaf3;
    --panel-strong: #ffffff;
    --brand: #0f766e;
    --brand-dark: #0f4f4a;
    --gold: #c98722;
    --violet: #6d5bd0;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Tajawal, ui-sans-serif, system-ui, sans-serif;
    overflow-x: hidden;
}

body,
body * {
    pointer-events: auto;
}

.admin-app {
    isolation: isolate;
    position: relative;
    z-index: 2147483647;
    opacity: 1 !important;
    filter: none !important;
}

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

a {
    color: inherit;
}

.shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    position: relative;
    min-height: 100vh;
    padding: 28px;
    background: #181512;
    color: #fff8eb;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.mobile-menu-toggle,
.mobile-menu-close {
    display: none;
}

.admin-app::before {
    display: none;
}

body:not(.menu-open) .admin-app::before {
    display: none !important;
    content: none !important;
    background: transparent !important;
}

.admin-app,
.shell,
.main,
.sidebar {
    opacity: 1 !important;
    filter: none !important;
    mix-blend-mode: normal !important;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 46px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand);
    color: white;
    font-weight: 800;
    font-size: 24px;
    overflow: hidden;
}

.brand-mark.has-logo {
    width: 82px;
    background: #ffffff;
    color: var(--ink);
    padding: 4px;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: #cfc2ad;
    margin-top: 4px;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #f2eadc;
    text-decoration: none;
    padding: 13px 14px;
    border-radius: 8px;
}

.nav a:hover,
.nav a.active {
    background: #27221d;
    color: #ffffff;
}

.nav-badge {
    min-width: 26px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 12px;
    padding: 0 7px;
}

.sidebar-card {
    margin-top: auto;
    padding: 18px;
    border-radius: 8px;
    background: #27221d;
    border: 1px solid #3d352c;
}

.sidebar-card span,
.eyebrow {
    color: var(--gold);
    font-size: 13px;
    font-weight: 800;
}

.sidebar-card strong,
.sidebar-card p {
    display: block;
    margin-top: 8px;
}

.sidebar-card p {
    color: #d8cab7;
    line-height: 1.7;
    margin-bottom: 0;
}

.main {
    padding: 32px;
    min-width: 0;
    position: relative;
    background: var(--bg);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(30px, 4vw, 54px);
    line-height: 1.08;
    margin-top: 8px;
    max-width: 780px;
}

h2 {
    font-size: 22px;
}

.topbar p {
    color: var(--muted);
    margin-top: 12px;
    font-size: 18px;
}

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

.button,
.top-actions button,
.top-actions a,
.form-actions button,
.form-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1px solid var(--line);
    background: #fffaf3;
    color: var(--ink);
    border-radius: 8px;
    padding: 12px 18px;
    cursor: pointer;
}

.primary,
.top-actions .primary {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

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

.stat-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(44, 36, 25, 0.06);
}

.stat-card {
    padding: 20px;
}

.stat-card span,
.stat-card small {
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin: 12px 0 8px;
    font-size: 32px;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
    gap: 18px;
    margin-bottom: 18px;
}

.content-grid .wide:first-child {
    grid-column: span 1;
}

.panel {
    padding: 22px;
    min-width: 0;
}

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

.panel-head strong {
    color: var(--brand-dark);
    white-space: nowrap;
}

.compact {
    margin-bottom: 14px;
}

.campaign-list,
.category-list,
.pipeline {
    display: grid;
    gap: 12px;
}

.campaign-row {
    display: grid;
    gap: 10px;
    padding: 15px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.campaign-row strong,
.campaign-row span {
    display: block;
}

.campaign-row span,
.campaign-meta {
    color: var(--muted);
}

.campaign-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14px;
}

.progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #ece3d6;
}

.progress i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--gold));
}

.pipeline div,
.category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.pipeline strong {
    font-size: 24px;
}

.category-row {
    justify-content: flex-start;
}

.category-row i {
    width: 12px;
    height: 42px;
    border-radius: 99px;
    background: var(--brand);
    flex: 0 0 auto;
}

.category-row div {
    min-width: 0;
    flex: 1;
}

.category-row strong,
.category-row span {
    display: block;
}

.category-row span {
    color: var(--muted);
    margin-top: 4px;
}

.category-row b {
    font-size: 24px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

th,
td {
    text-align: right;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 14px;
}

td strong,
td span {
    display: block;
}

td span {
    color: var(--muted);
    margin-top: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 7px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
}

.badge.new {
    background: #e0f2fe;
    color: #075985;
}

.badge.contacted {
    background: #ede9fe;
    color: #5b21b6;
}

.badge.qualified {
    background: #dcfce7;
    color: #166534;
}

.badge.won {
    background: #ccfbf1;
    color: #115e59;
}

.badge.lost {
    background: #fee2e2;
    color: var(--danger);
}

.badge.active,
.badge.running {
    background: #dcfce7;
    color: #166534;
}

.badge.paused,
.badge.draft,
.badge.not_started {
    background: #fef3c7;
    color: #92400e;
}

.badge.archived,
.badge.completed,
.badge.inactive,
.badge.ended {
    background: #e5e7eb;
    color: #374151;
}

.badge.subscription-normal {
    background: #dcfce7;
    color: #166534;
}

.badge.subscription-expiring {
    background: #fef3c7;
    color: #92400e;
}

.badge.subscription-expired {
    background: #fee2e2;
    color: var(--danger);
}

.badge.campaign-ending_tomorrow {
    background: #fef3c7;
    color: #92400e;
}

.badge.campaign-ended {
    background: #ede9fe;
    color: #5b21b6;
}

.badge.executive {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.executive-row td {
    background: #f0fdf4;
    border-bottom-color: #bbf7d0;
}

.executive-row td:first-child {
    border-right: 4px solid #16a34a;
}

.executive-row strong {
    color: #14532d;
}

.executive-note {
    color: #166534;
    font-weight: 800;
    white-space: nowrap;
}

.traffic-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 9px 14px;
    text-decoration: none;
    font-weight: 800;
}

.traffic-button.clicks {
    background: #ecfeff;
    border-color: #a5f3fc;
    color: #155e75;
}

.traffic-button.visits {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.traffic-button.disabled {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.traffic-note {
    display: block;
    color: var(--muted);
    margin-top: 7px;
    font-size: 13px;
}

.refresh-button {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
    font-weight: 800;
}

.chat-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 18px;
}

.chat-box,
.chat-sidebox {
    padding: 20px;
}

.chat-box-head,
.chat-sidebox-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.chat-box-head strong,
.chat-live-dot {
    color: var(--brand-dark);
    white-space: nowrap;
}

.chat-sidebox {
    position: sticky;
    top: 24px;
    box-shadow: 0 18px 42px rgba(44, 36, 25, 0.09);
}

.chat-sidebox h2 {
    margin: 4px 0 0;
    font-size: 24px;
}

.chat-live-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    background: #ecfdf5;
    color: #166534;
    font-size: 12px;
    font-weight: 800;
}

.chat-live-dot::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.chat-panel {
    display: grid;
    grid-template-rows: minmax(360px, 62vh) auto;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.chat-sidebox-panel {
    display: grid;
    grid-template-rows: minmax(360px, calc(100vh - 330px)) auto;
    min-height: 500px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.chat-feed {
    display: grid;
    align-content: start;
    gap: 12px;
    overflow-y: auto;
    padding: 22px;
    background:
        linear-gradient(rgba(255, 250, 243, 0.94), rgba(255, 250, 243, 0.94)),
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 32%),
        radial-gradient(circle at bottom left, rgba(201, 135, 34, 0.1), transparent 28%);
}

.chat-feed-compact {
    gap: 10px;
    padding: 16px;
}

.chat-message {
    display: flex;
}

.chat-message.mine {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: min(620px, 82%);
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(44, 36, 25, 0.06);
}

.chat-feed-compact .chat-bubble {
    max-width: 94%;
    padding: 11px 12px;
}

.chat-feed-compact .chat-meta {
    gap: 10px;
}

.chat-feed-compact .chat-bubble p {
    font-size: 14px;
}

.chat-message.mine .chat-bubble {
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.chat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.chat-meta strong {
    color: var(--brand-dark);
}

.chat-meta span,
.chat-empty {
    color: var(--muted);
    font-size: 13px;
}

.chat-bubble p {
    line-height: 1.8;
    white-space: pre-wrap;
}

.chat-empty {
    padding: 18px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--line);
    background: #fffaf3;
}

.chat-form textarea {
    min-height: 54px;
    max-height: 160px;
    resize: vertical;
}

.chat-form button {
    min-width: 96px;
    border: 1px solid var(--brand);
    border-radius: 8px;
    cursor: pointer;
}

.chat-form-compact {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
}

.chat-form-compact textarea {
    min-height: 48px;
}

.chat-form-compact button {
    width: 100%;
}

.floating-chat {
    position: fixed !important;
    top: auto !important;
    right: auto !important;
    left: 28px !important;
    bottom: 24px !important;
    z-index: 90;
    display: block;
    width: 0 !important;
    height: 0 !important;
    justify-items: start;
    pointer-events: none;
}

[data-floating-chat] {
    position: fixed !important;
    top: auto !important;
    right: auto !important;
    left: 28px !important;
    bottom: 24px !important;
    z-index: 2147483647 !important;
    transform: none !important;
    display: block !important;
    direction: ltr;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

.floating-chat-button,
.floating-chat-window {
    direction: rtl;
    pointer-events: auto;
}

.floating-chat-button {
    position: absolute;
    left: 0;
    bottom: 0;
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    width: max-content;
    min-width: 166px;
    min-height: 54px;
    padding: 12px 18px;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 999px;
    background: linear-gradient(135deg, #0f766e, #0d9488);
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 18px 38px rgba(15, 118, 110, 0.25);
    pointer-events: auto;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
}

.floating-chat-button > span:not(.floating-chat-icon) {
    white-space: nowrap;
}

.floating-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(15, 118, 110, 0.32);
}

.floating-chat-icon {
    position: relative;
    width: 26px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.92);
    border-radius: 8px;
}

.floating-chat-icon::after {
    content: "";
    position: absolute;
    right: 4px;
    bottom: -7px;
    width: 9px;
    height: 9px;
    border-right: 2px solid rgba(255, 255, 255, 0.92);
    border-bottom: 2px solid rgba(255, 255, 255, 0.92);
    background: #0d9488;
    transform: rotate(45deg);
}

.floating-chat-icon span {
    position: absolute;
    right: 5px;
    left: 5px;
    height: 2px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
}

.floating-chat-icon span:nth-child(1) {
    top: 5px;
}

.floating-chat-icon span:nth-child(2) {
    top: 10px;
}

.floating-chat-icon span:nth-child(3) {
    top: 15px;
}

.floating-chat-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
}

.floating-chat-badge.is-hidden {
    display: none;
}

.floating-chat-window {
    position: absolute;
    left: 0;
    bottom: 66px;
    width: min(390px, calc(100vw - 32px));
    height: min(720px, calc(100dvh - 112px));
    max-height: calc(100dvh - 112px);
    overflow: hidden;
    border: 1px solid rgba(217, 205, 188, 0.9);
    border-radius: 12px;
    background: #fffaf3;
    box-shadow: 0 24px 64px rgba(44, 36, 25, 0.22);
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s ease;
    flex-direction: column;
}

.floating-chat:not(.is-open) .floating-chat-window {
    display: none !important;
}

.floating-chat.is-open .floating-chat-window {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.floating-chat-head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.floating-chat-head h2 {
    margin: 4px 0 0;
    font-size: 22px;
}

.floating-chat-head button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf3;
    color: var(--brand-dark);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.floating-chat-panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-switcher {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 12px 0;
    background: #fffaf3;
}

.chat-switcher button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
}

.chat-switcher button.active {
    border-color: rgba(15, 118, 110, 0.22);
    background: #ecfdf5;
    color: var(--brand-dark);
}

.chat-call-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 12px 0;
    background: #fffaf3;
}

.chat-call-bar button,
.chat-call-actions button {
    min-height: 38px;
    border: 1px solid rgba(15, 118, 110, 0.2);
    border-radius: 8px;
    background: #f0fdfa;
    color: var(--brand-dark);
    cursor: pointer;
    font-weight: 800;
}

.chat-call-bar button:last-child {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.chat-call-panel {
    display: grid;
    gap: 10px;
    margin: 10px 12px 0;
    padding: 12px;
    border: 1px solid #99f6e4;
    border-radius: 10px;
    background: #f0fdfa;
}

.chat-call-panel.is-hidden {
    display: none;
}

.chat-call-panel strong,
.chat-call-panel span {
    display: block;
}

.chat-call-panel strong {
    color: var(--brand-dark);
}

.chat-call-panel span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.chat-call-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-call-actions button {
    flex: 1;
    min-width: 82px;
}

.chat-call-actions .accept {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.chat-call-actions .danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.chat-call-media {
    display: none;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
    align-items: end;
}

.chat-call-panel.is-live .chat-call-media {
    display: grid;
}

.chat-call-media video {
    width: 100%;
    min-height: 150px;
    border-radius: 8px;
    background: #111827;
    object-fit: cover;
}

.chat-call-media video[data-chat-local-video] {
    min-height: 76px;
    border: 2px solid #ffffff;
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.2);
}

.chat-member-select {
    display: grid;
    gap: 7px;
    padding: 10px 12px 12px;
    background: #fffaf3;
}

.chat-member-select.is-hidden {
    display: none;
}

.chat-member-select span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.chat-member-select select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.floating-chat .chat-feed {
    flex: 1;
    border: 0;
    min-height: 0;
    overflow-y: auto;
}

.floating-chat .chat-form {
    flex: 0 0 auto;
    border-bottom-right-radius: 12px;
    border-bottom-left-radius: 12px;
}

.floating-chat .chat-form textarea {
    min-height: 64px;
    max-height: 96px;
    resize: none;
}

.floating-chat .chat-form button {
    min-height: 48px;
}

.subscription-row.expiring td {
    background: #fffdf5;
    border-bottom-color: #f6d365;
}

.subscription-row.expired td {
    background: #fff7f7;
    border-bottom-color: #f3a4a4;
}

.subscription-row.expiring td:first-child {
    border-right: 4px solid #d97706;
}

.subscription-row.expired td:first-child {
    border-right: 4px solid var(--danger);
}

.campaign-deadline-row.ending_tomorrow td {
    background: #fffdf5;
    border-bottom-color: #f6d365;
}

.campaign-deadline-row.ended td {
    background: #f7f3ff;
    border-bottom-color: #c4b5fd;
}

.campaign-deadline-row.ending_tomorrow td:first-child {
    border-right: 4px solid #d97706;
}

.campaign-deadline-row.ended td:first-child {
    border-right: 4px solid #7c3aed;
}

.renewal-alerts {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.renewal-alert {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.renewal-alert.expiring {
    background: #fffdf5;
    color: #78350f;
    border-color: #fcd34d;
}

.renewal-alert.expired {
    background: #fff7f7;
    color: #991b1b;
    border-color: #fca5a5;
}

.campaign-alert {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.campaign-alert.ending_tomorrow {
    background: #fffdf5;
    color: #78350f;
    border-color: #fcd34d;
}

.campaign-alert.ended {
    background: #f7f3ff;
    color: #4c1d95;
    border-color: #c4b5fd;
}

.stat-card.expiring {
    background: #fffbeb;
    border-color: #fcd34d;
}

.stat-card.expired {
    background: #fff1f2;
    border-color: #fca5a5;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 8px;
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
    font-weight: 800;
}

.logout-button {
    width: 100%;
    margin-top: 14px;
    border: 1px solid #4c4237;
    background: transparent;
    color: #fff8eb;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
}

.sidebar-link {
    display: flex;
    justify-content: center;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #4c4237;
    color: #fff8eb;
    text-decoration: none;
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 10px;
    margin-bottom: 18px;
}

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

.form-grid.single {
    grid-template-columns: 1fr;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 12px 13px;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

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

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.form-section-title {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.logo-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.logo-preview span {
    color: var(--muted);
    font-weight: 800;
}

.logo-preview img,
.logo-preview strong {
    width: 120px;
    height: 68px;
    border-radius: 8px;
    background: var(--brand);
}

.logo-preview img {
    object-fit: contain;
    padding: 8px;
    background: #ffffff;
    border: 1px solid var(--line);
}

.logo-preview strong {
    display: grid;
    place-items: center;
    color: #ffffff;
    font-size: 28px;
}

.field-error,
.error-box,
.field-hint {
    color: var(--danger);
    font-size: 14px;
}

.field-hint {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.7;
}

.login-state {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.error-box {
    margin-top: 16px;
    padding: 12px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    border-radius: 8px;
}

.actions {
    white-space: nowrap;
}

.actions a,
.actions form,
.actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.actions a,
.actions button {
    min-width: 58px;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 12px;
    box-shadow: 0 6px 14px rgba(44, 36, 25, 0.06);
    cursor: pointer;
    text-decoration: none;
    font-weight: 800;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.actions a:hover,
.actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(44, 36, 25, 0.12);
}

.actions a:active,
.actions button:active {
    transform: translateY(0);
}

.actions a:nth-of-type(1) {
    background: #ecfeff;
    border-color: #a5f3fc;
    color: #155e75;
}

.actions a:nth-of-type(1):hover {
    background: #cffafe;
}

.actions a:nth-of-type(2) {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.actions a:nth-of-type(2):hover {
    background: #fef3c7;
}

.actions button {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.actions button:hover {
    background: #ffe4e6;
}

.actions a,
.actions form {
    margin-inline-start: 8px;
}

.actions form {
    margin-block: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.detail-grid div {
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.detail-grid span,
.detail-grid strong {
    display: block;
}

.detail-grid span {
    color: var(--muted);
    margin-bottom: 8px;
}

nav[role="navigation"] {
    margin-top: 16px;
}

nav[role="navigation"] > div:first-child {
    display: none;
}

nav[role="navigation"] a,
nav[role="navigation"] span {
    display: inline-flex;
    min-width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    margin: 3px;
    border-radius: 8px;
    border: 1px solid var(--line);
    text-decoration: none;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #181512;
}

.auth-card {
    width: min(100%, 460px);
    padding: 30px;
    background: var(--panel);
    border-radius: 8px;
    border: 1px solid var(--line);
}

.auth-brand {
    color: var(--ink);
    margin-bottom: 24px;
}

.auth-card h1 {
    font-size: 34px;
}

.auth-card p {
    color: var(--muted);
    margin: 8px 0 22px;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-line input {
    width: auto;
}

.full {
    width: 100%;
}

.auth-submit {
    position: relative;
    overflow: hidden;
    min-height: 56px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 55%, #0f766e 100%);
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    box-shadow: 0 16px 32px rgba(15, 118, 110, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.auth-submit::before {
    content: "";
    position: absolute;
    inset: 1px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 11px;
    pointer-events: none;
}

.auth-submit::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(115%);
    transition: transform 0.48s ease;
}

.auth-submit:hover {
    transform: translateY(-2px);
    filter: saturate(1.08);
    box-shadow: 0 20px 38px rgba(15, 118, 110, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.auth-submit:hover::after {
    transform: translateX(-115%);
}

.auth-submit:active {
    transform: translateY(0);
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

@media (max-width: 1100px) {
    .shell {
        grid-template-columns: 1fr;
        z-index: auto;
    }

    .sidebar {
        position: fixed;
        inset: 0 0 0 auto;
        z-index: 50;
        width: min(86vw, 360px);
        min-height: 100dvh;
        overflow-y: auto;
        transform: translateX(105%);
        box-shadow: -24px 0 60px rgba(24, 21, 18, 0.28);
        transition: transform 0.22s ease;
    }

    .menu-open .sidebar {
        transform: translateX(0);
    }

    .main {
        padding-top: 104px;
    }

    .mobile-menu-toggle {
        position: fixed;
        top: 20px;
        right: auto;
        left: 18px;
        z-index: 60;
        display: grid;
        grid-template-columns: 18px auto;
        grid-template-rows: repeat(3, 2px);
        align-items: center;
        column-gap: 10px;
        row-gap: 4px;
        border: 1px solid rgba(15, 118, 110, 0.18);
        border-radius: 8px;
        background: var(--brand);
        color: #ffffff;
        padding: 12px 14px;
        box-shadow: 0 14px 32px rgba(15, 118, 110, 0.22);
        cursor: pointer;
        font-weight: 800;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 18px;
        height: 2px;
        grid-column: 1;
        border-radius: 99px;
        background: currentColor;
    }

    .mobile-menu-toggle b {
        display: block;
        grid-column: 2;
        grid-row: 1 / 4;
        font-weight: 800;
    }

    .mobile-menu-toggle[aria-expanded="true"] {
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px);
    }

    .mobile-menu-close {
        display: none;
    }

    .menu-open .admin-app::before {
        content: "";
        display: block;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(24, 21, 18, 0.35);
        pointer-events: auto;
    }

    .menu-open .floating-chat {
        display: none;
    }

    .floating-chat {
        top: auto !important;
        left: 14px !important;
        right: 14px !important;
        bottom: 16px !important;
    }

    [data-floating-chat] {
        top: auto !important;
        left: 14px !important;
        right: auto !important;
        bottom: 16px !important;
        display: block !important;
        width: 0 !important;
        height: 0 !important;
    }

    .floating-chat-window {
        left: 0;
        bottom: 64px;
        width: calc(100vw - 28px);
        height: min(620px, calc(100dvh - 96px));
        max-height: calc(100dvh - 96px);
    }

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

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

@media (max-width: 720px) {
    .main,
    .sidebar {
        padding: 20px;
    }

    .main {
        padding-top: 104px;
    }

    .topbar,
    .panel-head {
        display: grid;
    }

    .topbar {
        padding-top: 22px;
    }

    .stats-grid,
    .content-grid,
    .form-grid,
    .filters,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 34px;
    }

    .panel {
        padding: 18px;
    }

    .table-wrap {
        overflow: visible;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
        width: 100%;
    }

    table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0;
    }

    thead {
        display: none;
    }

    tbody {
        display: grid;
        gap: 14px;
    }

    tr {
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fffaf3;
        box-shadow: 0 12px 28px rgba(44, 36, 25, 0.06);
    }

    td {
        display: grid;
        grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--line);
        text-align: right;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 13px;
        font-weight: 800;
    }

    td[data-label=""] {
        grid-template-columns: 1fr;
    }

    td[data-label=""]::before {
        display: none;
    }

    td:first-child {
        padding-top: 0;
    }

    td:first-child strong {
        font-size: 17px;
    }

    td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    td.actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
        white-space: normal;
    }

    td.actions::before {
        display: none;
    }

    .actions a,
    .actions form {
        margin-inline-start: 0;
    }

    .actions a,
    .actions form,
    .actions button {
        width: 100%;
    }

    .actions a,
    .actions button {
        min-height: 42px;
    }

    .traffic-button {
        width: 100%;
    }

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

    .chat-sidebox {
        display: none;
    }

    .chat-panel {
        grid-template-rows: minmax(420px, 64vh) auto;
    }

    .chat-box,
    .chat-sidebox {
        padding: 14px;
    }

    .chat-box-head,
    .chat-sidebox-head {
        display: grid;
    }

    .chat-box-head strong,
    .chat-live-dot {
        white-space: normal;
    }

    .chat-feed {
        padding: 16px;
    }

    .chat-bubble {
        max-width: 92%;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }

    .subscription-row.expiring td:first-child,
    .subscription-row.expired td:first-child,
    .campaign-deadline-row.ending_tomorrow td:first-child,
    .campaign-deadline-row.ended td:first-child,
    .executive-row td:first-child {
        border-right: 0;
    }

    .executive-row {
        border-color: #bbf7d0;
        background: #f0fdf4;
        box-shadow: 0 12px 28px rgba(22, 163, 74, 0.08);
    }

    .executive-row td {
        background: transparent;
    }

    .executive-note {
        white-space: normal;
    }

    .subscription-row.expiring,
    .campaign-deadline-row.ending_tomorrow {
        border-color: #f6d365;
        background: #fffdf5;
    }

    .subscription-row.expired {
        border-color: #f3a4a4;
        background: #fff7f7;
    }

    .campaign-deadline-row.ended {
        border-color: #c4b5fd;
        background: #f7f3ff;
    }
}
