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

:root {
    --bg: #09090b;
    --surface: #111113;
    --surface-light: #1a1a1f;
    --border: #252529;
    --text: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-dim: #52525b;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --success-bg: rgba(22, 101, 52, 0.2);
    --success-border: rgba(22, 101, 52, 0.4);
    --error: #ef4444;
    --error-bg: rgba(127, 29, 29, 0.2);
    --error-border: rgba(127, 29, 29, 0.4);
    --warn: #f59e0b;
    --warn-bg: rgba(120, 53, 15, 0.2);
    --warn-border: rgba(120, 53, 15, 0.3);
    --blue: #60a5fa;
    --blue-bg: rgba(30, 58, 138, 0.3);
    --purple: #a78bfa;
    --purple-bg: rgba(76, 29, 149, 0.3);
    --cyan: #67e8f9;
    --cyan-bg: rgba(22, 78, 99, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.min-h-screen { min-height: 100vh; }
.max-w-lg { max-width: 512px; }
.max-w-sm { max-width: 384px; }
.max-w-2xl { max-width: 672px; }
.max-w-6xl { max-width: 1152px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.relative { position: relative; }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

/* Spacing */
.p-1 { padding: 4px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-8 { padding: 32px; }
.p-10 { padding: 40px; }
.p-12 { padding: 48px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-0\.5 { padding-top: 2px; padding-bottom: 2px; }
.py-1\.5 { padding-top: 6px; padding-bottom: 6px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-2\.5 { padding-top: 10px; padding-bottom: 10px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.pb-6 { padding-bottom: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-0\.5 { margin-top: 2px; }
.mt-1 { margin-top: 4px; }
.mt-4 { margin-top: 16px; }
.ml-2 { margin-left: 8px; }
.ml-4 { margin-left: 16px; }

/* Typography */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-mono { font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace; }
.tracking-tight { letter-spacing: -0.025em; }

/* Colors */
.text-zinc-100 { color: #f4f4f5; }
.text-zinc-200 { color: #e4e4e7; }
.text-zinc-300 { color: #d4d4d8; }
.text-zinc-400 { color: #a1a1aa; }
.text-zinc-500 { color: #71717a; }
.text-zinc-600 { color: #52525b; }
.text-accent { color: var(--accent); }
.text-emerald-400 { color: var(--success); }
.text-red-400 { color: var(--error); }
.text-amber-400 { color: var(--warn); }
.text-blue-400 { color: var(--blue); }
.text-purple-400 { color: var(--purple); }
.text-cyan-400 { color: var(--cyan); }
.text-white { color: #ffffff; }

/* Backgrounds */
.bg-surface { background: var(--surface); }
.bg-black-20 { background: rgba(0,0,0,0.2); }

/* Components */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="url"], select, textarea {
    background: #18181b;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--text);
    outline: none;
    width: 100%;
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(99, 102, 241, 0.5);
}
input::placeholder, textarea::placeholder {
    color: var(--text-dim);
}
input[readonly] {
    cursor: default;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.25rem;
}
.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger {
    background: #dc2626;
    color: white;
}
.btn-danger:hover { background: #ef4444; }
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-light); }

.badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1rem;
}
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-expired { background: var(--error-bg); color: var(--error); }
.badge-deleted { background: #27272a; color: var(--text-dim); }
.badge-upload { background: var(--blue-bg); color: var(--blue); }
.badge-login { background: var(--purple-bg); color: var(--purple); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-settings { background: var(--cyan-bg); color: var(--cyan); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-default { background: #27272a; color: var(--text-secondary); }

a { color: inherit; text-decoration: none; }
a.link { color: var(--accent); }
a.link:hover { color: var(--accent-hover); }

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background: var(--surface);
    transition: border-color 0.15s;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: rgba(99, 102, 241, 0.5);
}

/* Upload preview */
.preview-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.preview-card img {
    width: 100%;
    max-height: 256px;
    object-fit: contain;
    background: rgba(0,0,0,0.2);
}

/* Progress bar */
.progress-track {
    width: 100%;
    height: 6px;
    background: #27272a;
    border-radius: 9999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 9999px;
    transition: width 0.2s;
}

/* Checkbox */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Result area */
.result-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.input-with-btn {
    display: flex;
}
.input-with-btn input {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: none;
    flex: 1;
}
.input-with-btn button {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.input-with-btn button:hover { background: var(--accent-hover); }

/* Alert boxes */
.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: var(--radius);
    padding: 12px 16px;
}
.alert-warn {
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    border-radius: var(--radius);
    padding: 12px 16px;
}

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { border-bottom: 1px solid var(--border); }
th { padding: 12px 16px; text-align: left; font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
td { padding: 12px 16px; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-light); }

/* Sidebar */
.sidebar {
    width: 224px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.sidebar-link:hover { color: var(--text); background: var(--surface-light); }
.sidebar-link.active { background: rgba(99, 102, 241, 0.1); color: var(--accent); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.15s;
}
.sidebar-footer a:hover { color: var(--text-secondary); }
.sidebar-footer a svg { width: 14px; height: 14px; }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 600; color: #f4f4f5; }

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    width: fit-content;
}
.filter-btn {
    padding: 6px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.filter-btn:hover { color: var(--text); }
.filter-btn.active { background: rgba(99, 102, 241, 0.2); color: var(--accent); }

/* Utility */
.space-y-1 > * + * { margin-top: 4px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.divide-y > * + * { border-top: 1px solid var(--border); }

.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.max-h-64 { max-height: 256px; }
.max-h-96 { max-height: 384px; }
.max-w-200 { max-width: 200px; }

/* Responsive */
@media (min-width: 640px) {
    .sm\:flex-row { flex-direction: row; }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .sm\:w-40 { width: 160px; }
    .sm\:w-48 { width: 192px; }
    .sm\:w-28 { width: 112px; }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .lg\:p-8 { padding: 32px; }
}

/* Image detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 1024px) {
    .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* Metadata grid */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Search bar */
.search-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
@media (min-width: 640px) {
    .search-bar { flex-direction: row; }
}
.search-input-group {
    flex: 1;
    display: flex;
    gap: 8px;
}
.search-input-group input { flex: 1; }
