/* =============================================
   COTECA — DASHBOARD SHARED STYLESHEET
   Used by all post-login pages
   ============================================= */

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

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

:root {
    --primary: #C8460D;
    --primary-dark: #A33708;
    --primary-light: #FEF0E6;
    --gold: #D4920A;
    --gold-light: #FEF5E0;
    --navy: #1C2B3A;
    --navy-light: #2C4560;
    --gray-50: #F7F3EE;
    --gray-100: #EDE6DC;
    --gray-200: #D9CFBF;
    --gray-400: #9E9080;
    --gray-600: #6B6054;
    --gray-700: #4A4238;
    --gray-800: #332D26;
    --text: #1E1914;
    --white: #FFFFFF;
    --success: #16A34A;
    --success-light: #DCFCE7;
    --warning: #D97706;
    --warning-light: #FEF3C7;
    --danger: #DC2626;
    --danger-light: #FEE2E2;
    --info: #0369A1;
    --info-light: #E0F2FE;
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.10);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
    background: var(--gray-50);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5 {
    font-family: 'Outfit', system-ui, sans-serif;
    letter-spacing: -0.2px;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    font-family: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ══════════════════════════════
   SIDEBAR
══════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    transition: transform .3s;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
}

.sidebar-logo .logo-text span {
    color: var(--primary);
}

.sidebar-logo .role-chip {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    margin-top: 2px;
}

/* User identity in sidebar */
.sidebar-user {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}

.sidebar-user-sub {
    font-size: .72rem;
    color: rgba(255, 255, 255, .5);
}

/* Nav sections */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, .35);
    padding: 10px 20px 4px;
    font-family: 'Outfit', sans-serif;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 20px;
    font-size: .87rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .65);
    transition: all .15s;
    position: relative;
    border-radius: 0;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
}

.nav-item.active {
    color: #fff;
    background: rgba(200, 70, 13, .25);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .85rem;
    color: rgba(255, 255, 255, .5);
    padding: 8px 0;
    transition: color .15s;
}

.sidebar-footer a:hover {
    color: #fff;
}

/* ══════════════════════════════
   TOP BAR
══════════════════════════════ */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    z-index: 100;
}

.topbar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
}

.topbar-title small {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: .75rem;
    font-weight: 400;
    color: var(--gray-600);
    margin-top: -2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.topbar-search {
    display: flex;
    align-items: center;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    padding: 6px 12px;
    gap: 8px;
    width: 220px;
}

.topbar-search input {
    border: none;
    outline: none;
    background: transparent;
    font-size: .85rem;
    color: var(--text);
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.topbar-search .search-icon {
    font-size: .9rem;
    color: var(--gray-400);
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    color: var(--gray-700);
    position: relative;
    transition: all .15s;
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .88rem;
    color: #fff;
    cursor: pointer;
    border: 2px solid var(--primary-light);
}

/* ══════════════════════════════
   MAIN CONTENT
══════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 28px;
    min-height: calc(100vh - var(--topbar-h));
}

/* ══════════════════════════════
   STAT CARDS
══════════════════════════════ */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.orange {
    background: var(--primary-light);
}

.stat-icon.blue {
    background: var(--info-light);
}

.stat-icon.green {
    background: var(--success-light);
}

.stat-icon.gold {
    background: var(--gold-light);
}

.stat-icon.purple {
    background: #F3E8FF;
}

.stat-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
    margin-bottom: 3px;
}

.stat-label {
    font-size: .78rem;
    color: var(--gray-600);
}

.stat-change {
    font-size: .72rem;
    font-weight: 600;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.stat-change.up {
    color: var(--success);
}

.stat-change.down {
    color: var(--danger);
}

/* ══════════════════════════════
   PANEL / CARD
══════════════════════════════ */
.panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
    gap: 10px;
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
}

.panel-header .view-all {
    font-size: .82rem;
    font-weight: 600;
    color: var(--primary);
}

.panel-body {
    padding: 20px 22px;
}

.panel-body.no-pad {
    padding: 0;
}

/* ══════════════════════════════
   TABLE
══════════════════════════════ */
.dash-table {
    width: 100%;
    border-collapse: collapse;
}

.dash-table th {
    padding: 10px 16px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--gray-600);
    background: var(--gray-50);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.dash-table td {
    padding: 13px 16px;
    font-size: .86rem;
    color: var(--text);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.dash-table tr:last-child td {
    border-bottom: none;
}

.dash-table tr:hover td {
    background: var(--gray-50);
}

/* ══════════════════════════════
   STATUS BADGES
══════════════════════════════ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.status-badge.active {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.pending {
    background: var(--warning-light);
    color: var(--warning);
}

.status-badge.new {
    background: var(--info-light);
    color: var(--info);
}

.status-badge.completed {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-badge.cancelled {
    background: var(--danger-light);
    color: var(--danger);
}

.status-badge.open {
    background: var(--primary-light);
    color: var(--primary);
}

/* ══════════════════════════════
   BUTTONS
══════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 7px;
    font-size: .85rem;
    font-weight: 600;
    border: none;
    transition: all .15s;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-navy {
    background: var(--navy);
    color: #fff;
}

.btn-navy:hover {
    background: var(--navy-light);
}

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1.5px solid var(--gray-200);
}

.btn-outline:hover {
    border-color: var(--navy);
    background: var(--gray-50);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: none;
}

.btn-ghost:hover {
    color: var(--navy);
    background: var(--gray-100);
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: .78rem;
}

.btn-lg {
    padding: 12px 28px;
    font-size: .95rem;
}

/* ══════════════════════════════
   FORM ELEMENTS
══════════════════════════════ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: .88rem;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: var(--white);
    outline: none;
    transition: border-color .15s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(200, 70, 13, .1);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.form-hint {
    font-size: .75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ══════════════════════════════
   AVATAR / INITIALS
══════════════════════════════ */
.avatar {
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.avatar.sm {
    width: 32px;
    height: 32px;
    font-size: .78rem;
}

.avatar.md {
    width: 40px;
    height: 40px;
    font-size: .9rem;
}

.avatar.lg {
    width: 52px;
    height: 52px;
    font-size: 1.1rem;
}

/* ══════════════════════════════
   NOTIFICATION / MESSAGE ROW
══════════════════════════════ */
.msg-row {
    display: flex;
    gap: 12px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--gray-100);
    align-items: flex-start;
    cursor: pointer;
    transition: background .12s;
}

.msg-row:last-child {
    border-bottom: none;
}

.msg-row:hover {
    background: var(--gray-50);
}

.msg-row.unread {
    background: var(--primary-light);
}

.msg-row.unread:hover {
    background: #fde4d0;
}

.msg-info {
    flex: 1;
    min-width: 0;
}

.msg-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.msg-sender {
    font-size: .87rem;
    font-weight: 600;
    color: var(--text);
}

.msg-time {
    font-size: .73rem;
    color: var(--gray-400);
    white-space: nowrap;
}

.msg-preview {
    font-size: .82rem;
    color: var(--gray-600);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 5px;
}

/* ══════════════════════════════
   PROGRESS BAR
══════════════════════════════ */
.progress-track {
    background: var(--gray-100);
    border-radius: 4px;
    height: 7px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--primary);
    transition: width .4s ease;
}

.progress-fill.green {
    background: var(--success);
}

.progress-fill.gold {
    background: var(--gold);
}

.progress-fill.navy {
    background: var(--navy);
}

/* ══════════════════════════════
   TABS
══════════════════════════════ */
.tab-row {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab-link {
    padding: 10px 18px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-600);
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.tab-link:hover {
    color: var(--navy);
}

.tab-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ══════════════════════════════
   EMPTY STATE
══════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-600);
}

.empty-state .empty-icon {
    font-size: 2.8rem;
    margin-bottom: 14px;
}

.empty-state h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 7px;
}

.empty-state p {
    font-size: .88rem;
    max-width: 320px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

/* ══════════════════════════════
   MOBILE
══════════════════════════════ */
.mob-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--navy);
    margin-right: 8px;
}

@media (min-width: 1500px) {
    .stat-cards {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .mob-menu-btn {
        display: flex;
    }

    .topbar-search {
        display: none;
    }

    .stat-cards {
        grid-template-columns: 1fr 1fr;
    }

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

@media (max-width: 520px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 16px;
    }
}
