/* =====================================================
   GLOBAL BASE
===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --theme-color: #e11d2e;
    --sidebar-color: #f9fafb;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #f4f6f9;
    font-size: 14px;
    color: #1f2937;
}

/* =====================================================
   LAYOUT
===================================================== */
.layout {
    display: flex;
    min-height: 100vh;
}

.content {
    flex: 1;
    background: #f6f7fb;
}

.page {
    padding: 22px 24px 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* =====================================================
   SIDEBAR (FINAL – NO ICONS)
===================================================== */
.sidebar {
    width: 220px;
    background: var(--sidebar-color);
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
}

.sidebar-header img {
    max-height: 32px;
    object-fit: contain;
}

.sidebar .nav {
    padding: 12px 0;
}

.sidebar .nav-link {
    padding: 9px 14px;
    margin: 3px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: background .15s ease;
}

.sidebar .nav-link:hover {
    background: #e5e7eb;
}

.sidebar .nav-link.active {
    background: var(--theme-color);
    color: #fff;
}

/* Accordion */
.menu-title {
    padding: 9px 14px;
    margin: 6px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.menu-title:hover {
    background: #e5e7eb;
}

.menu-items {
    display: none;
}

.menu-section.open .menu-items {
    display: block;
}

.menu-items a {
    padding: 7px 14px 7px 24px;
    margin: 2px 12px;
    display: block;
    font-size: 13px;
    border-radius: 6px;
    color: #4b5563;
    text-decoration: none;
}

.menu-items a:hover {
    background: #e5e7eb;
}

.menu-items a.active {
    color: var(--theme-color);
    font-weight: 600;
}

/* =====================================================
   TOPBAR
===================================================== */
.topbar {
    height: 52px;
    background: var(--header-color);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12.5px;
}

#breakBtn {
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 999px;
}

#sessionTimer {
    min-width: 120px;
    text-align: right;
}

/* =====================================================
   PAGE HEADER
===================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-title {
    font-size: 17px;
    font-weight: 600;
}

/* =====================================================
   CARDS & DASHBOARD
===================================================== */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.card-header {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.card-body {
    padding: 12px 14px;
}

.card + .card {
    margin-top: 12px;
}

.dashboard-section {
    margin-bottom: 12px;
}

/* Summary grid */
.crm-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.summary-tile {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.summary-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
}

.summary-value {
    font-size: 20px;
    font-weight: 600;
}

/* Dashboard grids */
.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 12px;
}

.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Trend */
.dashboard-trend {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 52px;
}

.dashboard-trend-bar {
    width: 12px;
    border-radius: 4px;
    background: var(--theme-color);
}

/* =====================================================
   TABLES & LISTS (FINAL)
===================================================== */
.table {
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: #f9fafb;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    padding: 9px 12px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.table tbody td {
    font-size: 13px;
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #111827;
    vertical-align: middle;
    white-space: nowrap;
}

.table td.wrap {
    white-space: normal;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table td.actions {
    white-space: nowrap;
    text-align: right;
}

.table td.actions a,
.table td.actions button {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--theme-color);
    background: transparent;
    border: none;
    cursor: pointer;
}

/* Status pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 999px;
}

.status-success { background:#ecfdf5;color:#065f46; }
.status-warning { background:#fffbeb;color:#92400e; }
.status-danger  { background:#fef2f2;color:#991b1b; }
.status-muted   { background:#f3f4f6;color:#6b7280; }

/* Empty state */
.table .empty,
.table .no-records {
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 10px 12px;
}

.pagination a {
    padding: 4px 8px;
    font-size: 12.5px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    color: #374151;
    text-decoration: none;
}

.pagination a.active {
    background: var(--theme-color);
    color: #fff;
    border-color: var(--theme-color);
}

/* =====================================================
   FORMS & BUTTONS
===================================================== */
form {
    max-width: 920px;
}

label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

input,
select,
textarea,
.form-control {
    width: 100%;
    height: 36px;
    padding: 6px 10px;
    font-size: 13.5px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--theme-color);
    outline: none;
}

button,
.btn {
    height: 36px;
    padding: 0 16px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 6px;
}

.btn-primary {
    background: var(--theme-color);
    border: none;
    color: #fff;
}

/* =====================================================
   ALERTS & BADGES
===================================================== */
.alert {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    border: 1px solid transparent;
}

.alert-success { background:#ecfdf5;color:#065f46;border-color:#bbf7d0; }
.alert-warning { background:#fffbeb;color:#92400e;border-color:#fde68a; }
.alert-danger  { background:#fef2f2;color:#991b1b;border-color:#fecaca; }

.badge {
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}

/* =====================================================
   FOOTER
===================================================== */
.app-footer {
    margin-top: auto;
    padding: 12px 0;
    font-size: 12px;
    text-align: center;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 1024px) {
    .dashboard-grid-2,
    .dashboard-grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .crm-summary {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}
