:root {
    --color-surface: #0f172a;
    --color-surface-alt: #111c34;
    --color-border: #94a3b8;
    --color-text: #e2e8f0;
    --color-muted: #94a3b8;
    --color-accent: #38bdf8;
    --color-danger: #f87171;
    --color-ghost: #1e293b;
    --shadow-sm: 0 4px 10px #0f172a;
    --radius-md: 14px;
    --radius-sm: 8px;
    --gap-xs: 0.5rem;
    --gap-sm: 0.75rem;
    --gap-md: 1rem;
    --gap-lg: 1.5rem;
    --sidebar-width: 340px;
    --font-base: system-ui, sans-serif;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-muted);
    border-radius: var(--radius-sm);
}

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

body {
    min-height: 100vh;
    font-family: var(--font-base);
    color: var(--color-text);
    background: #0f172a;
    display: flex;
    overflow-x: hidden;
}

.app-shell {
    width: 100%;
    min-height: 100vh;
}

.app-shell[data-sidebar='expanded'] {
    padding-left: var(--sidebar-width);
}

.app-shell[data-sidebar='collapsed'] {
    padding-left: none;
}

.app-shell[data-sidebar='collapsed'] .sidebar {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    top: var(--gap-sm);
    margin-left: var(--gap-sm);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: var(--gap-lg);
    padding: var(--gap-lg);
    background: #111c34;
    border-right: 1px solid var(--color-border);
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar__header,
.sidebar__footer {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}

.sidebar__title {
    font-size: 1.4rem;
    font-weight: 600;
}

.sidebar__subtitle,
.sidebar__notice,
.sidebar__status {
    color: var(--color-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.sidebar__notice a {
    color: var(--color-accent);
    text-decoration: none;
}

.sidebar__notice a:hover {
    text-decoration: underline;
}

.sidebar__footer {
    height: 100%;
}

.sidebar__log {
    height: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--gap-xs);
    overflow-y: auto;
}

.gallery {
    display: flex;
    flex-direction: column;
    /* place-content: center; */
    /* place-items: center; */
    gap: var(--gap-lg);
    background: #0f172a;
    height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.gallery__grid {
    display: flex;
    gap: var(--gap-lg);
    padding: var(--gap-lg);
    height: 100%;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
}

.gallery__placeholder {
    padding: var(--gap-lg);
    border-radius: var(--radius-md);
    background: #1e293b;
    color: var(--color-muted);
    text-align: center;
    margin: auto;
}

.card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    min-width: 120px;
    width: 240px;
    resize: horizontal;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 0 0 auto;
    /* padding-bottom: 48px; */
}

.card__meta {
    display: flex;
    justify-content: space-between;
    padding: var(--gap-sm);
    color: var(--color-muted);
    font-size: 0.85rem;
}

.card__title {
    font-size: 1rem;
    color: var(--color-text);
    font-weight: 600;
}

.card__badge {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #38bdf8;
    color: #0f172a;
    font-weight: 600;
    text-transform: capitalize;
}

.card__media {
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #1e293b;
    margin-bottom: 2rem;
}

.card__actions {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    place-content: center;
    height: 100%;
    gap: var(--gap-sm);
    padding: var(--gap-sm);
    border-top: 1px solid var(--color-border);
    background: #111c34;
}

.stack {
    display: flex;
    flex-direction: column;
}

.stack--md {
    gap: var(--gap-md);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field__label {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--gap-sm);
}

.segmented {
    display: inline-flex;
    align-items: center;
    background: #111c34;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.25rem;
    gap: 0.35rem;
}

.segmented__option {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.segmented__option span {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
}

.segmented__option input {
    appearance: none;
    position: absolute;
    inset: 0;
    margin: 0;
    pointer-events: none;
}

.segmented__option input:checked+span {
    background: var(--color-accent);
    color: #0f172a;
}

input[type="url"],
input[type="text"] {
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: #111c34;
    color: var(--color-text);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: #111c34;
    color: var(--color-text);
    font-weight: 600;
    cursor: pointer;
}

.button--primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #0f172a;
}

.button--danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #0b1120;
}

.button--ghost {
    background: var(--color-ghost);
}

.gallery a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.gallery a:hover {
    text-decoration: underline;
}