:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --border: #dfe5ef;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-weak: #dbeafe;
    --success: #166534;
    --success-bg: #dcfce7;
    --error: #991b1b;
    --error-bg: #fee2e2;
    --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
video { max-width: 100%; width: 100%; border-radius: 10px; }
.app-shell { display: flex; min-height: 100vh; align-items: flex-start; }
.sidebar {
    width: 220px; background: #111827; color: #fff; padding: 10px 10px 14px;
    display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch;
    position: sticky; top: 0; left: 0; min-height: 100vh;
}
.sidebar .brand { font-size: 20px; font-weight: 700; margin: 0 0 10px; padding-left: 2px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.sidebar nav a {
    color: #e5e7eb; padding: 9px 10px; border-radius: 10px; background: rgba(255,255,255,.04);
    text-align: left;
}
.sidebar nav a:hover { background: rgba(255,255,255,.1); }
.sidebar-user { margin-top: 14px; font-size: 13px; color: #cbd5e1; padding: 8px 4px 0; }
.main-content { flex: 1; padding: 16px 24px 24px; }
.main-content.full-width { display: flex; align-items: center; justify-content: center; }
.center-card-wrap { width: 100%; max-width: 420px; }
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: 18px;
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.auth-card h1 { margin: 0 0 8px; }
.page-header {
    display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 20px;
}
.page-header h1 { margin: 0 0 6px; font-size: 28px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.alert {
    padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px;
}
.alert.success { background: var(--success-bg); color: var(--success); }
.alert.error { background: var(--error-bg); color: var(--error); }
.upload-hint {
    margin-bottom: 16px; padding: 12px 14px; border-radius: 12px;
    background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; line-height: 1.65; font-size: 14px;
}
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: var(--text); padding: 10px 14px;
    border-radius: 12px; font-weight: 600;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.header-actions, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stats-grid {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px;
}
.stat-card {
    background: linear-gradient(180deg, #fff, #f8fbff); border: 1px solid var(--border);
    border-radius: 18px; padding: 18px; box-shadow: var(--shadow);
}
.stat-card span { display: block; color: var(--muted); margin-bottom: 8px; }
.stat-card strong { font-size: 32px; }
.stack-form { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: 14px; }
input, select, textarea {
    width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
    font-size: 14px; background: #fff;
}
textarea { resize: vertical; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filters-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end;
}
.filter-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 700; }
.badge {
    display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px;
    background: var(--primary-weak); color: var(--primary); font-size: 12px; font-weight: 700;
}
.detail-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; margin-bottom: 20px; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.meta-grid strong { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.notes-box {
    margin-top: 18px; background: #f8fafc; border-radius: 12px; padding: 14px; border: 1px dashed var(--border);
}
.media-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
}
.media-card {
    border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: #fff;
}
.media-card img { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; }
.media-card-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.timeline { position: relative; margin-left: 8px; }
.timeline::before {
    content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-left: 34px; margin-bottom: 18px; }
.timeline-dot {
    position: absolute; left: 0; top: 8px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--primary); border: 4px solid #fff; box-shadow: 0 0 0 1px var(--border);
}
.timeline-content {
    background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow);
}
.timeline-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.timeline-notes { margin-top: 10px; line-height: 1.65; }
.timeline-media-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px;
}
.timeline-media-grid img { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; }
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
    .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .app-shell { display: block; }
    .sidebar { width: 100%; min-height: auto; position: static; border-radius: 0 0 18px 18px; padding: 10px 12px 14px; }
    .main-content { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .form-grid.two, .meta-grid, .filters-grid, .timeline-media-grid, .media-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .media-card img { height: auto; }
    .timeline-top { flex-direction: column; }
}
@media (max-width: 520px) {
    .stats-grid { grid-template-columns: 1fr; }
    .card { padding: 16px; border-radius: 16px; }
    .page-header h1 { font-size: 24px; }
}
