:root {
    color-scheme: light;
    --bg: #f6f8fb;
    --surface: #ffffff;
    --ink: #172033;
    --muted: #708199;
    --accent: #0f9f86;
    --accent-dark: #087967;
    --border: #e2e8f0;
    --sidebar: #14213d;
    --sidebar-soft: #213255;
    --sidebar-muted: #b7c3d7;
    --shell-bg: #f1f6fa;
    --shadow: 0 18px 42px rgba(20, 33, 61, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px clamp(18px, 4vw, 56px);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 18px;
}

.nav a {
    color: var(--muted);
    font-weight: 650;
    text-decoration: none;
}

.nav a:hover {
    color: var(--accent);
}

.main {
    width: min(960px, calc(100% - 36px));
    margin: 56px auto;
}

.admin-shell-page {
    background: var(--shell-bg);
}

.admin-shell-page .main {
    width: 100%;
    min-height: 100vh;
    margin: 0;
}

.admin-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 28px 18px;
    background: var(--sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 0 26px 8px;
    border-radius: 8px;
    background: #f7c948;
    color: #10251f;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 16px 30px rgba(247, 201, 72, 0.24);
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-footer {
    margin-top: auto;
}

.nav-item {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    min-height: 52px;
    padding: 0 14px;
    border-radius: 8px;
    color: var(--sidebar-muted);
    font-size: 0.98rem;
    font-weight: 750;
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-soft);
    color: #ffffff;
}

.nav-item svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.nav-item .chevron {
    width: 18px;
    height: 18px;
}

.dashboard {
    min-width: 0;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 114px;
    padding: 26px clamp(22px, 3vw, 44px);
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid var(--border);
}

.dashboard-kicker {
    max-width: none;
    margin: 0 0 7px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 850;
    line-height: 1.2;
    text-transform: uppercase;
}

.dashboard-header h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.7rem);
    line-height: 1.05;
}

.dashboard-user {
    max-width: none;
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
}

.header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 850;
    text-decoration: none;
    cursor: pointer;
}

.header-action:hover {
    background: var(--accent-dark);
}

.secondary-action {
    background: var(--sidebar);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-content {
    display: grid;
    gap: 18px;
    padding: 34px clamp(22px, 3vw, 44px);
}

.content-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.collection-panel {
    overflow: hidden;
    padding: 0;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: clamp(22px, 3vw, 34px);
    border-bottom: 1px solid var(--border);
}

.panel-head h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.75rem, 2.5vw, 2.35rem);
    line-height: 1.08;
}

.panel-head p {
    max-width: none;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 750;
    line-height: 1.4;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.panel-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 900;
    text-decoration: none;
}

.panel-action.accent-alt {
    background: #5b5ff0;
}

.panel-action.neutral {
    background: #cbd5e1;
    color: #0f172a;
}

.category-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 22px;
    padding: clamp(22px, 3vw, 34px);
}

.category-tile {
    display: grid;
    overflow: hidden;
    min-height: 260px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.category-tile-body {
    display: grid;
    align-content: start;
    gap: 16px;
    min-height: 220px;
    padding: 28px 26px;
}

.category-tile-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.category-tile h2,
.diy-card h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.35rem;
    line-height: 1.2;
}

.category-tile p {
    max-width: none;
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.45;
}

.type-badge {
    width: fit-content;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 7px;
    background: #f59e0b;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 900;
}

.category-tile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: start;
    padding: 18px 24px 24px;
    border-top: 1px solid var(--border);
    background: #fbfdfc;
}

.category-tile-actions form {
    display: inline-flex;
}

.tile-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    color: #ffffff;
    font: inherit;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.tile-button.upload {
    background: var(--accent);
}

.tile-button.view {
    background: #06b6d4;
}

.tile-button.edit {
    background: #6366f1;
}

.tile-button.delete {
    background: #f43f5e;
}

.items-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 28px clamp(22px, 3vw, 34px) 18px;
}

.items-toolbar p {
    max-width: none;
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 850;
    line-height: 1.35;
}

.search-form {
    display: flex;
    width: min(520px, 100%);
}

.search-form input {
    min-width: 0;
    width: 100%;
    min-height: 50px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 8px 0 0 8px;
    color: var(--ink);
    font: inherit;
    outline: none;
}

.search-form button {
    min-height: 50px;
    padding: 0 22px;
    border: 1px solid var(--border);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: #f8fafc;
    color: var(--muted);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.diy-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 30px 22px;
    padding: 18px clamp(22px, 3vw, 34px) clamp(22px, 3vw, 34px);
}

.diy-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.diy-thumb {
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background: #eef6f2;
}

.diy-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.diy-thumb video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #14b8a6, #6366f1);
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 950;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 4px clamp(22px, 3vw, 34px) clamp(24px, 3vw, 34px);
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    min-height: 42px;
    border-radius: 8px;
    background: #11c5d9;
    color: #07111f;
    font-weight: 900;
    text-decoration: none;
}

.page-link.disabled {
    pointer-events: none;
    background: #e2e8f0;
    color: #94a3b8;
}

.page-status {
    color: var(--muted);
    font-weight: 900;
}

.diy-card-body {
    display: grid;
    gap: 3px;
    padding: 10px 12px 9px;
}

.diy-card h2 {
    overflow: hidden;
    font-size: 0.92rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.diy-id,
.diy-kind {
    max-width: none;
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 850;
    line-height: 1.3;
}

.diy-kind {
    color: #526071;
}

.diy-card-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.diy-card-actions form {
    display: grid;
}

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 0;
    color: #ffffff;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.icon-action.preview {
    background: #06b6d4;
}

.icon-action.edit {
    background: #6366f1;
}

.icon-action.delete {
    background: #f43f5e;
}

.icon-action.muted {
    background: #94a3b8;
}

.empty-card {
    max-width: none;
    margin: clamp(22px, 3vw, 34px);
    padding: 36px 18px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
    font-weight: 850;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 17px 18px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.data-table td {
    color: var(--ink);
    font-weight: 650;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.actions-cell {
    width: 170px;
    text-align: right;
}

.actions-cell form {
    display: inline;
}

.text-action,
.danger-action {
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    font: inherit;
    font-weight: 850;
    text-decoration: none;
    cursor: pointer;
}

.danger-action {
    margin-left: 12px;
    color: #b42318;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: capitalize;
}

.status-pill.active {
    background: rgba(20, 184, 166, 0.14);
    color: #0f766e;
}

.status-pill.inactive {
    background: rgba(113, 128, 154, 0.16);
    color: #526071;
}

.empty-cell {
    color: var(--muted);
    text-align: center;
}

.flash-message {
    max-width: none;
    margin: 0;
    padding: 13px 15px;
    border: 1px solid rgba(20, 184, 166, 0.24);
    border-radius: 8px;
    background: rgba(20, 184, 166, 0.12);
    color: #0f766e;
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.35;
}

.admin-form {
    display: grid;
    gap: 20px;
    max-width: 760px;
    padding: clamp(24px, 4vw, 34px);
}

.form-field select,
.form-field textarea {
    width: 100%;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--ink);
    font: inherit;
    outline: none;
}

.form-field select {
    min-height: 50px;
}

.form-field textarea {
    min-height: 130px;
    padding-top: 13px;
    line-height: 1.5;
    resize: vertical;
}

.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(22, 138, 116, 0.13);
}

.wide-actions {
    width: 270px;
}

.api-key-table .wide-actions {
    width: 330px;
}

.api-key-table .actions-cell {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.api-key-table .actions-cell form {
    display: inline-flex;
}

.api-key-code,
.key-reveal code {
    display: inline-block;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 7px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.86rem;
    font-weight: 850;
    word-break: break-all;
}

.key-reveal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: clamp(18px, 3vw, 26px);
}

.api-key-create form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    align-items: end;
    gap: 16px;
}

.muted-small {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.banner-create form {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
}

.banner-create .form-submit {
    align-self: end;
}

.banner-list {
    display: grid;
}

.banner-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    padding: 18px clamp(22px, 3vw, 34px);
    border-top: 1px solid var(--border);
}

.banner-row:first-child {
    border-top: 0;
}

.banner-preview {
    display: grid;
    place-items: center;
    width: 150px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 900;
}

.banner-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-info {
    min-width: 0;
}

.banner-info h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 1.08rem;
}

.banner-info p {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: none;
    margin: 0 0 8px;
}

.banner-info code {
    display: inline-block;
    max-width: 100%;
    color: var(--muted);
    font-size: 0.82rem;
    word-break: break-all;
}

.banner-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.banner-actions form {
    display: inline-flex;
}

.form-submit {
    width: fit-content;
    min-width: 150px;
    padding: 0 18px;
}

.field-hint,
.file-current {
    max-width: none;
    margin: -8px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.upload-preview,
.thumbnail-preview {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    margin-top: -8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.upload-preview[hidden],
.thumbnail-preview[hidden] {
    display: none;
}

.upload-preview video,
.thumbnail-preview img {
    width: 130px;
    aspect-ratio: 9 / 16;
    border-radius: 7px;
    background: #dbe7ef;
    object-fit: cover;
}

.thumbnail-preview img {
    aspect-ratio: 9 / 16;
}

.preview-title {
    max-width: none;
    margin: 0 0 6px;
    color: var(--ink);
    font-weight: 900;
}

.frame-picker {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.frame-picker[hidden] {
    display: none;
}

.frame-picker input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.mini-action {
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    background: #5b5ff0;
    color: #ffffff;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 900;
    cursor: pointer;
}

.multi-upload-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.multi-upload-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.multi-upload-card video,
.multi-upload-card img {
    width: 96px;
    aspect-ratio: 9 / 16;
    border-radius: 7px;
    background: #dbe7ef;
    object-fit: cover;
}

.multi-upload-card img {
    margin-top: 10px;
}

.multi-upload-body {
    min-width: 0;
}

.multi-upload-body input[type="range"] {
    width: 100%;
    margin: 10px 0;
    accent-color: var(--accent);
}

.inline-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 7px;
    background: #e8f8f4;
    color: #087967;
    font-size: 0.86rem;
    font-weight: 900;
}

.inline-badge.warm {
    background: #fff3d6;
    color: #b45309;
}

.file-current {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f4f8f6;
    font-weight: 750;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(190px, 1fr));
    gap: 22px;
    padding: 34px clamp(22px, 3vw, 44px);
}

.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 146px;
    padding: 28px 30px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat-card p {
    max-width: none;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
}

.stat-card strong {
    color: var(--ink);
    font-size: clamp(2rem, 3vw, 2.55rem);
    line-height: 1;
}

.stat-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    border-radius: 8px;
    color: #ffffff;
}

.stat-icon svg {
    width: 31px;
    height: 31px;
    fill: currentColor;
}

.stat-card.cyan .stat-icon {
    background: #14b8a6;
}

.stat-card.rose .stat-icon {
    background: #ef5da8;
}

.stat-card.indigo .stat-icon {
    background: #536dfe;
}

.stat-card.amber .stat-icon {
    background: #f59e0b;
}

.login-page {
    background:
        radial-gradient(circle at top left, rgba(247, 201, 72, 0.22), transparent 34%),
        linear-gradient(135deg, #eef6f2 0%, #f9fbfa 48%, #e9f2ff 100%);
}

.login-page .main {
    width: 100%;
    min-height: 100vh;
    margin: 0;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 460px);
    align-items: center;
    gap: clamp(30px, 6vw, 90px);
    min-height: 100vh;
    padding: clamp(24px, 6vw, 72px);
}

.login-brand {
    max-width: 560px;
}

.login-logo {
    margin: 0 0 28px;
}

.login-brand h1 {
    margin-bottom: 16px;
    font-size: clamp(2.7rem, 6vw, 5.4rem);
    line-height: 0.98;
}

.login-brand p:not(.dashboard-kicker) {
    max-width: 460px;
    margin: 0;
}

.login-card {
    display: grid;
    gap: 20px;
    width: 100%;
    padding: clamp(28px, 4vw, 42px);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-card h2 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field span {
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 800;
}

.form-field input {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--ink);
    font: inherit;
    outline: none;
}

.form-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(22, 138, 116, 0.13);
}

.form-error {
    max-width: none;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 8px;
    background: #fff1f2;
    color: #b42318;
    font-size: 0.94rem;
    font-weight: 750;
    line-height: 1.35;
}

.login-button {
    min-height: 52px;
    border: 0;
    border-radius: 8px;
    background: var(--sidebar);
    color: #ffffff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.login-button:hover {
    background: var(--accent-dark);
}

.login-hint {
    max-width: none;
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.hero,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: clamp(28px, 6vw, 64px);
    box-shadow: 0 18px 45px rgba(23, 31, 56, 0.08);
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 16px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.05;
}

p {
    max-width: 680px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 14px;
    padding: 0 18px;
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
}

.button:hover {
    background: var(--accent-dark);
}

@media (max-width: 560px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .main {
        margin-top: 28px;
    }
}

@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .category-card-grid {
        grid-template-columns: repeat(2, minmax(240px, 1fr));
    }
}

@media (max-width: 820px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        min-height: auto;
        padding: 16px;
    }

    .sidebar-logo {
        margin-bottom: 14px;
    }

    .sidebar-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sidebar-footer {
        margin-top: 8px;
    }

    .nav-item {
        grid-template-columns: 22px 1fr;
        min-height: 48px;
    }

    .nav-item .chevron {
        display: none;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .items-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .sidebar-nav,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        padding-top: 22px;
    }

    .stat-card {
        min-height: 124px;
    }

    .category-card-grid,
    .diy-card-grid {
        grid-template-columns: 1fr;
    }

    .diy-card {
        max-width: 280px;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form input,
    .search-form button {
        border: 1px solid var(--border);
        border-radius: 8px;
    }

    .upload-preview,
    .thumbnail-preview {
        grid-template-columns: 1fr;
    }

    .api-key-create form,
    .banner-create form,
    .key-reveal {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .banner-row {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .banner-preview {
        width: 100%;
    }

    .frame-picker {
        grid-template-columns: 1fr;
    }

    .upload-preview video,
    .thumbnail-preview img {
        width: 100%;
    }

    .panel-action,
    .tile-button {
        width: 100%;
    }
}
