:root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #1f2937; background: #f4f6f8; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: #f4f6f8; }
button, input { font: inherit; }

.shell { max-width: 1440px; margin: 0 auto; padding: 28px; }
.panel { background: #fff; border: 1px solid #e7eaf0; border-radius: 18px; box-shadow: 0 8px 28px rgba(28, 45, 72, .06); }
.login-panel { width: min(380px, 100%); margin: 12vh auto; padding: 40px 28px; text-align: center; }
#login-qr { max-width: 220px; width: 100%; border-radius: 10px; display: block; margin: 0 auto; }
#qr-login .hint { margin-top: 14px; margin-bottom: 0; }
.brand-mark { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: #07c160; font-size: 30px; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; } h1 { margin-bottom: 10px; } h2 { margin-bottom: 4px; font-size: 20px; } h3 { margin-bottom: 6px; font-size: 18px; }
.muted, .hint { color: #8b95a7; font-size: 14px; } .hint { line-height: 1.6; }
.primary-button, .upload-button { border: 0; border-radius: 10px; padding: 11px 18px; color: #fff; background: #2563eb; cursor: pointer; font-size: 14px; }
.text-button { border: 0; color: #526b99; background: transparent; cursor: pointer; font-size: 14px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; font-size: 20px; }
.topbar .brand { display: flex; align-items: baseline; gap: 12px; }
.topbar .muted { font-size: 14px; }

.layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.spaces-panel, .workspace-panel { padding: 22px; min-height: 720px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; }

.spaces-list { display: flex; flex-direction: column; gap: 10px; }
.space-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid #edf0f4; border-radius: 12px; background: #fff; text-align: left; cursor: pointer; }
.space-item:hover { border-color: #d1d9e4; }
.space-item.active { border-color: #2563eb; background: #eff6ff; }
.space-cover { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #f1f3f5; flex-shrink: 0; }
.space-cover.placeholder { display: grid; place-items: center; color: #8b95a7; font-size: 22px; font-weight: 600; }
.space-body { min-width: 0; }
.space-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-info { display: block; margin-top: 4px; color: #8b95a7; font-size: 13px; }

.empty-state { display: grid; min-height: 560px; place-items: center; color: #9aa4b2; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.workspace-title h2 { margin: 0 0 4px; }
.workspace-title p { margin: 0; }
.workspace-actions { flex-shrink: 0; }
.upload-button { position: relative; overflow: hidden; white-space: nowrap; display: inline-block; }
.upload-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.tabs { display: flex; gap: 8px; border-bottom: 1px solid #edf0f4; margin-bottom: 20px; }
.tab { border: 0; padding: 10px 18px; color: #6b7280; background: transparent; cursor: pointer; border-radius: 8px 8px 0 0; font-size: 15px; font-weight: 500; }
.tab:hover { color: #374151; background: #f3f4f6; }
.tab.active { color: #2563eb; background: #eff6ff; border-bottom: 3px solid #2563eb; margin-bottom: -1px; }

.timeline-list { display: flex; flex-direction: column; gap: 24px; }
.timeline-batch { background: #fff; border: 1px solid #f0f2f5; border-radius: 14px; padding: 16px; }
.batch-header { margin-bottom: 12px; }
.batch-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.batch-author { font-weight: 600; color: #1f2937; }
.batch-time { color: #8b95a7; font-size: 13px; }
.batch-desc { color: #4b5563; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.batch-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.batch-action { border: 1px solid #d1d9e4; border-radius: 6px; padding: 4px 10px; font-size: 13px; color: #4b5563; background: #fff; cursor: pointer; }
.batch-action.danger { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.batch-action:hover { background: #f3f4f6; }

.batch-grid, .asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 900px) {
  .batch-grid, .asset-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1200px) {
  .batch-grid, .asset-grid { grid-template-columns: repeat(5, 1fr); }
}
.grid-cell { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #f1f3f5; cursor: pointer; }
.grid-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid-cell.more { display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: #fff; font-size: 24px; font-weight: 600; }
.grid-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 6px; }
.grid-cell:hover .grid-actions { display: flex; }
.grid-actions button { border: 0; border-radius: 6px; padding: 4px 8px; font-size: 12px; color: #fff; background: rgba(0, 0, 0, .55); cursor: pointer; }
.grid-actions button:hover { background: rgba(0, 0, 0, .75); }

.toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.albums-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 900px) {
  .albums-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  .albums-grid { grid-template-columns: repeat(4, 1fr); }
}
.album-card { border: 1px solid #edf0f4; border-radius: 14px; overflow: hidden; cursor: pointer; background: #fff; transition: box-shadow .15s, transform .15s; }
.album-card:hover { box-shadow: 0 8px 20px rgba(28, 45, 72, .08); transform: translateY(-2px); }
.album-card-cover { aspect-ratio: 1 / 1; background: #f1f3f5; display: grid; place-items: center; color: #8b95a7; font-size: 42px; font-weight: 700; }
.album-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-card-info { padding: 12px; }
.album-card-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card-count { color: #8b95a7; font-size: 13px; }

.detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.detail-header h3 { margin: 0; }

.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .92); display: grid; place-items: center; }
.lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 6px; }
.lightbox-close { position: absolute; top: 18px; right: 24px; border: 0; background: transparent; color: #fff; font-size: 40px; line-height: 1; cursor: pointer; }

.modal-overlay { position: fixed; inset: 0; z-index: 110; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 20px; }
.modal { background: #fff; border-radius: 16px; width: min(420px, 100%); padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal h3 { margin: 0 0 16px; font-size: 18px; }
.modal-body { margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

.grid-action { border: 0; border-radius: 6px; padding: 5px 8px; font-size: 12px; background: rgba(255, 255, 255, .9); color: #2563eb; cursor: pointer; }
.grid-action.danger { color: #dc2626; }
.grid-action:hover { background: #fff; }

.album-card { position: relative; }
.album-actions { position: absolute; top: 8px; right: 8px; display: none; gap: 6px; }
.album-card:hover .album-actions { display: flex; }
.album-action { border: 0; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: #4b5563; font-size: 14px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.album-action.danger { color: #dc2626; }
.album-action:hover { background: #fff; }
.album-card.system .album-card-cover { background: #e5e7eb; color: #6b7280; }

@media (max-width: 760px) {
  .shell { padding: 14px; }
  .layout { grid-template-columns: 1fr; }
  .spaces-panel, .workspace-panel { min-height: auto; }
  .empty-state { min-height: 180px; }
  .topbar { font-size: 18px; }
  .workspace-header { flex-direction: column; align-items: flex-start; }
  .batch-grid, .asset-grid { grid-template-columns: repeat(3, 1fr); }
}
