:root {
    /* Theme - Light, Clean, Professional */
    --primary-color: #0f172a;
    /* Dark Navy (Brand) */
    --accent-color: #3b82f6;
    /* Blue for details */
    --primary-hover: #1e293b;

    --bg-body: #f8fafc;
    /* Light Gray Background */
    --bg-sidebar: #ffffff;
    /* White Sidebar */
    --bg-card: #ffffff;

    --text-primary: #0f172a;
    /* Dark Slate */
    --text-secondary: #64748b;
    /* Medium Gray */
    --text-tertiary: #94a3b8;
    /* Light Gray */

    --border-color: #e2e8f0;
    /* Light Border */

    --success-color: #10b981;
    --success-bg: #dcfce7;
    --success-text: #166534;

    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);

    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    display: flex;
    min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    z-index: 50;
}

.sidebar-header {
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
}

.sidebar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-section {
    padding: 0.75rem 0;
}

.nav-section-title {
    padding: 0 2rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: #f8fafc;
}

.nav-link.active {
    color: var(--text-primary);
    background-color: #f1f5f9;
    border-left-color: var(--text-primary);
    /* Or accent color */
    font-weight: 600;
}

.nav-icon {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    stroke-width: 2px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    /* Subtle border for clean look */
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Stats Cards Specifics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.stat-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.stat-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
}

.stat-badge.success {
    background: var(--success-bg);
    color: var(--success-text);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Helper Text */
.text-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    gap: 0.5rem;
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.btn-white {
    background-color: white;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-white:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Grid & Scenarios */
.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.scenario-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    /* For badge */
    display: flex;
    flex-direction: column;
    min-height: 240px;
    transition: all 0.2s;
}

.scenario-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.scenario-card.active {
    border: 2px solid var(--text-primary);
    /* Dark border for active */
    background: #f8fafc;
}

.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.scenario-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.scenario-badge {
    position: absolute;
    top: -10px;
    right: 1.5rem;
    background: var(--success-bg);
    color: var(--success-text);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Add shadow for pop-out effect */
}

.scenario-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scenario-actions {
    display: flex;
    gap: 0.75rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
}

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

tr:hover td {
    background: #f8fafc;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.2);
    /* Light dark overlay */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 95%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: scale(0.98);
    transition: 0.2s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content.modal-large {
    max-width: 1000px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-body {
    padding: 2rem;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
}

/* Preview Phone */
.preview-phone {
    width: 320px;
    background: #fff;
    border-radius: 3rem;
    padding: 0.5rem;
    border: 4px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

.preview-screen {
    background: #e2e8f0;
    height: 580px;
    border-radius: 2.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#previewBubble {
    background: white;
    padding: 0.75rem;
    border-radius: 0 0.75rem 0.75rem 0.75rem;
    /* Chat bubble style */
    margin: 0.5rem;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#previewButtonsBubble {
    padding: 0 0.5rem;
}

/* Utilities */
.text-danger {
    color: var(--danger-color);
}

.text-secondary {
    color: var(--text-secondary);
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Form inputs */
input,
textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-family: inherit;
    font-size: 0.9rem;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--text-primary);
}