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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
}

/* ── Nav ── */
nav {
    background: #1a1a2e;
    color: #fff;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
nav .brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .5px; }
nav a { color: #cbd5e1; text-decoration: none; font-size: .9rem; }
nav a:hover { color: #fff; }

/* ── Container ── */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem 1rem;
    border-radius: 6px;
    border: none;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary   { background: #4f46e5; color: #fff; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-warning   { background: #d97706; color: #fff; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-secondary { background: #e2e8f0; color: #374151; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* ── Cards / Slot groups ── */
.slot-group { margin-bottom: 2rem; }
.slot-group h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #4f46e5;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: .75rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid #e0e7ff;
}

.ads-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.ads-table th {
    background: #f8fafc;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #64748b;
    padding: .6rem 1rem;
    text-align: left;
}
.ads-table td {
    padding: .75rem 1rem;
    font-size: .875rem;
    border-top: 1px solid #f1f5f9;
    vertical-align: middle;
}
.ads-table tr:hover td { background: #fafbff; }

.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-active   { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fee2e2; color: #b91c1c; }
.badge-html     { background: #ede9fe; color: #6d28d9; }
.badge-image    { background: #dbeafe; color: #1d4ed8; }

.preview-thumb {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Forms ── */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    padding: 2rem;
    max-width: 680px;
}
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: .4rem;
    color: #374151;
}
.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .55rem .8rem;
    border: 1.5px solid #d1d5db;
    border-radius: 7px;
    font-size: .9rem;
    transition: border-color .15s;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4f46e5;
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: .78rem; color: #6b7280; margin-top: .3rem; }

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* ── Login ── */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f0f2f5;
}
.login-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-card h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.login-card p  { color: #6b7280; font-size: .9rem; margin-bottom: 1.5rem; }
.login-card .form-group { text-align: left; }
.login-card .btn { width: 100%; justify-content: center; margin-top: .5rem; }

/* ── Alerts ── */
.alert {
    padding: .75rem 1rem;
    border-radius: 8px;
    font-size: .875rem;
    margin-bottom: 1rem;
}
.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

/* ── Empty state ── */
.empty { color: #9ca3af; font-size: .875rem; padding: 1rem; }

/* ── Toggle form visibility ── */
#type-html-section, #type-image-section { display: none; }

/* ── Responsive ── */
@media (max-width: 640px) {
    .form-row { flex-direction: column; }
    .ads-table th:nth-child(3),
    .ads-table td:nth-child(3) { display: none; }
}
