:root {
    --navy: #1a2332;
    --navy-light: #243044;
    --navy-dark: #111827;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --green: #10b981;
    --green-light: #d1fae5;
    --red: #ef4444;
    --red-light: #fee2e2;
    --orange: #f59e0b;
    --orange-light: #fef3c7;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--navy);
    line-height: 1.6;
    min-height: 100vh;
}

/* ─── Login Page ─────────────────────────────────────────────── */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
}

.login-card .logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.3px;
}

.login-card .logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--navy);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
    width: 100%;
    padding: 12px 20px;
    font-size: 15px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

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

.btn-outline:hover {
    background: rgba(59, 130, 246, 0.05);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-copy {
    background: var(--navy);
    color: var(--white);
    padding: 8px 18px;
    font-size: 13px;
}

.btn-copy:hover {
    background: var(--navy-light);
}

.btn-copy.copied {
    background: var(--green);
}

.error-msg {
    background: var(--red-light);
    color: var(--red);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
}

/* ─── Nav / Shell ────────────────────────────────────────────── */

.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topnav {
    background: var(--navy);
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topnav .brand {
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.2px;
    text-decoration: none;
}

.topnav .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topnav .nav-right .publisher-name {
    font-size: 13px;
    color: var(--gray-300);
}

.topnav .nav-right a {
    font-size: 13px;
    color: var(--gray-400);
    text-decoration: none;
    transition: color 0.15s;
}

.topnav .nav-right a:hover {
    color: var(--white);
}

.topnav .nav-right a.nav-link {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.15s;
}

.topnav .nav-right a.nav-link:hover {
    background: rgba(255,255,255,0.1);
}

.topnav .nav-right a.nav-link.active {
    color: var(--white);
    background: rgba(255,255,255,0.12);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
    flex: 1;
}

/* ─── Dashboard ──────────────────────────────────────────────── */

.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.3px;
}

.page-header p {
    color: var(--gray-500);
    font-size: 15px;
    margin-top: 4px;
}

.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

.campaign-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.campaign-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.campaign-card .card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.campaign-card .card-header .advertiser-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--gray-100);
    flex-shrink: 0;
}

.campaign-card .card-header .logo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.campaign-card .card-header .card-titles h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.3;
}

.campaign-card .card-header .card-titles .advertiser {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 2px;
}

.campaign-card .description {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.campaign-card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.meta-tag.cpc {
    background: var(--green-light);
    color: #065f46;
}

.meta-tag.cap {
    background: var(--orange-light);
    color: #92400e;
}

.meta-tag.audience {
    background: var(--gray-100);
    color: var(--gray-700);
}

.campaign-card .card-footer {
    margin-top: auto;
}

.campaign-card .card-footer .btn {
    width: 100%;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--navy);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
    font-size: 15px;
    max-width: 400px;
    margin: 0 auto;
}

/* ─── Campaign Detail ────────────────────────────────────────── */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 20px;
    transition: color 0.15s;
}

.back-link:hover { color: var(--accent); }

.detail-header {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
}

.detail-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 4px;
}

.detail-header .advertiser-label {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 20px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.detail-meta .meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-meta .meta-item .label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
}

.detail-meta .meta-item .value {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
}

/* Tracking Link Box */
.tracking-link-box {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 20px;
    color: var(--white);
}

.tracking-link-box .tl-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-300);
    margin-bottom: 12px;
}

.tracking-link-box .tl-url-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 14px;
}

.tracking-link-box .tl-url {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 15px;
    color: var(--white);
    word-break: break-all;
    user-select: all;
}

.tracking-link-box .tl-hint {
    font-size: 13px;
    color: var(--gray-300);
    line-height: 1.5;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab-btn:hover { color: var(--navy); }

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

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

/* Overview Section */
.info-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
}

.info-section h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
    margin-bottom: 10px;
}

.info-section p {
    font-size: 15px;
    color: var(--gray-700);
    line-height: 1.7;
}

/* Creative Hint */
.creatives-hint {
    background: var(--green-light);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    margin-bottom: 20px;
    border-left: 4px solid var(--green);
}

.creatives-hint p {
    font-size: 14px;
    color: #065f46;
    line-height: 1.6;
    margin: 0;
    font-weight: 500;
}

/* Creative Cards */
.creatives-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.creative-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.creative-card .creative-body {
    padding: 24px 28px;
}

.creative-card .creative-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.creative-card .creative-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-500);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-recommended {
    background: var(--green-light);
    color: #065f46;
}

.badge-image-required {
    background: var(--orange-light);
    color: #92400e;
}

.creative-card .creative-headline {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 12px;
    line-height: 1.3;
}

.creative-card .creative-bodytext {
    font-size: 15px;
    color: var(--gray-600);
    line-height: 1.7;
    margin-bottom: 16px;
    white-space: pre-line;
}

.creative-card .creative-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 16px;
}

.creative-card .creative-image-preview {
    margin-bottom: 16px;
}

.creative-card .creative-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    object-fit: contain;
    border: 1px solid var(--gray-200);
}

.creative-card .creative-image-preview a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    margin-top: 8px;
}

.creative-card .creative-image-preview a:hover { text-decoration: underline; }

/* ─── Tracking Instructions ──────────────────────────────────── */

.tracking-instructions {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
}

.tracking-instructions h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
    margin-bottom: 14px;
}

.tracking-instructions ol {
    padding-left: 20px;
    color: var(--gray-700);
    font-size: 15px;
    line-height: 1.7;
}

.tracking-instructions li {
    margin-bottom: 8px;
}

/* ─── Landing Page Warning ───────────────────────────────────── */

.landing-page-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
    border-left: 4px solid var(--red);
}

.landing-page-section h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
    margin-bottom: 14px;
}

.landing-page-warning {
    margin-bottom: 12px;
}

.warning-highlight {
    display: inline;
    background: #ffe600;
    color: #1a1a1a;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.2px;
    padding: 2px 6px;
    line-height: 1.8;
}

.landing-page-hint {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 14px;
}

.landing-page-url {
    font-size: 14px;
    color: var(--gray-500);
    word-break: break-all;
}

/* ─── FAQ Page ───────────────────────────────────────────────── */

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.faq-question {
    padding: 20px 28px;
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s;
}

.faq-question:hover {
    background: var(--gray-50);
}

.faq-question::after {
    content: '+';
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-400);
    flex-shrink: 0;
    margin-left: 16px;
    transition: transform 0.2s;
}

details[open] .faq-question::after {
    content: '−';
    color: var(--accent);
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-answer {
    padding: 0 28px 24px;
    font-size: 15px;
    color: var(--gray-600);
    line-height: 1.7;
    white-space: pre-line;
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
    .container { padding: 20px 16px; }
    .topnav { padding: 0 16px; }
    .campaigns-grid { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
    .tracking-link-box { padding: 20px; }
    .tracking-link-box .tl-url-row { flex-direction: column; align-items: stretch; }
    .detail-meta { gap: 16px; }
    .faq-question { padding: 16px 20px; font-size: 15px; }
    .faq-answer { padding: 0 20px 20px; }
}
