:root {
    --brand: #8A3FFC;
    --brand-dark: #6425D0;
    --brand-light: #F4EFFF;
    --bg: #F7F6FB;
    --text: #241E33;
    --text-muted: #7A7289;
    --border: #E7E3F2;
    --danger: #D64545;
    --success: #1E9E6C;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--brand); }

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}

.wide { max-width: 1080px; }

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

.topbar img { height: 36px; }
.topbar .brand-name { font-weight: 700; font-size: 18px; }

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: 0 2px 10px rgba(36, 30, 51, 0.04);
}

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 14px; }
p.subtitle { color: var(--text-muted); margin: 0 0 24px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

input[type=text], input[type=email], textarea, input[type=number], input[type=password] {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 18px;
    background: #fff;
    color: var(--text);
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
}

textarea { resize: vertical; min-height: 70px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.btn-secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.btn-secondary:hover { background: var(--brand-light); }
.btn.btn-danger { background: var(--danger); }
.btn.btn-danger:hover { background: #b83737; }
.btn.btn-block { width: 100%; }
.btn.btn-small { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 34px 20px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 18px;
    transition: border-color .15s, background .15s;
}

.dropzone.dragover { border-color: var(--brand); background: var(--brand-light); }
.dropzone strong { color: var(--brand); }

.file-list { margin: 0 0 18px; padding: 0; list-style: none; }

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 14px;
}

.file-list .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 10px; }
.file-list .file-size { color: var(--text-muted); font-size: 12px; white-space: nowrap; margin-right: 10px; }
.file-list button.remove {
    background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1;
}
.file-list button.remove:hover { color: var(--danger); }

.progress-wrap { margin: 8px 0 18px; display: none; }
.progress-bar-bg { background: var(--border); border-radius: 8px; height: 10px; overflow: hidden; }
.progress-bar-fill { background: var(--brand); height: 100%; width: 0%; transition: width .2s; }
.progress-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.link-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--brand-light);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.link-box input { flex: 1; border: none; background: transparent; margin: 0; padding: 0; font-size: 14px; }

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 18px;
}
.alert-error { background: #FBEAEA; color: var(--danger); }
.alert-success { background: #E7F7EF; color: var(--success); }
.alert-info { background: var(--brand-light); color: var(--brand-dark); }

.meta-row { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

footer.site-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 30px 20px;
}

/* Admin */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--brand-dark); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 100px;
    margin-bottom: 26px;
}

.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .bar { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .bar-day { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: var(--radius); overflow: hidden; }
table.data-table th, table.data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data-table th { background: var(--brand-light); color: var(--brand-dark); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.data-table tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-active { background: #E7F7EF; color: var(--success); }
.badge-expired { background: #F1EEF9; color: var(--text-muted); }
.badge-deleted { background: #FBEAEA; color: var(--danger); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.search-input { max-width: 260px; margin: 0; }

@media (max-width: 600px) {
    .card { padding: 20px; }
    .toolbar { flex-direction: column; align-items: stretch; }
}
