* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #261904;
    color: #F3E7D0;
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

a {
    color: #1769aa;
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #d8dee8;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    padding: 14px 24px;
}

.brand {
    color: #0f172a;
    font-weight: 700;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.container {
    margin: 0 auto;
    max-width: 1180px;
    padding: 28px 20px 48px;
}

.page-head {
    margin-bottom: 24px;
}

.page-head h1 {
    font-size: 30px;
    margin: 0 0 8px;
}

.page-head p {
    color: #526174;
    margin: 0 0 16px;
}

.button,
button {
    background: #1769aa;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    display: inline-block;
    font: inherit;
    font-weight: 700;
    padding: 9px 14px;
}

.panel {
    background: #ffffff;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 18px;
}

.panel h2 {
    font-size: 18px;
    margin: 0 0 14px;
}

form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select,
textarea {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #1e293b;
    font: inherit;
    padding: 9px 10px;
    width: 100%;
}

textarea {
    font-family: Consolas, monospace;
}

.grid-form {
    align-items: end;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.inline-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-form input {
    max-width: 360px;
}

table {
    background: #ffffff;
    border-collapse: collapse;
    border: 1px solid #d8dee8;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid #e5e9f0;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #eef2f6;
    font-size: 13px;
    text-transform: uppercase;
}

.badge {
    background: #e9f5ef;
    border-radius: 999px;
    color: #17623b;
    display: inline-block;
    font-size: 13px;
    padding: 3px 8px;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.message {
    border-radius: 6px;
    padding: 10px 12px;
}

.message.success {
    background: #e9f7ef;
    color: #17623b;
}

.message.error {
    background: #fdecec;
    color: #9b1c1c;
}

.message.info {
    background: #eaf3ff;
    color: #174a7c;
}

.stats {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats a {
    background: #ffffff;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    color: #1e293b;
    display: grid;
    gap: 4px;
    padding: 18px;
}

.stats strong {
    font-size: 30px;
}

.stats span {
    color: #526174;
}

/* Admin v2 */
:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --line: #dbe2ea;
    --text: #172033;
    --muted: #64748b;
    --primary: #1769aa;
    --primary-dark: #125382;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --success-bg: #e9f7ef;
    --info-bg: #eaf3ff;
}

.public-page {
    background: var(--bg);
}

.public-main {
    min-height: 100vh;
}

.public-hero {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: 64px;
}

.public-hero > div {
    max-width: 760px;
}

.public-hero h1 {
    font-size: 46px;
    line-height: 1.1;
    margin: 0 0 18px;
}

.public-hero p {
    color: var(--muted);
    font-size: 18px;
    margin: 0 0 22px;
}

.admin-shell {
    background: var(--bg);
    color: var(--text);
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: #101828;
    color: #ffffff;
    padding: 22px 18px;
}

.sidebar .brand {
    align-items: center;
    color: #ffffff;
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
}

.brand-mark {
    align-items: center;
    background: #ffffff;
    border-radius: 8px;
    color: #101828;
    display: inline-flex;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.side-nav {
    display: grid;
    gap: 6px;
}

.side-nav a {
    border-radius: 7px;
    color: #d0d5dd;
    padding: 10px 12px;
}

.side-nav a:hover {
    background: #1d2939;
    color: #ffffff;
}

.workspace {
    min-width: 0;
}

.workspace .topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 16px 28px;
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.content {
    padding: 28px;
}

.content .page-head {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.content .page-head h1 {
    color: var(--text);
    font-size: 32px;
}

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

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

.control-actions form {
    margin: 0;
}

.bulk-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.bulk-actions select {
    max-width: 220px;
}

td input[type="checkbox"] {
    width: auto;
}

.button.secondary,
button.secondary {
    background: #eef2f6;
    color: var(--text);
}

.button.secondary:hover,
button.secondary:hover {
    background: #e2e8f0;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
}

button.danger,
.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

button.danger:hover,
.danger:hover {
    background: #ffd7d2;
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    margin-bottom: 18px;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 18px;
}

.metric span {
    color: var(--muted);
}

.metric strong {
    font-size: 32px;
}

.metric small {
    color: var(--muted);
}

.system-ok {
    border-color: #98d8b5;
}

.system-warning {
    border-color: #f5d08a;
    background: #fffaf0;
}

.system-critical {
    border-color: #f3aaa4;
    background: #fff1f0;
}

.panel {
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

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

.panel-head h2 {
    margin: 0;
}

.panel-head p,
.hint {
    color: var(--muted);
    margin: 0;
}

.status-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.status-grid div {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    padding: 12px;
}

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

table {
    min-width: 760px;
}

tbody tr:hover {
    background: #f8fafc;
}

.empty-state {
    background: #f8fafc;
    border: 1px dashed #b6c2d1;
    border-radius: 8px;
    color: var(--muted);
    padding: 22px;
    text-align: center;
}

.pagination {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 14px;
}

.details-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

.details {
    display: grid;
    gap: 10px;
    grid-template-columns: 160px minmax(0, 1fr);
    margin: 0;
}

.details dt {
    color: var(--muted);
    font-weight: 700;
}

.details dd {
    margin: 0;
}

.settings-form {
    display: grid;
    gap: 14px;
    max-width: 760px;
}

.warning-panel {
    background: #fffaf0;
    border-color: #f5d08a;
}

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

.notification {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    padding: 12px;
}

.notification.info {
    background: var(--info-bg);
}

.notification.warning {
    background: #fffaf0;
    border-color: #f5d08a;
}

.notification.critical {
    background: var(--danger-bg);
    border-color: #f3aaa4;
}

.login-wrap {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 32px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
    max-width: 440px;
    padding: 28px;
    width: 100%;
}

.login-card h1 {
    margin: 6px 0 10px;
}

.login-card form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .content .page-head,
    .panel-head {
        display: block;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }
}

/* Brand logo */
.sidebar .brand.brand-logo-link {
    display: flex;
    align-items: center;
    padding: 18px 18px 24px;
    min-height: 88px;
}

.sidebar-logo {
    display: block;
    width: 172px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.public-logo {
    display: block;
    width: 320px;
    max-width: 100%;
    height: auto;
    margin: 0 0 28px 0;
    filter: drop-shadow(0 12px 28px rgba(15, 23, 42, 0.12));
}

/* LabInfluences dark brand theme override */
:root {
    --li-bg: #221004;
    --li-text: #F9FCBA;
    --li-border: #F9FCBA;
    --li-green: #145229;
    --li-red: #B00020;
    --li-panel: rgba(34, 16, 4, 0.72);
    --li-hover-green: #145229;
}

html,
body,
.admin-shell,
.workspace,
.content,
.public-hero,
.container {
    background: var(--li-bg) !important;
    color: var(--li-text) !important;
}

.topbar,
.sidebar,
.panel,
.card,
.metric,
.empty-state,
.messages,
.table-wrap,
.login-card,
.public-card {
    background: var(--li-panel) !important;
    color: var(--li-text) !important;
    border-color: var(--li-border) !important;
}

h1,
h2,
h3,
h4,
p,
span,
strong,
label,
td,
th,
.eyebrow,
.page-head p,
.brand,
.side-nav a {
    color: var(--li-text) !important;
}

a {
    color: var(--li-text) !important;
}

input,
select,
textarea {
    background: transparent !important;
    color: var(--li-text) !important;
    border: 1px solid var(--li-border) !important;
}

input::placeholder,
textarea::placeholder {
    color: rgba(249, 252, 186, 0.72) !important;
}

.button,
button,
input[type="submit"] {
    background: transparent !important;
    color: var(--li-text) !important;
    border: 1px solid var(--li-border) !important;
}

.button:hover,
button:hover,
input[type="submit"]:hover,
.side-nav a:hover {
    background: var(--li-hover-green) !important;
    color: var(--li-red) !important;
    border-color: var(--li-red) !important;
}

progress {
    accent-color: var(--li-green);
}

progress::-webkit-progress-value {
    background: var(--li-green);
}

progress::-moz-progress-bar {
    background: var(--li-green);
}

table {
    color: var(--li-text) !important;
}

th,
td {
    border-color: rgba(249, 252, 186, 0.35) !important;
}

tr:hover {
    background: rgba(20, 82, 41, 0.22) !important;
}

/* LabInfluences final table and active navigation tuning */
table,
thead,
tbody,
tr,
th,
td {
    background: transparent !important;
    color: #F9FCBA !important;
    border-color: rgba(249, 252, 186, 0.55) !important;
}

.table-wrap,
table,
.panel table,
.card table {
    background: transparent !important;
}

.badge,
.tag,
.status,
.pill {
    background: transparent !important;
    color: #F9FCBA !important;
    border: 1px solid #F9FCBA !important;
}

.message,
.notification,
.alert,
.warning,
.error,
.success {
    background: transparent !important;
    color: #F9FCBA !important;
    border-color: #F9FCBA !important;
}

.side-nav a.active {
    background: #145229 !important;
    color: #F9FCBA !important;
    border: 1px solid #145229 !important;
    font-weight: 700;
    border-radius: 6px;
}

.side-nav a:hover {
    background: #145229 !important;
    color: #B00020 !important;
    border-color: #B00020 !important;
}

/* LabInfluences hard final override */
body,
.topbar,
.sidebar,
.workspace,
.content,
.container,
.public-hero,
.panel,
.card,
.metric,
.table-wrap,
.empty-state,
form,
fieldset,
table,
thead,
tbody,
tr,
th,
td {
    background-color: transparent !important;
    background: transparent !important;
    color: #F9FCBA !important;
    border-color: #F9FCBA !important;
}

html,
body,
.admin-shell,
.public-hero {
    background-color: #221004 !important;
    background: #221004 !important;
}

input,
select,
textarea,
button,
.button,
a.button,
.button.secondary {
    background-color: transparent !important;
    background: transparent !important;
    color: #F9FCBA !important;
    border: 1px solid #F9FCBA !important;
}

input:focus,
select:focus,
textarea:focus {
    outline: 1px solid #F9FCBA !important;
    box-shadow: 0 0 0 2px rgba(249, 252, 186, 0.18) !important;
}

.side-nav a.active {
    background-color: #145229 !important;
    background: #145229 !important;
    color: #F9FCBA !important;
    border: 1px solid #145229 !important;
}

.side-nav a:hover,
button:hover,
.button:hover,
a.button:hover,
.button.secondary:hover {
    background-color: #145229 !important;
    background: #145229 !important;
    color: #B00020 !important;
    border-color: #B00020 !important;
}

tbody tr:hover,
tr:hover {
    background-color: rgba(20, 82, 41, 0.28) !important;
    background: rgba(20, 82, 41, 0.28) !important;
}

.badge,
.tag,
.status,
.pill,
.message,
.notification,
.alert,
.warning,
.error,
.success {
    background-color: transparent !important;
    background: transparent !important;
    color: #F9FCBA !important;
    border-color: #F9FCBA !important;
}

/* Fix campaign status white boxes */
.status-grid,
.status-grid > *,
.campaign-statuses,
.campaign-statuses > *,
.metric-row,
.metric-row > *,
.stat-row,
.stat-row > *,
.kpi-row,
.kpi-row > * {
    background: transparent !important;
    background-color: transparent !important;
    color: #F9FCBA !important;
    border-color: #F9FCBA !important;
}

.status-grid .badge,
.status-grid .pill,
.status-grid .status,
.campaign-statuses .badge,
.campaign-statuses .pill,
.campaign-statuses .status {
    background: transparent !important;
    background-color: transparent !important;
    color: #F9FCBA !important;
    border-color: #F9FCBA !important;
}

/* Fixed app navigation/header */
.admin-shell {
    align-items: start;
}

.sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
    z-index: 60 !important;
    border-right: 1px solid rgba(249, 252, 186, 0.45) !important;
}

.sidebar .brand-logo-link {
    position: sticky !important;
    top: 0 !important;
    z-index: 70 !important;
    background: #221004 !important;
    border-bottom: 1px solid rgba(249, 252, 186, 0.35) !important;
}

.topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 55 !important;
    background: #221004 !important;
    border-bottom: 1px solid rgba(249, 252, 186, 0.45) !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22) !important;
}

.topbar .eyebrow,
.topbar strong {
    color: #F9FCBA !important;
}

.content {
    padding-top: 18px !important;
}
