:root {
    --primary-color: #0047ff;
    --primary-hover: #0037cc;
    --bg-light: #ffffff;
    --bg-gray: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --header-bg: #0047ff;
    --nav-text: #ffffff;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    background-color: var(--bg-gray);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Global Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header & Navigation */
header {
    background-color: var(--header-bg);
    padding: 0;
    /* Let nav-container handle height */
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 72px;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.logo-text span {
    font-weight: 400;
    opacity: 0.8;
}

.nav-links-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links-right a.nav-item {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: opacity 0.2s;
    line-height: 1;
}

.nav-links-right a.nav-item:hover {
    opacity: 0.7;
}

.nav-form {
    display: flex;
    align-items: center;
    margin: 0;
}

/* Auth / Badges */
.role-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    line-height: 1;
}

.btn-logout {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.btn-logout:hover {
    border-color: white;
    background: rgba(255, 255, 255, 0.1);
}

.btn-outline {
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
    line-height: 1;
}


/* Dashboard Content */
.ops-main {
    padding: 4rem 2rem;
    max-width: 1280px;
    margin: 0 auto;
    margin-bottom: 100dvh
}

.ops-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: -0.04em;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.ops-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 3rem;
}

/* Stats Summary */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.stat-item {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

/* Dashboard Sections */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2.5rem;
    margin-bottom: 4rem;
}

.dash-section h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.performer-card {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-left: 6px solid var(--success);
}

.performer-card.warning {
    border-left-color: var(--warning);
    padding: 0.5rem 2rem;
    margin-bottom: 0.5rem;
}

.p-shortcode {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.warning .p-shortcode {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.p-vendor {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.p-value {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--success);
}

.warning .p-value {
    color: var(--warning);
}

.none-msg {
    padding: 2rem;
    text-align: center;
    background: #f1f5f9;
    border-radius: 12px;
    color: var(--text-secondary);
    font-style: italic;
    border: 1px dashed var(--border-color);
}

/* Detailed Metrics Table */
.table-container {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-top: 1rem;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
}

.metrics-table th {
    background: #f8fafc;
    padding: 1.25rem 2rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

.metrics-table td {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.metrics-table tr:last-child td {
    border-bottom: none;
}

.high-sales {
    color: var(--success);
    font-weight: 800;
}

.muted {
    color: var(--text-secondary);
}

.bold {
    font-weight: 800;
    color: var(--text-primary);
}

/* Operations Grid */
.ops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
}

.op-card {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    text-decoration: none;
    display: flex;
    gap: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.op-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.op-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.op-info h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.op-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.op-roles {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.role-tag-sm {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: #f8fafc;
    line-height: 1;
}

.role-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: #f8fafc;
}

/* Forms & Inputs */
.fn-roles {
    display: flex;
    gap: 0.25rem;
}

.fn-card {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.fn-card-header {
    background: var(--primary-color);
    padding: 3rem 4rem;
    color: white;
}

.fn-title {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.fn-desc {
    opacity: 0.8;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.params-grid {
    padding: 4rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.text-input,
.select-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.text-input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 71, 255, 0.1);
}

.btn-run {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1.25rem 3rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-run:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

.fn-actions {
    padding: 2rem 4rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
}

.btn-edit-sm {
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    margin-left: 0.5rem;
    transition: all 0.2s;
}

.btn-edit-sm:hover {
    background: white;
    border-color: var(--primary-color);
}

/* Terminals */
.output-box {
    background: #0f172a;
    color: #f8fafc;
    padding: 2.5rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    border-radius: 0 0 24px 24px;
}

.line-banner {
    color: var(--success);
    font-weight: 700;
}

.line-error {
    color: var(--danger);
}

.log-selector-card {
    background: white;
    padding: 3rem;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.search-box {
    max-width: 600px;
}

.animate-in {
    animation: fadeInSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.active-panel {
    border-left: 6px solid var(--primary-color);
}

/* Log Cards inside sections */
.log-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.log-title {
    margin-bottom: 1rem;
}

.domain-badge {
    background: #eff6ff;
    color: var(--primary-color);
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.9rem;
}

.btn-log {
    background: var(--bg-gray);
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    display: inline-block;
}

.btn-log:hover {
    background: white;
    border-color: var(--primary-color);
}

.btn-sm {
    line-height: 1.5;
}
.btn-danger {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fee2e2;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.btn-danger:hover {
    background: #fee2e2;
}

.ops-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    gap: 2rem;
    background: white;
    padding: 1.5rem 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
    justify-content: flex-end;
}

.header-actions .search-box {
    width: 100%;
    max-width: 400px;
}

.ops-section-group {
    margin-bottom: 2.5rem;
}

.ops-section-group h2 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.op-card-compact {
    background: white;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.op-card-compact:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.op-icon-sm {
    font-size: 1.75rem;
}

.op-card-compact h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.op-card-compact p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.1rem 0 0 0;
}

.btn-primary-sm {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    white-space: nowrap;
}

.btn-primary-sm:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.version-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.version-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    display: inline-block;
}

.version-tag-sm {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.p-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.metrics-table th.money {
    text-align: end;
}
.money {
    text-align: end;
}