/* =========================================
   KALKULATOR SHOPEE STAR+ — STYLE
   Modern Indonesian Business Tool aesthetic
   ========================================= */

:root {
    /* Colors */
    --color-bg: #FAF7F2;
    --color-card: #FFFFFF;
    --color-card-alt: #FFF8F1;
    --color-text: #1A1A2E;
    --color-text-muted: #6B7280;
    --color-text-light: #9CA3AF;
    --color-border: #E5E7EB;
    --color-border-light: #F3F4F6;
    
    /* Primary - Shopee inspired */
    --color-primary: #EE4D2D;
    --color-primary-dark: #D63A1F;
    --color-primary-light: #FEF2EF;
    
    /* Accent */
    --color-accent: #F59E0B;
    --color-accent-light: #FEF3C7;
    
    /* Status */
    --color-success: #16A34A;
    --color-success-light: #DCFCE7;
    --color-warning: #F59E0B;
    --color-warning-light: #FEF3C7;
    --color-danger: #DC2626;
    --color-danger-light: #FEE2E2;
    --color-info: #2563EB;
    --color-info-light: #DBEAFE;
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(26, 26, 46, 0.05);
    --shadow-md: 0 4px 12px rgba(26, 26, 46, 0.06), 0 1px 3px rgba(26, 26, 46, 0.04);
    --shadow-lg: 0 12px 32px rgba(26, 26, 46, 0.08), 0 4px 8px rgba(26, 26, 46, 0.04);
    --shadow-primary: 0 8px 24px rgba(238, 77, 45, 0.18), 0 2px 6px rgba(238, 77, 45, 0.12);
    
    /* Transitions */
    --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Fonts */
    --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-display);
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 100% 0%, rgba(238, 77, 45, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 0% 100%, rgba(245, 158, 11, 0.03) 0%, transparent 40%);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 768px) {
    .container { padding: 0 var(--space-6); }
}

/* =========================================
   HEADER
   ========================================= */
.app-header {
    background: linear-gradient(135deg, var(--color-card) 0%, var(--color-card-alt) 100%);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.app-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    gap: var(--space-3);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
}

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 640px) {
    .brand-text h1 { font-size: 20px; }
}

.badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--color-accent), #D97706);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.reset-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--color-card);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--t-base);
}

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

@media (max-width: 480px) {
    .reset-btn span { display: none; }
}

/* =========================================
   TABS
   ========================================= */
.tabs-nav {
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 67px;
    z-index: 49;
}

.tabs-scroll {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: var(--space-2);
    padding: var(--space-2) 0;
}

.tabs-scroll::-webkit-scrollbar { display: none; }

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: transparent;
    color: var(--color-text-muted);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--t-base);
    position: relative;
}

.tab-btn:hover { 
    color: var(--color-text);
    background: var(--color-border-light);
}

.tab-btn.active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.tab-icon {
    font-size: 16px;
}

/* =========================================
   TAB CONTENT
   ========================================= */
.tab-content {
    display: none;
    padding: var(--space-6) 0 var(--space-12);
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   CARD
   ========================================= */
.card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
}

@media (min-width: 768px) {
    .card { padding: var(--space-6); margin-bottom: var(--space-5); }
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.card-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.section-number {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--color-text);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.section-number.primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    box-shadow: var(--shadow-primary);
}

.card h3, .card h4 {
    color: var(--color-text);
    margin-bottom: var(--space-4);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card h3 { font-size: 17px; }
.card h4 { font-size: 14px; }

.sub-heading {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px dashed var(--color-border);
}

/* Hero Card */
.hero-card {
    background: linear-gradient(135deg, var(--color-text) 0%, #2D2D4A 100%);
    color: white;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    opacity: 0.4;
    pointer-events: none;
}

.hero-content { position: relative; z-index: 1; }
.hero-content h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
}

.hero-content p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
}

.hero-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

/* Highlight Card */
.highlight-card {
    background: linear-gradient(135deg, #FFFFFF 0%, var(--color-primary-light) 100%);
    border: 2px solid var(--color-primary);
}

/* =========================================
   FORMS
   ========================================= */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: relative;
}

.form-group.hidden { display: none; }

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.required { color: var(--color-danger); margin-left: 2px; }

.form-group small {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-card-alt);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    transition: var(--t-base);
    appearance: none;
    -webkit-appearance: none;
}

input[type="number"] {
    font-family: var(--font-mono);
    font-feature-settings: "tnum";
}

select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%231A1A2E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-card);
    box-shadow: 0 0 0 4px rgba(238, 77, 45, 0.1);
}

.input-with-suffix {
    position: relative;
}

.input-with-suffix .suffix {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-weight: 700;
    pointer-events: none;
}

.input-with-suffix input {
    padding-right: 32px;
}

/* Toggle Group */
.toggle-group {
    display: flex;
    background: var(--color-card-alt);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 3px;
}

.toggle-btn {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: transparent;
    color: var(--color-text-muted);
    border: none;
    border-radius: calc(var(--radius-md) - 3px);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--t-base);
    white-space: nowrap;
}

.toggle-btn:hover { color: var(--color-text); }

.toggle-btn.active {
    background: var(--color-text);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Suggest Tag */
.suggest-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-accent);
    background: var(--color-accent-light);
    padding: 2px 8px;
    border-radius: 999px;
    font-family: var(--font-mono);
}

.use-suggest {
    align-self: flex-start;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--t-base);
}

.use-suggest:hover {
    background: var(--color-accent);
    color: white;
}

/* =========================================
   RATES GRID
   ========================================= */
.rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
}

.rate-item {
    background: var(--color-card-alt);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    text-align: center;
}

.rate-item.highlight {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent-light));
    border-color: var(--color-primary);
}

.rate-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
}

.rate-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    font-feature-settings: "tnum";
}

.rate-item.highlight .rate-value { color: var(--color-primary); }

.rate-item small {
    display: block;
    margin-top: var(--space-1);
    font-size: 11px;
    color: var(--color-text-muted);
}

/* =========================================
   PRICE SHOWCASE
   ========================================= */
.price-showcase {
    text-align: center;
    padding: var(--space-4) 0;
}

.price-main {
    margin-bottom: var(--space-5);
}

.price-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-2);
}

.price-value {
    font-family: var(--font-mono);
    font-size: 42px;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.03em;
    line-height: 1;
    font-feature-settings: "tnum";
}

@media (min-width: 640px) {
    .price-value { font-size: 56px; }
}

.price-sub {
    margin-top: var(--space-3);
    font-size: 14px;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.price-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px dashed rgba(238, 77, 45, 0.3);
}

.secondary-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2);
}

.secondary-item span {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.secondary-item strong {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
}

/* =========================================
   BREAKDOWN
   ========================================= */
.breakdown-list {
    background: var(--color-card-alt);
    border-radius: var(--radius-md);
    padding: var(--space-2);
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    font-size: 14px;
}

.breakdown-row span {
    color: var(--color-text);
}

.breakdown-row span small {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-left: 4px;
}

.breakdown-row span:last-child {
    font-family: var(--font-mono);
    font-weight: 700;
    font-feature-settings: "tnum";
}

.breakdown-row .positive { color: var(--color-success); }
.breakdown-row .negative { color: var(--color-danger); }

.breakdown-row.subtotal {
    border-top: 1px dashed var(--color-border);
    border-bottom: 1px dashed var(--color-border);
    margin: var(--space-1) 0;
    background: white;
    border-radius: var(--radius-sm);
}

.breakdown-row.subtotal span {
    font-weight: 700;
    color: var(--color-info);
}

.breakdown-row.subtotal span:last-child {
    color: var(--color-info);
}

.breakdown-row.total {
    background: linear-gradient(135deg, var(--color-success-light), white);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    margin-top: var(--space-1);
}

.breakdown-row.total span {
    font-weight: 800;
    font-size: 16px;
    color: var(--color-success);
}

.breakdown-row.total span:last-child {
    font-size: 20px;
    color: var(--color-success);
}

/* Status Box */
.status-margin, .status-ads {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--color-success-light);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
    border-left: 4px solid var(--color-success);
}

.status-margin.warning, .status-ads.warning {
    background: var(--color-warning-light);
    border-left-color: var(--color-warning);
}

.status-margin.danger, .status-ads.danger {
    background: var(--color-danger-light);
    border-left-color: var(--color-danger);
}

.status-margin.info, .status-ads.info {
    background: var(--color-info-light);
    border-left-color: var(--color-info);
}

.status-icon { font-size: 24px; }

.status-text strong {
    display: block;
    font-weight: 700;
    margin-bottom: 2px;
}

.status-text span {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* =========================================
   ROAS SECTION
   ========================================= */
.roas-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.roas-item {
    background: var(--color-card-alt);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    text-align: center;
}

.roas-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
}

.roas-value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--color-primary);
    font-feature-settings: "tnum";
}

.roas-item small {
    display: block;
    margin-top: var(--space-1);
    font-size: 11px;
    color: var(--color-text-muted);
}

.profit-after-ads {
    background: var(--color-card-alt);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-top: var(--space-4);
}

.pa-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
    border-bottom: 1px dashed var(--color-border-light);
}

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

.pa-row strong {
    font-family: var(--font-mono);
    font-weight: 700;
    font-feature-settings: "tnum";
}

.pa-row .negative { color: var(--color-danger); }

.pa-row.total {
    background: var(--color-success-light);
    margin: var(--space-2) -var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-bottom: none;
    border-radius: 0;
}

.pa-row.total span, .pa-row.total strong {
    color: var(--color-success);
    font-weight: 800;
    font-size: 16px;
}

.pa-row.total.danger {
    background: var(--color-danger-light);
}

.pa-row.total.danger span, .pa-row.total.danger strong {
    color: var(--color-danger);
}

/* Projection Grid */
.projection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
}

.proj-item {
    background: var(--color-card-alt);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    text-align: center;
}

.proj-item.highlight {
    background: linear-gradient(135deg, var(--color-success-light), white);
    border: 2px solid var(--color-success);
}

.proj-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
}

.proj-value {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    font-feature-settings: "tnum";
}

.proj-item.highlight .proj-value { color: var(--color-success); }

/* =========================================
   MULTI-PRODUK TABLE
   ========================================= */
.table-card { padding: var(--space-2); }

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: var(--color-text);
    color: white;
    position: sticky;
    top: 0;
}

th {
    padding: var(--space-3) var(--space-2);
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

th.suggest { background: var(--color-accent); }
th.result { background: var(--color-success); }

td {
    padding: var(--space-2);
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

tbody tr:hover { background: var(--color-card-alt); }

td input, td select {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    min-width: 100px;
    background: var(--color-warning-light);
    border: 1px solid var(--color-border);
}

td input:focus, td select:focus {
    background: white;
}

td.suggest {
    background: var(--color-accent-light);
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-weight: 700;
    text-align: right;
    cursor: pointer;
    font-feature-settings: "tnum";
    transition: var(--t-fast);
}

td.suggest:hover {
    background: var(--color-accent);
    color: white;
}

td.result {
    background: var(--color-success-light);
    color: var(--color-success);
    font-family: var(--font-mono);
    font-weight: 700;
    text-align: right;
    font-feature-settings: "tnum";
    white-space: nowrap;
}

td.result.negative {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.row-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--color-danger-light);
    color: var(--color-danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--t-fast);
}

.icon-btn:hover {
    background: var(--color-danger);
    color: white;
}

tfoot tr {
    background: linear-gradient(135deg, var(--color-success-light), white);
    border-top: 2px solid var(--color-success);
}

tfoot td {
    padding: var(--space-3) var(--space-2);
    font-weight: 700;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--t-base);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(238, 77, 45, 0.28);
}

.btn-secondary {
    background: white;
    color: var(--color-text);
    border: 1.5px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-text);
    background: var(--color-card-alt);
}

/* =========================================
   PANDUAN MARGIN
   ========================================= */
.principle-box {
    background: var(--color-info-light);
    border-left: 4px solid var(--color-info);
    padding: var(--space-4);
    border-radius: var(--radius-md);
}

.principle-box p {
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

.principle-box p:last-child { margin-bottom: 0; }

.principle-box ul {
    list-style: none;
    margin-top: var(--space-3);
}

.principle-box ul li {
    padding: var(--space-2) 0;
    padding-left: var(--space-5);
    position: relative;
}

.principle-box ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--color-info);
    font-weight: 800;
}

.benchmark-grid {
    display: grid;
    gap: var(--space-3);
}

.benchmark-card {
    background: var(--color-card-alt);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    border-left: 4px solid var(--color-primary);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
}

@media (min-width: 768px) {
    .benchmark-card {
        grid-template-columns: 1.5fr 1fr 1fr 2fr 1.2fr;
        align-items: center;
        gap: var(--space-4);
    }
}

.bc-range {
    font-weight: 800;
    color: var(--color-text);
    font-size: 14px;
}

.bc-laba {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--color-success);
    background: var(--color-success-light);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 13px;
    display: inline-block;
    width: fit-content;
}

.bc-margin {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--color-primary);
    font-size: 14px;
}

.bc-contoh {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.bc-strategi {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    background: var(--color-accent-light);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    text-align: center;
    display: inline-block;
    width: fit-content;
}

.adjust-list {
    display: grid;
    gap: var(--space-2);
}

.adjust-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--color-card-alt);
}

.adjust-item.up { border-left: 4px solid var(--color-success); }
.adjust-item.down { border-left: 4px solid var(--color-warning); }

.adjust-direction {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

.adjust-item.up .adjust-direction { color: var(--color-success); }
.adjust-item.down .adjust-direction { color: var(--color-warning); }

.adjust-when {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* =========================================
   PANDUAN IKLAN
   ========================================= */
.formula-box {
    background: var(--color-card-alt);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

.formula {
    background: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--color-primary);
    margin-bottom: var(--space-2);
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--color-text);
}

.formula strong {
    color: var(--color-primary);
    font-weight: 800;
    margin-right: var(--space-1);
}

.formula.critical {
    border-left-color: var(--color-danger);
}

.formula.critical strong { color: var(--color-danger); }

.critical-note {
    display: block;
    color: var(--color-danger);
    font-weight: 700;
    margin-top: var(--space-1);
    font-size: 12px;
}

.formula-example {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
    padding-left: var(--space-4);
    font-family: var(--font-display);
}

/* Reference tables */
.ref-table th {
    background: var(--color-text);
    color: white;
}

.ref-table td {
    padding: var(--space-3) var(--space-2);
    font-size: 13px;
}

.ref-table tr:hover { background: var(--color-card-alt); }

.ref-table .num {
    font-family: var(--font-mono);
    font-weight: 700;
    text-align: center;
    font-feature-settings: "tnum";
}

.ref-table .num.bep { color: var(--color-danger); }
.ref-table .num.aman { color: var(--color-warning); }
.ref-table .num.bagus { color: var(--color-success); }

/* Ad Types */
.ad-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-3);
}

.ad-type {
    background: var(--color-card-alt);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border-top: 4px solid var(--color-primary);
}

.ad-type h4 {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.ad-type .ad-roas {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    margin-bottom: var(--space-2);
}

.ad-type p {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: var(--space-2);
}

.ad-type .ad-budget {
    font-size: 12px;
    color: var(--color-success);
    font-weight: 700;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--color-border);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: var(--space-6);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-5);
    padding-left: var(--space-5);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-week {
    position: absolute;
    left: -33px;
    top: 0;
    background: var(--color-primary);
    color: white;
    width: 60px;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.timeline-content {
    background: var(--color-card-alt);
    padding: var(--space-4);
    border-radius: var(--radius-md);
}

.timeline-content h4 {
    margin-bottom: var(--space-2);
    color: var(--color-text);
    font-size: 16px;
}

.timeline-meta {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-bottom: var(--space-2);
}

.timeline-meta strong { color: var(--color-success); }

.timeline-content > p:last-child {
    font-size: 13px;
    color: var(--color-text);
    margin-bottom: 0;
}

/* Rules List */
.rules-list {
    list-style: none;
    counter-reset: rules;
}

.rules-list li {
    counter-increment: rules;
    background: var(--color-card-alt);
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-10);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    font-size: 13px;
    line-height: 1.5;
    position: relative;
}

.rules-list li::before {
    content: counter(rules);
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 12px;
}

/* Notes List */
.notes-list {
    list-style: none;
}

.notes-list li {
    padding: var(--space-2) 0;
    padding-left: var(--space-5);
    position: relative;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
}

.notes-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: 800;
    font-size: 18px;
}

.notes-list a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.notes-list a:hover { text-decoration: underline; }

/* =========================================
   FOOTER
   ========================================= */
.app-footer {
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    padding: var(--space-5) 0;
    margin-top: var(--space-10);
}

.app-footer p {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted);
}

.app-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    margin-left: var(--space-1);
}

/* =========================================
   TOAST
   ========================================= */
.toast {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-text);
    color: white;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    transition: var(--t-base);
    opacity: 0;
    max-width: 90vw;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--color-success); }
.toast.warning { background: var(--color-warning); }
.toast.danger { background: var(--color-danger); }

/* =========================================
   UTILITIES & RESPONSIVE
   ========================================= */
.hidden { display: none !important; }

@media (max-width: 640px) {
    .tab-btn span:not(.tab-icon) {
        display: none;
    }
    .tabs-nav { top: 67px; }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .roas-results, .projection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .price-value { font-size: 36px; }
    .price-secondary { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
    .roas-results, .projection-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Save Button & Riwayat ===== */
.save-btn {
    width: 100%;
    margin-top: 16px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(16,185,129,0.3);
}
.save-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.4); }
.save-btn:active { transform: translateY(0); }

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.history-item {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.15s;
}
.history-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.history-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.history-name {
    font-weight: 700;
    color: var(--color-text);
    font-size: 15px;
    flex: 1;
    word-break: break-word;
}
.history-date { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; }

.history-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 4px;
}
.history-stat {
    background: #f8fafc;
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.history-stat-label { font-size: 10px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.history-stat-value { font-size: 13px; font-weight: 700; color: var(--color-text); margin-top: 2px; }
.history-stat-value.profit { color: var(--color-primary); }
.history-stat-value.danger { color: #dc2626; }

.history-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 4px;
    border-top: 1px dashed #e5e7eb;
}
.history-meta span { display: inline-block; }

.history-delete {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.history-delete:hover { background: #fecaca; }

@media (max-width: 640px) {
    .history-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Auth Panel (Cloud Sync - desktop) ===== */
.auth-panel { margin-bottom: 16px; }
.auth-not-config, .auth-login, .auth-status {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 14px 16px; border-radius: 10px; font-size: 14px;
    line-height: 1.4;
}
.auth-not-config { background: #f3f4f6; color: #4b5563; border: 1px dashed #d1d5db; }
.auth-login { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }
.auth-status { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.auth-icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.auth-email { font-weight: 700; }
.auth-form { display: flex; gap: 8px; flex-wrap: wrap; }
.auth-form input {
    flex: 1; min-width: 200px; padding: 10px 12px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 14px; background: #fff;
}
.auth-form input:focus { outline: none; border-color: #2563eb; }
.auth-form button {
    padding: 10px 18px; background: #2563eb; color: white;
    border: none; border-radius: 8px; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.auth-form button:hover { background: #1d4ed8; }
.auth-form button:disabled { background: #9ca3af; cursor: not-allowed; }
.auth-sent { margin: 10px 0 0; padding: 8px 12px; background: #d1fae5;
    border-radius: 6px; color: #065f46; font-size: 13px; }
.auth-signout {
    padding: 6px 12px; background: #fff; color: #065f46;
    border: 1px solid #a7f3d0; border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer;
}
.auth-signout:hover { background: #ecfdf5; }
.auth-not-config code, .m-auth-not-config code {
    background: #fff; padding: 2px 6px; border-radius: 4px;
    font-family: monospace; font-size: 12px;
}
.auth-status .auth-icon {
    width: 28px; height: 28px; background: #10b981; color: #fff;
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 16px;
}
