:root {
    /* Modern Color Palette */
    --bg: #f8fafc; /* Very soft slate background */
    --surface: #ffffff;
    --surface-soft: #f0f9ff; /* Soft sky blue for highlights */
    --text: #0f172a; /* Dark slate for high contrast text */
    --muted: #64748b; /* Medium slate for secondary text */
    --line: #e2e8f0; /* Soft borders */
    
    /* Primary Brand Colors (Modern Ocean/Medical Blue) */
    --primary: #0284c7; 
    --primary-dark: #0369a1;
    --primary-light: #38bdf8;
    
    /* Status Colors (Vibrant and clear) */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Refined Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-hover: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    
    /* Radii & Layout */
    --radius: 16px;
    --radius-sm: 10px;
    --container: 1180px;
    
    /* Transitions */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    /* Modern System Font Stack */
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.container {
    width: min(var(--container), calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand strong {
    display: block;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.main-nav a {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.main-nav a.active,
.main-nav a:hover,
.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--primary);
    background: var(--surface-soft);
}

.hero-section {
    padding: 5rem 0 3rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.35fr 0.95fr;
    gap: 2rem;
    align-items: center;
}

.hero-grid h1,
.section-heading h1,
.auth-card h1,
.page-header h2,
.section-heading h2 {
    margin: 0 0 1rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
    color: var(--text);
}

.hero-grid h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    max-width: 12ch;
    font-weight: 800;
}

.hero-text,
.lead {
    color: var(--muted);
    font-size: 1.15rem;
    max-width: 62ch;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: rgba(2, 132, 199, 0.1);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero-actions,
.button-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.8rem;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 1.4rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 8px 16px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 12px 20px rgba(2, 132, 199, 0.35);
}

.btn-outline,
.btn-soft,
.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--surface-soft);
}

.btn-soft {
    background: var(--surface-soft);
    color: var(--primary-dark);
    border-color: transparent;
}

.btn-soft:hover {
    background: rgba(2, 132, 199, 0.15);
}

.btn-danger-outline {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.05);
    border-color: var(--danger);
}

.text-link {
    color: var(--primary);
    font-weight: 600;
    position: relative;
}

.text-link::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary);
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}

.text-link:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.card,
.hero-card,
.stat-card,
.note-card,
.cta-box {
    background: var(--surface);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover,
.stat-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.hero-card,
.cta-box,
.form-card,
.auth-card,
.note-card {
    padding: 2rem;
}

.card {
    padding: 1.5rem;
}

.card h3,
.card h2,
.card h4,
.hero-card h3,
.auth-card h1,
.page-header h2 {
    margin-top: 0;
    color: var(--text);
}

.card-grid {
    display: grid;
    gap: 1.5rem;
}

.card-grid.one { grid-template-columns: 1fr; }
.card-grid.two { grid-template-columns: repeat(2, 1fr); }
.card-grid.three { grid-template-columns: repeat(3, 1fr); }
.card-grid.four { grid-template-columns: repeat(4, 1fr); }

.compact-gap {
    gap: 1rem;
}

.stat-card {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 4px 0 0 4px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.stat-card strong {
    display: block;
    margin-top: 0.5rem;
    font-size: 2.2rem;
    line-height: 1.1;
    color: var(--text);
    font-weight: 800;
}

.stats-inline {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.stats-inline > div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    min-width: 150px;
    box-shadow: var(--shadow-sm);
}

.stats-inline strong {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
}

.stats-inline span {
    color: var(--muted);
    font-size: 0.95rem;
}

.stats-inline.stacked {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.hero-contact {
    margin-top: 1.5rem;
    display: grid;
    gap: 1rem;
}

.hero-contact p {
    margin: 0;
    padding: 1rem 1.2rem;
    background: var(--surface-soft);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(2, 132, 199, 0.1);
    font-weight: 500;
}

.section {
    padding: 3rem 0;
}

.section.light {
    background: linear-gradient(180deg, rgba(248,250,252,0), rgba(240,249,255,0.6));
}

.section-heading {
    margin-bottom: 2rem;
}

.section-heading.narrow,
.auth-wrap {
    max-width: 840px;
    margin-inline: auto;
}

.section-heading.small {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.feature-list {
    padding-left: 1.5rem;
    margin: 0;
}

.feature-list.clean {
    list-style: none;
    padding-left: 0;
}

.feature-list.clean li {
    position: relative;
    padding-left: 1.8rem;
    margin-bottom: 0.8rem;
    color: var(--text);
}

.feature-list.clean li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 800;
    background: var(--surface-soft);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    top: 2px;
}

.service-card .card-top,
.record-head,
.message-meta,
.message-head,
.page-header,
.filter-grid,
.topbar-user,
.footer-grid,
.inline-search,
.inline-form,
.checkbox-row {
    display: flex;
    gap: 1rem;
}

.card-top,
.record-head,
.message-head,
.page-header {
    justify-content: space-between;
    align-items: flex-start;
}

.tag,
.badge,
.price,
.mini-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.tag {
    background: rgba(2, 132, 199, 0.1);
    color: var(--primary-dark);
}

.price {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    font-weight: 800;
}

.badge-warning { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #047857; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }

.alert {
    padding: 1rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.2);
}

.flash-stack {
    padding-top: 1rem;
}

.form-grid {
    display: grid;
    gap: 1.2rem;
}

.form-grid.two-columns {
    grid-template-columns: repeat(2, 1fr);
}

.form-grid label {
    display: grid;
    gap: 0.5rem;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-grid label span,
.filter-grid label span {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 400;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 0.85rem 1rem;
    color: var(--text);
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
    background: #fff;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

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

.filter-grid {
    flex-wrap: wrap;
    align-items: end;
    background: #fff;
    padding: 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.filter-grid label {
    min-width: 180px;
    flex: 1 1 180px;
}

.inline-search {
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: grid;
    gap: 0.8rem;
    min-width: 220px;
}

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    text-align: left;
    padding: 1.1rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table th {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8fafc;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--surface-soft);
}

.table-compact th,
.table-compact td {
    padding: 0.85rem 0.75rem;
}

.muted,
.table small,
.mini-card span,
.record-card.minimal p,
.message-item small,
.top-space {
    color: var(--muted);
}

.top-space {
    margin-top: 1.5rem;
}

.two-col,
.dashboard-grid.two-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.two-col.align-start,
.dashboard-grid.align-start {
    align-items: start;
}

.auth-section {
    padding: 4rem 0 5rem;
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
}

.auth-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
}

.auth-wrap.wide {
    max-width: 1000px;
}

.auth-card {
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    border: none;
}

.auth-card.large {
    max-width: 780px;
}

.cta-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    border: none;
}

.cta-box h2, .cta-box p {
    color: #fff;
}

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

.cta-box .btn-primary:hover {
    background: var(--surface-soft);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.cta-section {
    padding-bottom: 4rem;
}

.site-footer {
    margin-top: 3rem;
    padding: 4rem 0 1.5rem;
    background: #0f172a;
    color: #cbd5e1;
}

.footer-grid {
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.6rem;
}

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

.footer-bottom {
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 0.9rem;
}

.dashboard-body {
    background: #f1f5f9;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #0f172a; /* Deep Navy Dashboard Sidebar */
    color: #e2e8f0;
    padding: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
}

.brand-sidebar {
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-sidebar strong { color: #fff; }

.sidebar-nav {
    display: grid;
    gap: 0.5rem;
}

.sidebar-nav a {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary-light);
}

.mini-count {
    margin-left: 0.5rem;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
}

.sidebar-nav a.active .mini-count {
    background: var(--primary);
}

.dashboard-main {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 2rem;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.dashboard-topbar p,
.page-header p,
.section-heading p {
    margin: 0;
    color: var(--muted);
}

.dashboard-content {
    display: grid;
    gap: 1.5rem;
}

.message-stack,
.record-list {
    display: grid;
    gap: 1rem;
}

.message-item,
.record-card.minimal {
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
    transition: var(--transition);
}

.message-item:last-child,
.record-card.minimal:last-child {
    border-bottom: 0;
}

.message-item:hover,
.record-card.minimal:hover {
    background: #fafafa;
    border-radius: var(--radius-sm);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.message-item.unread,
.message-card.unread {
    border-left: 4px solid var(--primary);
    background: var(--surface-soft);
    padding-left: 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.message-card {
    padding: 1.5rem;
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.record-card p,
.message-card p,
.about-card p {
    margin: 0.5rem 0;
    color: var(--text);
}

.appointment-highlight {
    display: grid;
    gap: 0.5rem;
}

.mini-card {
    min-height: 100%;
}

.checkbox-row {
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-inline input {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
    accent-color: var(--primary);
}

.button-row.compact {
    gap: 0.5rem;
}

.note-card {
    background: linear-gradient(180deg, #ffffff, #f0f9ff);
    border-color: rgba(2, 132, 199, 0.2);
}

.cabinet-highlight,
.about-card {
    min-height: 100%;
}

@media (max-width: 1100px) {
    .hero-grid,
    .two-col,
    .dashboard-grid.two-main,
    .card-grid.four,
    .card-grid.three {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-shell {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 860px) {
    .nav-wrap,
    .cta-box,
    .dashboard-topbar,
    .message-head,
    .record-head,
    .page-header,
    .section-heading.small {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cta-box {
        text-align: center;
    }

    .hero-grid,
    .two-col,
    .dashboard-grid.two-main,
    .card-grid.two,
    .card-grid.three,
    .card-grid.four,
    .form-grid.two-columns {
        grid-template-columns: 1fr;
    }

    .dashboard-shell,
    .patient-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .dashboard-main {
        padding: 1rem;
    }
}

@media (max-width: 580px) {
    .container {
        width: min(var(--container), calc(100% - 1.5rem));
    }

    .main-nav {
        justify-content: flex-start;
    }

    .hero-section {
        padding-top: 3rem;
    }

    .hero-grid h1 {
        font-size: 2.2rem;
    }

    .btn,
    .main-nav .btn {
        width: 100%;
    }

    .stats-inline.stacked {
        grid-template-columns: 1fr;
    }
}

.surface-soft {
    background: var(--surface-soft);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.stack-panel {
    display: grid;
    gap: 1.2rem;
}

.align-center {
    align-items: center;
}

.compact-top {
    margin-top: 1rem;
}

.section-divider {
    height: 1px;
    background: var(--line);
    margin: 1.5rem 0;
    border: none;
}

/* Timeline & Scheduling UI Enhancements */
.timeline-day {
    display: grid;
    gap: 1.2rem;
}

.timeline-day.compact {
    gap: 0.85rem;
}

.timeline-slot {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1.2rem;
    align-items: start;
    position: relative;
}

/* Add a connection line between slots */
.timeline-slot:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 50px;
    top: 60px;
    bottom: -1.2rem;
    width: 2px;
    background: var(--line);
    z-index: 0;
}

.timeline-time {
    background: var(--surface);
    border: 2px solid var(--surface-soft);
    border-radius: 12px;
    padding: 1rem 0.5rem;
    text-align: center;
    font-weight: 800;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
}

.timeline-content {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.timeline-content:hover {
    box-shadow: var(--shadow);
    border-color: rgba(2, 132, 199, 0.3);
}

.timeline-content p {
    margin: 0.5rem 0;
}

.meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

/* Invoices & Billing UI */
.invoice-items-box {
    display: grid;
    gap: 1rem;
}

.invoice-items-container {
    display: grid;
    gap: 0.85rem;
}

.invoice-item-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 120px 140px 110px;
    gap: 1rem;
    align-items: center;
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: var(--transition);
}

.invoice-item-row:hover {
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.item-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.invoice-preview {
    display: grid;
    gap: 1.5rem;
}

.invoice-totals {
    display: grid;
    gap: 0.8rem;
    max-width: 400px;
    margin-left: auto;
}

.invoice-totals > div {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem 1.2rem;
    border-radius: var(--radius-sm);
    background: #fff;
    border: 1px solid var(--line);
}

.invoice-totals .grand-total {
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.invoice-totals .grand-total span {
    font-weight: 800;
    font-size: 1.2rem;
}

.file-card {
    display: grid;
    gap: 0.6rem;
    align-items: center;
    text-align: center;
}

.file-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--muted);
}

.empty-state i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
    display: block;
}

/* Print Styles Restyled */
.print-body {
    background: #cbd5e1;
    min-height: 100vh;
    padding: 2rem 0;
}

.print-shell {
    width: min(900px, calc(100% - 2rem));
    margin: 0 auto;
    background: #fff;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
}

.print-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.invoice-sheet {
    padding: 3rem;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--line);
}

.invoice-header-side {
    text-align: right;
}

.invoice-header-side h2 {
    color: var(--primary-dark);
    margin-top: 0;
}

.invoice-header-side p,
.invoice-sheet p {
    margin: 0.4rem 0;
    color: var(--muted);
}

.card-top.align-center {
    align-items: center;
}

@media (max-width: 960px) {
    .invoice-item-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .item-row-actions {
        justify-content: flex-start;
        grid-column: 1 / -1;
    }

    .timeline-slot,
    .invoice-header {
        grid-template-columns: 1fr;
        display: grid;
    }
    
    .timeline-slot:not(:last-child)::after {
        display: none;
    }

    .invoice-header-side {
        text-align: left;
    }
}

@media (max-width: 720px) {
    .timeline-slot,
    .invoice-item-row,
    .print-toolbar {
        grid-template-columns: 1fr;
        display: grid;
    }

    .timeline-time {
        text-align: left;
        display: inline-block;
    }
    
    .invoice-totals {
        max-width: 100%;
    }
}

@media print {
    .no-print,
    .sidebar,
    .dashboard-topbar,
    .site-footer,
    .site-header,
    .print-toolbar {
        display: none !important;
    }

    body,
    .print-body {
        background: #fff;
        padding: 0;
    }

    .print-shell {
        width: 100%;
        margin: 0;
        box-shadow: none;
        border-radius: 0;
    }

    .invoice-sheet {
        padding: 0;
        border: 0;
        box-shadow: none;
    }
    
    .invoice-totals .grand-total {
        background: #f1f5f9; /* Fallback for print color accuracy */
        color: #000;
        border: 2px solid #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}