/* Tonely Panel admin: hand-written, no build step. */
:root {
  --bg: #0d0f14;
  --bg-2: #12151c;
  --surface: #171b24;
  --surface-2: #1e2330;
  --border: #272d3b;
  --text: #e7e9ef;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent-ink: #ffffff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, .10), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; background: rgba(13, 15, 20, .85);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #22d3ee); }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--muted); font-size: 13px; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-flavors { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.flavor-card { position: relative; overflow: hidden; }
.flavor-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--fc, var(--accent)); }
.flavor-card .title { display: flex; align-items: center; gap: 10px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid rgba(255,255,255,.15); }
.stats { display: flex; gap: 18px; margin: 14px 0; }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 12px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:hover { border-color: #3a4256; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { background: transparent; color: #fca5a5; border-color: rgba(239, 68, 68, .4); }
.btn-danger:hover { background: rgba(239, 68, 68, .12); border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; }
.badge-on { color: #86efac; background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .3); }
.badge-off { color: #fca5a5; background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .3); }
.badge-premium { color: #fcd34d; background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .3); }
.badge-featured { color: #c4b5fd; background: rgba(124, 92, 255, .14); border-color: rgba(124, 92, 255, .35); }
.badge-muted { color: var(--muted); background: var(--surface-2); border-color: var(--border); }

/* Flash */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.flash-success { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .35); color: #bbf7d0; }
.flash-error { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .35); color: #fecaca; }

/* Forms */
.form { max-width: 720px; }
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.field .error { color: #fca5a5; font-size: 12.5px; margin-top: 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .2); }
input[readonly] { opacity: .7; }
input.is-invalid, select.is-invalid { border-color: var(--danger); }
input[type=file] { width: 100%; padding: 10px; border: 1px dashed var(--border); border-radius: 9px; background: var(--bg-2); color: var(--muted); }
input[type=color] { width: 48px; height: 38px; padding: 2px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); cursor: pointer; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=text] { max-width: 140px; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }

/* Toolbar (search / filters) */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { max-width: 220px; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 13px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--bg-2); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255, 255, 255, .015); }
td.actions { white-space: nowrap; text-align: right; }
td audio { height: 32px; width: 240px; max-width: 100%; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--muted); background: var(--surface-2); padding: 1px 7px; border-radius: 6px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* Wallpaper grid */
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.wp { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.wp .thumb { aspect-ratio: 9 / 16; background: var(--bg-2); display: block; overflow: hidden; }
.wp .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wp .meta { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.wp .meta .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp .meta .badges { display: flex; gap: 4px; flex-wrap: wrap; }
.wp .meta .acts { display: flex; gap: 6px; margin-top: auto; }

/* Pagination */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.pagination a, .pagination span { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; }
.pagination a:hover { border-color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pagination .disabled { color: var(--muted); opacity: .6; }

/* Bulk upload */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center; background: var(--bg-2); transition: border-color .15s; }
.dropzone.drag { border-color: var(--accent); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 12px 0 6px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.file-list { max-height: 240px; overflow: auto; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.file-list div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.log { margin-top: 10px; font-size: 12.5px; color: #fecaca; }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.auth-card .brand { margin-bottom: 18px; font-size: 18px; }

@media (max-width: 640px) {
  .container { padding: 16px; }
  .topbar { padding: 10px 16px; }
  td audio { width: 160px; }
}
