/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
    --brand-green:   #2C5F2E;
    --brand-light:   #4A8C4D;
    --brand-bg:      #F5F0E8;
    --sidebar-w:     240px;
    --white:         #ffffff;
    --gray-50:       #f9fafb;
    --gray-100:      #f3f4f6;
    --gray-200:      #e5e7eb;
    --gray-400:      #9ca3af;
    --gray-600:      #4b5563;
    --gray-800:      #1f2937;
    --success:       #16a34a;
    --success-bg:    #dcfce7;
    --error:         #dc2626;
    --error-bg:      #fee2e2;
    --warning:       #d97706;
    --warning-bg:    #fef3c7;
    --nps-promoter:  #16a34a;
    --nps-passive:   #d97706;
    --nps-detractor: #dc2626;
    --radius:        8px;
    --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--gray-800); background: var(--gray-100); display: flex; min-height: 100vh; }
a { color: var(--brand-green); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font: inherit; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--brand-green);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}
.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.brand-logo { font-size: 28px; line-height: 1; }
.brand-name  { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.brand-sub   { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: rgba(255,255,255,.8);
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,.15);
    color: var(--white);
    text-decoration: none;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    opacity: .85;
}
.admin-name svg { width: 16px; height: 16px; }
.logout-btn {
    font-size: 12px;
    color: rgba(255,255,255,.6);
    transition: color .15s;
}
.logout-btn:hover { color: var(--white); text-decoration: none; }

/* ─── Main content ───────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.page-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 20px 32px;
}
.page-header h1 { font-size: 20px; font-weight: 600; color: var(--gray-800); }
.page-body { padding: 24px 32px; flex: 1; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 16px 32px 0;
    font-size: 13px;
    font-weight: 500;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff;             color: #1d4ed8;        border: 1px solid #bfdbfe; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-primary { background: var(--brand-green); color: var(--white); border-color: var(--brand-green); }
.btn-outline  { background: var(--white); color: var(--gray-600); border-color: var(--gray-200); }
.btn-outline:hover { border-color: var(--gray-400); }
.btn-warning  { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.btn-danger   { background: var(--error-bg); color: var(--error); border-color: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ─── KPI cards ──────────────────────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--gray-200);
}
.kpi-active { border-left-color: var(--brand-green); }
.kpi-value { font-size: 32px; font-weight: 700; color: var(--gray-800); line-height: 1; }
.kpi-label { font-size: 12px; color: var(--gray-400); margin-top: 6px; text-transform: uppercase; letter-spacing: .5px; }

/* ─── Section header ─────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-header h2 { font-size: 16px; font-weight: 600; color: var(--gray-800); }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-wrapper { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--gray-50); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-400); border-bottom: 1px solid var(--gray-200); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--gray-50); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray-400); font-size: 13px; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.badge-active  { background: var(--success-bg); color: var(--success); }
.badge-draft   { background: var(--gray-100);   color: var(--gray-600); }
.badge-closed  { background: var(--error-bg);   color: var(--error); }

/* ─── NPS badges & score ─────────────────────────────────────────────────── */
.nps-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 13px;
}
.nps-pos { background: var(--success-bg); color: var(--success); }
.nps-neg { background: var(--error-bg);   color: var(--error); }

/* ─── Campaign detail ────────────────────────────────────────────────────── */
.campaign-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.campaign-meta  { display: flex; align-items: center; gap: 12px; }
.campaign-actions { display: flex; align-items: center; gap: 8px; }

.info-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}
.info-box label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-400); display: block; margin-bottom: 8px; }
.url-copy { display: flex; gap: 8px; margin-bottom: 6px; }
.url-copy input { flex: 1; padding: 7px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--gray-50); font-size: 12px; font-family: monospace; color: var(--gray-600); }
.info-box small { font-size: 12px; color: var(--gray-400); }
.info-box code  { background: var(--gray-100); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* NPS Dashboard */
.nps-dashboard {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.nps-score-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-right: 1px solid var(--gray-100); padding-right: 24px; }
.nps-score-value { font-size: 56px; font-weight: 800; line-height: 1; }
.nps-score-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-400); margin-top: 6px; }
.nps-score-total { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.nps-breakdown { display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.nps-bar-group { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.nps-bar-label { grid-column: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.nps-bar-label strong { margin-left: auto; font-weight: 600; }
.nps-bar-track { grid-column: 1; height: 8px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.nps-bar { height: 100%; border-radius: 99px; transition: width .5s ease; }
.nps-bar-promoter  { background: var(--nps-promoter); }
.nps-bar-passive   { background: var(--nps-passive); }
.nps-bar-detractor { background: var(--nps-detractor); }
.nps-pct { grid-column: 2; grid-row: span 2; font-size: 13px; font-weight: 600; color: var(--gray-600); min-width: 40px; text-align: right; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-promoter  { background: var(--nps-promoter); }
.dot-passive   { background: var(--nps-passive); }
.dot-detractor { background: var(--nps-detractor); }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow);
    max-width: 640px;
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-600); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-800);
    transition: border-color .15s;
    outline: none;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(44,95,46,.1);
}
.form-group small { display: block; margin-top: 4px; font-size: 12px; color: var(--gray-400); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--gray-100); }
.required { color: var(--error); }

/* ─── Login page ─────────────────────────────────────────────────────────── */
body.body-login {
    display: block;
    background: var(--brand-bg);
    min-height: 100vh;
}
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 36px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo span { display: block; font-size: 36px; color: var(--brand-green); margin-bottom: 8px; }
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--gray-800); }
.login-logo p  { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.empty-state p { color: var(--gray-400); margin-bottom: 16px; }

/* ─── Settings page ──────────────────────────────────────────────────────── */
.stab-nav {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.stab-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.stab-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.stab-btn:hover { color: var(--brand-green); }
.stab-btn.active { color: var(--brand-green); border-bottom-color: var(--brand-green); }

.stab-panel { display: none; }
.stab-panel.active { display: block; }

.scard {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.scard-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}

/* Logo preview */
.logo-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--gray-50);
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 16px;
    min-height: 110px;
}
.logo-preview img { max-height: 80px; max-width: 260px; object-fit: contain; }
.logo-empty { gap: 8px; }

/* Color grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.color-field { display: flex; flex-direction: column; gap: 4px; }
.color-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.color-row input[type="color"] {
    width: 44px;
    height: 38px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 3px;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}
.color-hex { width: 110px !important; font-family: monospace; }
.field-hint { font-size: 12px; color: var(--gray-400); }

/* Color preview bar */
.color-preview-bar {
    display: flex;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    height: 52px;
    margin-top: 8px;
}
.cpb-sidebar {
    width: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    transition: background .2s;
}
.cpb-content {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    transition: background .2s;
}
.cpb-text { font-size: 13px; transition: color .2s; }
.cpb-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    cursor: default;
    transition: background .2s;
}

/* Font type toggle */
.font-type-toggle {
    display: flex;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    width: fit-content;
}
.font-type-toggle input[type="radio"] { display: none; }
.font-type-toggle label {
    padding: 8px 20px;
    cursor: pointer;
    background: var(--white);
    font-size: 13px;
    color: var(--gray-600);
    border-right: 1px solid var(--gray-200);
    transition: background .15s, color .15s;
    user-select: none;
}
.font-type-toggle label:last-child { border-right: none; }
.font-type-toggle input[type="radio"]:checked + label {
    background: var(--brand-green);
    color: var(--white);
    font-weight: 600;
}

/* Font preview box */
.font-preview-box {
    padding: 12px 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-top: 8px;
    font-size: 17px;
    color: var(--gray-800);
    min-height: 48px;
    transition: font-family .3s;
}

/* Current font file indicator */
.font-current-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 4px;
}
.font-current-file strong { color: var(--gray-800); }
