/* ==========================================================================
   Lyneo Admin — shared design system
   Dark shell (topbar + sidebar) with a light content area.
   ========================================================================== */

:root {
    --brand: #38bdf8;
    --brand-strong: #0ea5e9;
    --brand-gradient: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);

    --shell-bg: #0b1220;
    --shell-bg-alt: #0f172a;
    --shell-border: rgba(148, 163, 184, 0.18);
    --shell-text: #e2e8f0;
    --shell-text-dim: #94a3b8;
    --shell-link: #cbd5f5;

    --content-bg: #0e1524;
    --surface: #1e293b;
    --surface-alt: #273449;
    --ink: #e2e8f0;
    --ink-soft: #cbd5e1;
    --ink-dim: #94a3b8;
    --line: rgba(148, 163, 184, 0.18);

    --input-bg: #0f172a;
    --input-border: #334155;
    --chip-bg: rgba(148, 163, 184, 0.16);

    --ok-bg: #dcfce7;      --ok-fg: #166534;
    --warn-bg: #fef3c7;    --warn-fg: #92400e;
    --info-bg: #e0f2fe;    --info-fg: #075985;
    --danger-bg: #fee2e2;  --danger-fg: #b91c1c;

    --radius: 15px;
    --radius-sm: 10px;
    --shadow-card: 0 2px 20px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 2px 10px rgba(15, 23, 42, 0.06);
    --topbar-h: 64px;
    --sidebar-w: 260px;
    --font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

html { overflow-x: hidden; color-scheme: dark; }

body {
    margin: 0;
    font-family: var(--font);
    background: #0b1220;
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--brand-strong); }

/* ==========================================================================
   Shell: topbar
   ========================================================================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    background: var(--shell-bg);
    border-bottom: 1px solid var(--shell-border);
    color: var(--shell-text);
}

.topbar-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--shell-border);
    border-radius: 10px;
    background: transparent;
    color: var(--shell-text);
    cursor: pointer;
    flex: 0 0 auto;
}
.topbar-burger:hover { background: rgba(56, 189, 248, 0.12); }
.topbar-burger svg { width: 22px; height: 22px; }

.topbar-brand {
    font-weight: 600;
    font-size: 18px;
    letter-spacing: 0.2px;
    color: var(--shell-text);
    text-decoration: none;
    white-space: nowrap;
}
.topbar-brand:hover { color: var(--brand); }

.topbar-spacer { flex: 1 1 auto; }

.topbar-user {
    font-size: 13px;
    color: var(--shell-text-dim);
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-profile,
.topbar-logout {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.5);
    color: var(--brand);
    background: transparent;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.topbar-profile:hover,
.topbar-logout:hover,
.topbar-profile.is-active { background: var(--brand); color: #06121f; }

.activity-count-link {
    color: var(--brand-strong);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.activity-count-link:hover { color: var(--ink); }

/* ==========================================================================
   Shell: layout + sidebar
   ========================================================================== */

.app-layout {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    background: var(--shell-bg);
    border-right: 1px solid var(--shell-border);
    padding: 14px 14px 28px;
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
}

.sidebar-title {
    color: var(--shell-text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 18px 8px 8px;
}
.sidebar-title:first-child { margin-top: 4px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-link {
    display: block;
    color: var(--shell-link);
    border-radius: 10px;
    padding: 9px 12px;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: rgba(56, 189, 248, 0.12); color: var(--shell-text); }
.sidebar-link.active {
    background: rgba(56, 189, 248, 0.18);
    color: var(--brand);
    font-weight: 600;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* ==========================================================================
   Shell: content area
   ========================================================================== */

.content-area {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--content-bg);
}
.content-inner {
    padding: 0;
    min-width: 0;
    max-width: 100%;
}

/* Flash toasts */
.flash-stack {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    right: 16px;
    z-index: 1080;
    width: min(360px, calc(100vw - 32px));
}
.flash-stack .alert { box-shadow: var(--shadow-card); }

/* ==========================================================================
   Page container + header
   ========================================================================== */

.container,
.dashboard-container {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px;
    min-width: 0;
}
.container--narrow { max-width: 840px; }
.container--md { max-width: 1200px; }

.header {
    background: var(--brand-gradient);
    color: #fff;
    padding: 28px 30px;
    border-radius: var(--radius);
    margin-bottom: 26px;
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.28);
}
.header h1 { font-size: 30px; margin: 0 0 10px; line-height: 1.15; }
.header h1:last-child { margin-bottom: 0; }
.header p { margin: 0; opacity: 0.92; font-size: 16px; }
.header a.back-link,
.header .back-link {
    display: inline-block;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}
.header .back-link:hover { color: #fff; }

.header--flex {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.header-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.header-actions a,
.header-btn {
    padding: 9px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    cursor: pointer;
    transition: background 0.2s;
}
.header-actions a:hover,
.header-btn:hover { background: rgba(255, 255, 255, 0.28); }
.header-actions a.active { background: #fff; color: var(--brand-strong); }
.header-btn--solid { background: rgba(255, 255, 255, 0.95); color: var(--brand-strong); }
.header-btn--solid:hover { background: #fff; }

.total-badge {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
}
.total-badge strong { font-size: 22px; }

.section-title { font-size: 18px; font-weight: 700; margin: 0 0 14px; color: var(--ink); }

/* ==========================================================================
   Cards
   ========================================================================== */

.card,
.card-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-card);
    color: var(--ink);
}
.card-section { margin-bottom: 22px; }
.card-section h2 {
    font-size: 18px;
    margin: 0 0 18px;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--content-bg);
}
.card-title { font-size: 18px; font-weight: 600; color: var(--ink); }
.card > h2 { font-size: 18px; margin: 0 0 16px; color: var(--ink); }

.chart-container { position: relative; height: 300px; margin-top: 12px; }

.quick-stats { padding: 4px 0; }
.quick-stat-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.quick-stat-row:last-child { border-bottom: none; }
.quick-stat-row span { color: var(--ink-soft); }
.quick-stat-row strong { color: var(--ink); }

/* ==========================================================================
   Stat cards
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}
.stats .stat-card { flex: 1 1 240px; }

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border-left: 4px solid var(--brand);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 8px 26px rgba(15, 23, 42, 0.14); }
.stat-card.users, .stat-card.info { border-left-color: var(--brand); }
.stat-card.companies, .stat-card.active { border-left-color: #22c55e; }
.stat-card.offers, .stat-card.warning, .stat-card.verified { border-left-color: #f59e0b; }
.stat-card.orders { border-left-color: #3b82f6; }
.stat-card.blocked, .stat-card.danger { border-left-color: #ef4444; }

.stat-card h3 { margin: 0 0 8px; color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.stat-card .value { font-size: 30px; font-weight: 700; color: var(--brand-strong); line-height: 1.1; }
.stat-card small { color: var(--ink-dim); font-size: 13px; }

.stat-card-link { display: block; height: 100%; text-decoration: none; color: inherit; }
.stat-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.stat-card-title { font-size: 13px; color: var(--ink-soft); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.stat-card-icon { font-size: 34px; opacity: 0.25; flex-shrink: 0; }
.stat-card-value { font-size: 34px; font-weight: 700; color: var(--ink); margin-bottom: 4px; line-height: 1.1; }
.stat-card-change, .stat-card-description { font-size: 12px; color: var(--ink-dim); }

.stats-grid .stat-card {
    height: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-card);
    max-width: 100%;
    margin-bottom: 20px;
}
.table-scroll,
.table-responsive-wrapper,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

/* List-style table (gradient header) used inside .table-container */
.table-container table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
.table-container thead {
    background: var(--brand-gradient);
    color: #fff;
}
.table-container th {
    padding: 16px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.table-container td {
    padding: 15px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    vertical-align: top;
}
.table-container tbody tr:last-child td { border-bottom: none; }
.table-container tbody tr { transition: background 0.15s; }
.table-container tbody tr:hover { background: var(--surface-alt); }

/* Neutralize Bootstrap's white table background inside the dark shell */
.content-inner .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
    --bs-table-striped-color: var(--ink);
    --bs-table-striped-bg: rgba(148, 163, 184, 0.06);
    --bs-table-hover-color: var(--ink);
    --bs-table-hover-bg: var(--surface-alt);
    --bs-table-border-color: var(--line);
}

/* Soft table (light header) used inside plain .card */
.card table,
.card .table {
    width: 100%;
    border-collapse: collapse;
    color: var(--ink);
    background: transparent;
}
.card table thead,
.card .table thead { background: var(--surface-alt); }
.card table th,
.card .table th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--line);
}
.card table td,
.card .table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    overflow-wrap: anywhere;
    word-break: break-word;
}
.card table tbody tr:hover,
.card .table tbody tr:hover { background: var(--surface-alt); }

/* Compact key/value table */
.users-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.users-table th, .users-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.users-table th { font-weight: 600; color: var(--ink-soft); background: var(--surface-alt); }
.users-table tbody tr:hover td { background: var(--surface-alt); }

.slug-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace; color: var(--ink-soft); }
.date-cell { white-space: nowrap; font-size: 14px; color: var(--ink-soft); }
.reason-cell { max-width: 400px; word-wrap: break-word; white-space: normal; }
.muted { color: var(--ink-dim); }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-block;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.4;
}
.badge-success { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warning { background: var(--warn-bg); color: var(--warn-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge-neutral { background: var(--chip-bg); color: var(--ink-soft); border: 1px solid var(--line); }

.audit-history { display: flex; flex-direction: column; gap: 12px; }
.audit-history:not(.is-expanded) .audit-history-item.is-extra { display: none; }
.audit-history-item {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}
.audit-history-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    color: var(--ink);
}
.audit-history-meta span { color: var(--ink-dim); font-size: 13px; }
.audit-history-actor { font-size: 14px; color: var(--ink-soft); }
.audit-history-email { display: inline-block; margin-left: 6px; color: var(--ink-dim); font-size: 12px; }
.audit-history-payload { margin-top: 8px; font-size: 13px; color: var(--ink-dim); display: flex; flex-direction: column; gap: 4px; }
.audit-history-payload code { color: var(--ink-soft); font-size: 12px; }
.audit-history-toggle {
    align-self: flex-start;
    margin-top: 2px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.audit-history-toggle:hover {
    border-color: var(--brand);
    color: var(--ink);
    background: rgba(56, 189, 248, 0.08);
}

.badge-owner { background: #dbeafe; color: #1d4ed8; border-radius: 6px; text-transform: none; }
.badge-employee { background: #e0e7ff; color: #4338ca; border-radius: 6px; text-transform: none; }
.badge-method-get { background: #dbeafe; color: #1d4ed8; }
.badge-method-post { background: #dcfce7; color: #166534; }
.badge-method-put { background: #ffedd5; color: #c2410c; }
.badge-method-patch { background: #f3e8ff; color: #7e22ce; }
.badge-method-delete { background: #fee2e2; color: #991b1b; }
.badge-method-other { background: var(--chip-bg); color: var(--ink-soft); }

.count-pill {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    background: #dbeafe;
    color: #1d4ed8;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-block;
    padding: 13px 26px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
    transition: opacity 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.btn-primary { background: var(--brand-gradient); color: #fff; }
.btn-primary:hover { opacity: 0.92; color: #fff; }
.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; color: #fff; }
.btn-success { background: #22c55e; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-success:hover, .btn-danger:hover, .btn-warning:hover { opacity: 0.9; color: #fff; }
.btn-danger:disabled { background: #cbd5e1; cursor: not-allowed; }

.btn-block-danger { background: linear-gradient(135deg, #f87171 0%, #ef4444 100%); color: #fff; }
.btn-unblock { background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%); color: #fff; }
.btn-block-danger:hover, .btn-unblock:hover { opacity: 0.95; color: #fff; }

.btn-sm {
    display: inline-block;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.btn-sm.btn-primary,
.btn-view { background: var(--brand-strong); color: #fff; }
.btn-view:hover { opacity: 0.9; color: #fff; }

.btn-add {
    display: inline-block;
    padding: 13px 26px;
    background: var(--brand-gradient);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
    transition: opacity 0.2s;
}
.btn-add:hover { opacity: 0.9; color: #fff; }

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 22px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow-soft);
    transition: all 0.2s;
}
.action-btn:hover { border-color: var(--brand); color: var(--brand-strong); transform: translateY(-2px); }

.login-as-btn {
    display: inline-block;
    padding: 6px 12px;
    background: var(--surface-alt);
    color: var(--ink-soft);
    text-decoration: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--line);
    transition: all 0.2s;
}
.login-as-btn:hover { background: rgba(56, 189, 248, 0.14); border-color: var(--brand); color: var(--ink); }

.user-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.rodo-export-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
}

.rodo-export-actions form {
    display: inline;
    margin: 0;
}

.rodo-export-actions--compact {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.rodo-export-ready {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.rodo-export-ready-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
}

.rodo-export-btn {
    display: inline-block;
    padding: 5px 10px;
    background: var(--surface-alt);
    color: var(--ink-soft);
    text-decoration: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--line);
    transition: all 0.2s;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
}

.rodo-export-btn:hover {
    background: rgba(56, 189, 248, 0.14);
    border-color: var(--brand);
    color: var(--ink);
}

.rodo-export-btn--danger:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: #ef4444;
    color: #fecaca;
}

.rodo-export-status,
.rodo-export-date {
    font-size: 12px;
    color: var(--ink-dim);
    font-weight: 600;
}

.rodo-export-error {
    font-size: 12px;
    color: #fecaca;
    font-weight: 600;
}

.rodo-export-progress {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    min-width: 160px;
    max-width: 240px;
}

.rodo-export-progress-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.rodo-export-percent {
    font-size: 11px;
    color: var(--ink-dim);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rodo-export-bar {
    height: 6px;
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 99px;
    overflow: hidden;
}

.rodo-export-bar-fill {
    height: 100%;
    width: 0;
    background: var(--brand-gradient);
    transition: width 0.35s ease;
}

.users-table-rodo-col {
    width: 1%;
    white-space: nowrap;
    vertical-align: top;
}

.users-table--with-rodo .users-table-rodo-col {
    min-width: 210px;
}

.user-row-actions .rodo-export-progress {
    flex: 1 1 200px;
}

.back-link-standalone {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--brand-strong);
    text-decoration: none;
    font-weight: 600;
}
.back-link-standalone:hover { text-decoration: underline; }

.toolbar { margin-bottom: 20px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    margin-bottom: 22px;
    min-width: 0;
    max-width: 100%;
}
.form-group:last-child { margin-bottom: 0; }

label { display: block; margin-bottom: 8px; color: var(--ink); font-weight: 600; font-size: 14px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select,
.form-select {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 12px 15px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--ink);
    background-color: var(--input-bg);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

/* iOS/Android date controls have a large intrinsic min-width and overflow cards */
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.4;
}
select,
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 44px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    line-height: 1.4;
}
select option,
.form-select option {
    background-color: var(--surface);
    color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--ink-dim); }
input:focus, textarea:focus, select:focus, .form-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
textarea { min-height: 120px; resize: vertical; }
input.has-error { border-color: #ef4444; }

.field-error { color: #f87171; font-size: 13px; margin-top: 6px; }
.help-text { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

.checkbox-group { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.checkbox-group input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--brand-strong); }
.checkbox-group label { margin: 0; font-weight: 500; cursor: pointer; }

.form-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }

.info-box {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #bae6fd;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 24px;
}
.info-box--muted { background: var(--surface-alt); border: 1px solid var(--line); color: var(--ink-soft); }

/* key/value info rows (company edit, error meta) */
.info-row { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 600; color: var(--ink); min-width: 150px; }
.info-value { color: var(--ink); }

/* ==========================================================================
   Search form (inside gradient header)
   ========================================================================== */

.search-form { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 4px; }
.search-form input,
.search-form select {
    flex: 1 1 240px;
    min-width: 0;
    padding: 14px 18px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
}
.search-form input::placeholder {
    color: #64748b;
}
.search-form select option {
    color: #0f172a;
}
.search-form input:focus,
.search-form select:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
.search-form button,
.search-form .clear-btn {
    flex: 0 0 auto;
    padding: 14px 26px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transition: background 0.2s;
}
.search-form button:hover,
.search-form .clear-btn:hover { background: rgba(255, 255, 255, 0.32); }

.info-text {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    margin-top: 16px;
}
.info-text strong { font-size: 18px; }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 26px 0;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    padding: 10px 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
    background: var(--surface);
    font-weight: 500;
    min-width: 42px;
    text-align: center;
    transition: all 0.2s;
}
.pagination a:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .current { background: var(--brand-gradient); color: #fff; border-color: transparent; }
.pagination .ellipsis { border: none; background: transparent; color: var(--ink-dim); }

/* ==========================================================================
   Empty states
   ========================================================================== */

.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-dim); }
.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.3; }
.empty-state-text { font-size: 17px; color: var(--ink-soft); }
.empty-users { color: var(--ink-soft); margin: 0; }
.actions-bar { display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap; margin-top: 20px; color: var(--ink-soft); font-size: 14px; }

/* ==========================================================================
   Company edit — tabs + limit sections
   ========================================================================== */

.company-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 22px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.company-tab {
    flex: 1 1 auto;
    min-width: fit-content;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: background 0.15s, color 0.15s;
}

.company-tab:hover {
    background: var(--surface-alt);
    color: var(--ink);
}

.company-tab.is-active {
    background: var(--brand-gradient);
    color: #06121f;
}

.company-edit-page .card-section:last-of-type {
    margin-bottom: 22px;
}

.card-section-limits-panel { border-top: 4px solid var(--brand-strong); }
.card-section-limits-api { border-top: 4px solid #8b5cf6; }
.card-section-blocked { border-top: 4px solid #ef4444; }

.section-kicker {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.section-kicker-panel { background: #e0f2fe; color: #0369a1; }
.section-kicker-api { background: #ede9fe; color: #6d28d9; }
.section-kicker-blocked { background: var(--danger-bg); color: var(--danger-fg); }

.limit-hint { font-size: 13px; color: var(--ink-soft); margin-top: 6px; line-height: 1.5; }
.limit-usage { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.limits-near-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.limit-default-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--chip-bg);
    color: var(--ink-soft);
}
.blocked-status { display: inline-block; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.blocked-status-active { background: var(--danger-bg); color: var(--danger-fg); }
.blocked-status-inactive { background: var(--ok-bg); color: var(--ok-fg); }

/* ==========================================================================
   Panel error detail
   ========================================================================== */

.error-detail .detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.error-detail .detail-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-soft); margin-bottom: 6px; }
.error-detail .detail-value { font-size: 14px; font-weight: 600; color: var(--ink); word-break: break-word; }
.error-detail .trace {
    background: var(--shell-bg-alt);
    color: var(--shell-text);
    border-radius: 12px;
    padding: 18px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ==========================================================================
   System update
   ========================================================================== */

.system-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.system-note { margin-top: 16px; color: var(--ink-soft); font-size: 14px; }

/* ==========================================================================
   API stats
   ========================================================================== */

.signal { padding: 12px 14px; border-radius: 10px; margin-bottom: 10px; font-size: 13px; }
.signal-danger { background: var(--danger-bg); color: #991b1b; }
.signal-warning { background: var(--warn-bg); color: #92400e; }

/* ==========================================================================
   Messenger queue status
   ========================================================================== */

.queue-status-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.queue-status-toolbar .section-title { margin: 0; }
.queue-status-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.queue-refresh-btn {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.queue-refresh-btn:hover {
    border-color: var(--brand);
    color: var(--ink);
    background: rgba(56, 189, 248, 0.08);
}
.queue-health {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}
.queue-health.ok { background: var(--ok-bg); color: var(--ok-fg); }
.queue-health.backlog { background: var(--warn-bg); color: var(--warn-fg); }
.queue-health.stuck,
.queue-health.failed { background: var(--danger-bg); color: var(--danger-fg); }

.api-stats-page code,
.api-logs-page code {
    color: #e2e8f0;
    background: var(--chip-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* ==========================================================================
   API logs — filters, selects, autocomplete
   ========================================================================== */

.api-logs-page .filters {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    overflow: visible;
}
.api-logs-page .filters .row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.api-logs-page .filters .field { min-width: 0; }
.api-logs-page .filters label { font-size: 13px; color: var(--ink-soft); }
.api-logs-page .filters .filters-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.api-logs-page .filters .filters-actions button,
.api-logs-page .filters .filters-actions .btn-link {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}
.api-logs-page .filters .filters-actions button { background: var(--brand-strong); color: #06121f; }
.api-logs-page .filters .filters-actions .btn-link { background: var(--chip-bg); color: var(--ink); }

.api-logs-page .filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-height: 44px;
    padding: 10px 36px 10px 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
    font-size: 13px;
}
.api-logs-page .filter-select--method[data-method="GET"] { border-left: 4px solid #2563eb; }
.api-logs-page .filter-select--method[data-method="POST"] { border-left: 4px solid #16a34a; }
.api-logs-page .filter-select--method[data-method="PUT"] { border-left: 4px solid #ea580c; }
.api-logs-page .filter-select--method[data-method="PATCH"] { border-left: 4px solid #9333ea; }
.api-logs-page .filter-select--method[data-method="DELETE"] { border-left: 4px solid #dc2626; }
.api-logs-page .filter-select--status[data-status^="2"] { border-left: 4px solid #16a34a; }
.api-logs-page .filter-select--status[data-status^="4"],
.api-logs-page .filter-select--status[data-status^="5"] { border-left: 4px solid #dc2626; }
.api-logs-page .filter-select--status[data-status="429"] { border-left: 4px solid #d97706; }

.api-logs-page .table-container table { min-width: 1100px; }
.api-logs-page .error-message { display: block; margin-top: 4px; font-size: 12px; color: #fca5a5; max-width: 280px; word-break: break-word; }
.api-logs-page details summary { color: #0369a1; cursor: pointer; font-weight: 600; }
.api-logs-page .changes-box { background: var(--surface-alt); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 6px; font-size: 12px; color: var(--ink); }
.api-logs-page .body-block { margin-top: 10px; }
.api-logs-page .body-block h4 { margin: 0 0 6px; font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.api-logs-page .body-block pre {
    margin: 0;
    padding: 10px 12px;
    background: var(--shell-bg-alt);
    color: var(--shell-text);
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.45;
    overflow-x: auto;
    max-height: 320px;
    white-space: pre-wrap;
    word-break: break-word;
}
.api-logs-page .meta-line { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.company-autocomplete { position: relative; }
.company-autocomplete-input-wrap { position: relative; display: flex; align-items: stretch; }
.company-autocomplete-input-wrap:has(.company-autocomplete-clear:not([hidden])) input[type="text"] { padding-right: 34px; }
.company-autocomplete-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
}
.company-autocomplete-menu.is-open { display: block; }
.company-autocomplete-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    text-align: left;
    color: var(--ink);
    cursor: pointer;
    font-size: 13px;
}
.company-autocomplete-item:hover,
.company-autocomplete-item.is-active { background: rgba(56, 189, 248, 0.14); }
.company-autocomplete-clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ink-dim);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    border-radius: 999px;
}
.company-autocomplete-clear:hover { color: var(--ink-soft); background: #e2e8f0; }

/* ==========================================================================
   Login (guest, full screen)
   ========================================================================== */

.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background: radial-gradient(circle at top, #1e293b 0%, #0b1220 55%, #060913 100%);
    color: var(--shell-text);
}
.login-container {
    background: var(--shell-bg-alt);
    padding: 44px;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.65);
    width: 100%;
    max-width: 460px;
    border: 1px solid var(--shell-border);
}
.login-container h1 { color: #f8fafc; margin: 0 0 8px; text-align: center; font-size: 28px; }
.login-subtitle { text-align: center; color: var(--shell-text-dim); font-size: 16px; margin: 0 0 28px; }
.login-container label { color: var(--shell-text); }
.login-container input[type="email"],
.login-container input[type="password"] {
    background: var(--shell-bg);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--shell-text);
}
.login-container input[type="email"]:focus,
.login-container input[type="password"]:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
.login-container .checkbox-group label { color: var(--shell-link); }
.login-container button[type="submit"] {
    width: 100%;
    padding: 13px;
    background: var(--brand-gradient);
    color: #06121f;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}
.login-container button[type="submit"]:hover { opacity: 0.92; }
.login-error {
    color: #fecaca;
    background: rgba(220, 38, 38, 0.2);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid rgba(248, 113, 113, 0.4);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

.product-stats-page .product-stats-section-title {
    margin: 28px 0 14px;
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}
.product-stats-filters { margin-top: 8px; margin-bottom: 8px; }
.product-stats-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 24px;
    align-items: flex-end;
}
.product-stats-filter-group { display: flex; flex-direction: column; gap: 8px; }
.product-stats-filter-group--select { min-width: 220px; }
.product-stats-filter-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--ink-soft);
}
.product-stats-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.product-stats-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}
.product-stats-chip:hover { border-color: var(--brand); color: var(--brand-strong); }
.product-stats-chip.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.product-stats-note {
    margin: 16px 0 0;
    font-size: 13px;
    color: var(--ink-dim);
    line-height: 1.45;
}
.product-stats-note--flush { margin-top: 16px; }

@media (max-width: 992px) {
    .topbar-burger { display: inline-flex; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 0 40px rgba(2, 6, 23, 0.5);
        padding-top: 18px;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; opacity: 1; }
    .app-layout { display: block; }
    .content-area { min-height: calc(100vh - var(--topbar-h)); }
}

@media (max-width: 768px) {
    .container,
    .dashboard-container { padding: 14px 12px; }
    .header { padding: 20px 18px; border-radius: 12px; margin-bottom: 18px; }
    .header h1 { font-size: 23px; }
    .header p { font-size: 14px; }
    .card, .card-section {
        padding: 16px;
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }
    .card-section h2 { font-size: 16px; }
    .content-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; gap: 14px; }
    .table-container th,
    .table-container td { padding: 12px 10px; font-size: 13px; }
    .info-row { flex-direction: column; gap: 4px; }
    .info-label { min-width: auto; }
    .company-tabs { gap: 4px; padding: 4px; }
    .company-tab { padding: 9px 12px; font-size: 13px; }
    .search-form input,
    .search-form select,
    .search-form button,
    .search-form .clear-btn { flex: 1 1 100%; }
    .form-actions .btn { flex: 1 1 100%; }
    .topbar-user { display: none; }
}

@media (max-width: 576px) {
    .header h1 { font-size: 20px; }
    .stat-card-value, .stat-card .value { font-size: 26px; }
    .pagination a, .pagination span { padding: 8px 12px; min-width: 36px; font-size: 14px; }
}

/* Command tabs */
.command-tabs {
    border-bottom: 1px solid var(--line);
    margin: 0 0 18px;
    gap: 4px;
}
.command-tabs .nav-link {
    color: var(--ink-soft);
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
}
.command-tabs .nav-link:hover {
    color: var(--ink);
    border-color: transparent;
}
.command-tabs .nav-link.active {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--line) var(--line) transparent;
}
.command-tab-content { padding-top: 4px; }

