:root {
    --bg: #efe8dc;
    --paper: rgba(255, 252, 246, 0.88);
    --paper-strong: #fffdf9;
    --ink: #1f2730;
    --muted: #67707c;
    --line: #ddd4c6;
    --accent: #ca6331;
    --accent-soft: #f4ddcf;
    --accent-dark: #a34f28;
    --success: #1d7a4a;
    --warning: #9b6400;
    --error: #aa3d3d;
    --info: #335f92;
    --topbar: #1f2836;
    --topbar-soft: #283244;
    --shadow: 0 24px 60px rgba(38, 28, 18, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "IBM Plex Sans", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(202, 99, 49, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(51, 95, 146, 0.12), transparent 24%),
        linear-gradient(180deg, #f7f3eb 0%, #eee6d9 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 28px;
    background: linear-gradient(180deg, rgba(31, 40, 54, 0.97), rgba(40, 50, 68, 0.96));
    color: #f6efe5;
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 28px rgba(20, 25, 35, 0.18);
}

.topbar-brand,
.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #d86d3a, #f4c8ae);
    color: #1f2836;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    flex: none;
}

.topbar h1,
.panel-head h2,
.list-head h3,
.section-title,
.result-title,
.request-title,
.history-card h3 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.03em;
}

.topbar h1 {
    font-size: 1.6rem;
}

.topbar p {
    margin: 4px 0 0;
    color: rgba(246, 239, 229, 0.72);
    font-size: 0.95rem;
}

.topbar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    flex: 1;
}

.nav-item,
.ghost-button,
.primary-button,
.secondary-button,
.preview-button {
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}

.nav-item {
    padding: 11px 16px;
    background: rgba(255, 255, 255, 0.07);
    color: #f6efe5;
}

.nav-item.is-active {
    background: linear-gradient(135deg, rgba(216, 110, 58, 0.95), rgba(247, 198, 168, 0.92));
    color: #1f2836;
    box-shadow: 0 12px 24px rgba(216, 110, 58, 0.2);
}

.user-card {
    padding: 10px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
}

.user-role {
    display: inline-block;
    margin-bottom: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.main-content {
    padding: 24px 28px 36px;
}

.flash {
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.flash.hidden,
.hidden {
    display: none !important;
}

.flash.success,
.status-banner.success,
.badge.success {
    background: rgba(29, 122, 74, 0.12);
    color: var(--success);
}

.flash.warning,
.status-banner.warning,
.badge.warning {
    background: rgba(155, 100, 0, 0.12);
    color: var(--warning);
}

.flash.error,
.badge.danger {
    background: rgba(170, 61, 61, 0.12);
    color: var(--error);
}

.flash.info,
.status-banner.info,
.badge.info {
    background: rgba(51, 95, 146, 0.12);
    color: var(--info);
}

.view {
    display: none;
}

.view.is-active {
    display: block;
}

.panel,
.login-panel {
    background: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 30px;
    padding: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.login-panel {
    max-width: 540px;
    margin: 8vh auto 0;
}

.lists-workspace,
.list-detail-stack {
    display: grid;
    gap: 20px;
}

.list-strip-panel {
    overflow: hidden;
}

.list-filters {
    margin: 0 0 14px;
}

.filter-toggle-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.list-filter-button {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(31, 39, 48, 0.06);
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.list-filter-button:hover {
    transform: translateY(-1px);
}

.list-filter-button.is-active {
    background: linear-gradient(135deg, rgba(216, 110, 58, 0.95), rgba(247, 198, 168, 0.92));
    color: #1f2836;
}

.panel-head {
    margin-bottom: 22px;
}

.panel-head h2 {
    margin: 8px 0 6px;
    font-size: 2rem;
}

.compact-head h2 {
    font-size: 1.6rem;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    color: var(--accent);
    font-weight: 700;
}

.stack-form,
.search-form {
    display: grid;
    gap: 12px;
}

.search-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

input,
select,
textarea {
    width: 100%;
    padding: 13px 15px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--paper-strong);
    color: var(--ink);
}

label span {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.primary-button {
    padding: 13px 18px;
    background: linear-gradient(135deg, var(--accent), #df8760);
    color: #fff;
    box-shadow: 0 14px 24px rgba(202, 99, 49, 0.2);
}

.secondary-button {
    padding: 10px 14px;
    background: rgba(202, 99, 49, 0.11);
    color: var(--accent-dark);
}

.request-change {
    font-size: 0.8rem;
    padding: 9px 12px;
}

.ghost-button {
    padding: 11px 15px;
    background: rgba(31, 39, 48, 0.06);
    color: var(--ink);
}

.preview-button {
    padding: 8px 10px;
    background: rgba(31, 39, 48, 0.08);
    color: var(--ink);
    font-size: 0.8rem;
}

.danger-text {
    color: var(--error);
}

.nav-item:hover,
.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.preview-button:hover {
    transform: translateY(-1px);
}

.list-stack,
.request-list,
.quarantine-list,
.history-pending-list {
    display: grid;
    gap: 14px;
}

.list-strip-panel .list-stack {
    grid-auto-flow: column;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    align-items: stretch;
    scroll-snap-type: x proximity;
}

.list-strip-panel .list-stack.empty-state {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow: visible;
    padding-bottom: 0;
}

.list-card,
.history-card,
.request-card {
    padding: 16px;
    border-radius: 22px;
    border: 1px solid rgba(221, 212, 198, 0.9);
    background: var(--paper-strong);
}

.list-card {
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
    scroll-snap-align: start;
}

.list-card--movie {
    background: linear-gradient(180deg, rgba(252, 241, 232, 0.98), rgba(255, 251, 245, 0.98));
    border-color: rgba(229, 198, 176, 0.95);
}

.list-card--tv {
    background: linear-gradient(180deg, rgba(236, 243, 249, 0.98), rgba(250, 252, 255, 0.98));
    border-color: rgba(188, 209, 226, 0.95);
}

.list-card:hover {
    transform: none;
}

.list-card.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(202, 99, 49, 0.16);
}

.list-head,
.request-head,
.section-head,
.request-actions,
.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.list-head h3 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-row--list-card {
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.meta-row--list-card .badge,
.meta-row--list-card .pill {
    white-space: nowrap;
}

.list-strip-panel .list-card .tiny {
    display: none;
}

.list-meta,
.muted,
.meta-line,
.overview,
.tiny,
.lightbox-caption {
    color: var(--muted);
}

.badge,
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    background: rgba(31, 39, 48, 0.07);
}

.badge.type-movie {
    background: rgba(202, 99, 49, 0.12);
    color: var(--accent-dark);
}

.badge.type-tv {
    background: rgba(51, 95, 146, 0.12);
    color: var(--info);
}

.badge.pending {
    background: rgba(155, 100, 0, 0.12);
    color: var(--warning);
}

.status-banner {
    margin: 0 0 18px;
    padding: 13px 15px;
    border-radius: 16px;
}

.list-detail-grid {
    display: grid;
    gap: 22px;
}

.list-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.poster-frame,
.media-tile-poster,
.result-poster,
.item-poster,
.lightbox-media {
    overflow: hidden;
    border-radius: 18px;
    background: #ddd4c6;
}

.poster-frame,
.media-tile-poster,
.item-poster,
.result-poster {
    aspect-ratio: 2 / 3;
    display: block;
    width: 100%;
    padding: 0;
    cursor: zoom-in;
}

.poster-frame img,
.media-tile-poster img,
.result-poster img,
.item-poster img,
.lightbox-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    display: grid;
    gap: 8px;
}

.hero-content h2,
.hero-content .overview {
    margin: 0;
}

.hero-pills,
.toolbar-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-block {
    display: grid;
    gap: 14px;
}

.detail-tabs-widget.ui-tabs {
    padding: 0;
    border: 0;
    background: transparent;
}

.detail-tabs-widget .ui-tabs-nav {
    display: inline-flex;
    gap: 10px;
    margin: 0 0 16px;
    padding: 8px;
    border: 0;
    border-radius: 20px;
    background: rgba(31, 39, 48, 0.06);
}

.detail-tabs-widget .ui-tabs-nav li {
    margin: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    white-space: nowrap;
}

.detail-tabs-widget .ui-tabs-nav li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    color: var(--muted);
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tab-add-icon {
    color: #2f9a46;
    font-size: 1.05em;
    font-weight: 800;
    line-height: 1;
}

.detail-tabs-widget .ui-tabs-nav li.ui-state-hover a {
    color: var(--ink);
}

.detail-tabs-widget .ui-tabs-nav li.ui-tabs-active {
    background: linear-gradient(135deg, rgba(216, 110, 58, 0.95), rgba(247, 198, 168, 0.92));
    box-shadow: 0 12px 24px rgba(216, 110, 58, 0.18);
}

.detail-tabs-widget .ui-tabs-nav li.ui-tabs-active a {
    color: #1f2836;
}

.detail-tabs-widget .ui-tabs-panel {
    padding: 0;
}

.detail-panel {
    display: grid;
    gap: 14px;
}

.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(31, 39, 48, 0.05);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-label {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.icon-button-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.icon-button {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    color: #44505c;
    box-shadow: inset 0 0 0 1px rgba(31, 39, 48, 0.08);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.icon-button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.icon-button-direction {
    display: inline-flex;
    margin-left: 1px;
}

.icon-button-direction svg {
    width: 10px;
    height: 10px;
}

.icon-button:hover {
    transform: translateY(-1px);
}

.icon-button.is-active {
    background: linear-gradient(135deg, rgba(216, 110, 58, 0.96), rgba(247, 198, 168, 0.94));
    color: #1f2836;
    box-shadow: 0 10px 22px rgba(216, 110, 58, 0.2);
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.search-results {
    display: block;
    margin-top: 10px;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.item-grid--mosaic {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.media-tile,
.result-card,
.item-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    gap: 10px;
    padding: 12px;
    border-radius: 22px;
    background: var(--paper-strong);
    border: 1px solid rgba(221, 212, 198, 0.9);
    box-shadow: 0 12px 28px rgba(33, 27, 23, 0.05);
    min-width: 0;
}

.media-tile-body,
.result-meta,
.item-meta {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.media-tile-body {
    grid-template-rows: minmax(1.9rem, auto) auto;
    align-content: start;
    align-items: start;
}

.media-tile-title,
.result-title,
.item-title {
    font-size: 0.98rem;
    line-height: 1.12;
}

.media-tile,
.result-card,
.item-card {
    padding: 0 0 10px;
    gap: 8px;
}

.media-tile-visual {
    position: relative;
    overflow: hidden;
    border-radius: 22px 22px 0 0;
}

.item-card .request-change,
.result-card .request-change {
    font-size: 0.8rem;
}

.media-tile .request-change {
    width: 100%;
    justify-content: center;
}

.media-tile-poster {
    border-radius: 0;
}

.item-grid--mosaic .media-tile-poster,
.search-results .media-tile-poster,
.item-grid--mosaic .item-poster,
.search-results .result-poster {
    border-radius: 0;
}

.media-tile-badge,
.item-grid--mosaic .card-footer--overlay,
.search-results .card-footer--overlay {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    background: rgba(255, 252, 246, 0.9);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(164, 144, 124, 0.38);
    line-height: 1;
    border-radius: 999px;
    box-sizing: border-box;
}

.media-tile-badge-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    white-space: nowrap;
    line-height: 1;
}

.media-tile-body,
.item-grid--mosaic .item-meta,
.search-results .result-meta {
    padding: 0 10px;
}

.media-tile-title,
.item-grid--mosaic .item-title,
.search-results .result-title {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.2;
    min-height: 1.9rem;
    align-self: start;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.media-tile-badge-line,
.item-grid--mosaic .card-footer,
.search-results .card-footer {
    display: flex;
    justify-content: center;
}

.media-tile-badge-line,
.item-grid--mosaic .footer-line,
.search-results .footer-line {
    text-align: center;
}

.card-footer {
    padding: 7px 9px;
    border-radius: 10px;
    background: rgba(31, 39, 48, 0.05);
}

.footer-line {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.72rem;
    line-height: 1.15;
    color: #54606d;
}

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

.item-table-wrap {
    border-radius: 22px;
    background: var(--paper-strong);
    border: 1px solid rgba(221, 212, 198, 0.9);
    box-shadow: 0 12px 28px rgba(33, 27, 23, 0.05);
}

.item-table {
    table-layout: fixed;
}

.item-table col.col-poster {
    width: 84px;
}

.item-table col.col-year {
    width: 92px;
}

.item-table col.col-rating {
    width: 72px;
}

.item-table col.col-votes {
    width: 86px;
}

.item-table col.col-action {
    width: 190px;
}

.item-table th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    background: rgba(31, 39, 48, 0.03);
}

.item-table td {
    font-size: 0.94rem;
}

.item-table th.col-head-year,
.item-table th.col-head-rating,
.item-table th.col-head-votes,
.item-table th.col-head-action,
.item-table td.item-table-year-cell,
.item-table td.item-table-rating-cell,
.item-table td.item-table-votes-cell,
.item-table td.item-table-action-cell {
    text-align: center;
}

.item-table th.col-head-media,
.item-table td.item-table-title-cell {
    text-align: left;
}

.item-table-poster-cell {
    width: 84px;
}

.item-table-poster {
    width: 58px;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 12px;
    background: #ddd4c6;
}

.item-table-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item-table-title-cell {
    width: auto;
}

.item-table-action-cell {
    white-space: nowrap;
}

.table-title-button {
    display: inline-flex;
    padding: 0;
    background: transparent;
    color: var(--ink);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.table-title-text {
    display: inline-flex;
    color: var(--ink);
    font-weight: 600;
}

.title-hover-cell {
    position: relative;
    display: block;
}

.rating-chip {
    cursor: default;
}

.title-hover-popover {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    width: 130px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255, 252, 246, 0.98);
    border: 1px solid rgba(221, 212, 198, 0.92);
    box-shadow: 0 18px 30px rgba(20, 25, 35, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
    z-index: 4;
}

.title-hover-popover img {
    display: block;
    width: 100%;
    border-radius: 12px;
}

.title-hover-cell:hover .title-hover-popover,
.title-hover-cell:focus-within .title-hover-popover {
    opacity: 1;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(221, 212, 198, 0.86);
    text-align: left;
    vertical-align: top;
}

.table-wrap {
    overflow-x: auto;
}

.empty-state,
.loader-card {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 120px;
    color: var(--muted);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 21, 31, 0.78);
    backdrop-filter: blur(6px);
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 980px);
    margin: 5vh auto 0;
    padding: 18px;
    border-radius: 26px;
    background: rgba(255, 252, 246, 0.98);
    box-shadow: 0 24px 70px rgba(16, 21, 31, 0.32);
}

.lightbox-close {
    display: inline-flex;
    margin-left: auto;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(31, 39, 48, 0.08);
    cursor: pointer;
}

.lightbox-media {
    margin-top: 14px;
    max-height: 72vh;
}

.lightbox-media img {
    object-fit: contain;
    max-height: 72vh;
}

.lightbox-caption {
    margin-top: 12px;
    font-size: 0.92rem;
}

.no-image {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--muted);
    background: linear-gradient(135deg, rgba(221, 212, 198, 0.9), rgba(246, 240, 230, 0.92));
}

code {
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 980px) {
    .topbar {
        position: static;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-nav,
    .topbar-user {
        justify-content: space-between;
    }

    .list-hero {
        grid-template-columns: 1fr;
    }

    .search-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .main-content {
        padding: 16px;
    }

    .panel,
    .login-panel {
        padding: 18px;
    }

    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    }

    .item-grid--mosaic {
        grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    }

    .list-strip-panel .list-stack {
        grid-auto-columns: minmax(320px, 88vw);
    }

    .detail-tabs-widget .ui-tabs-nav {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-tabs-widget .ui-tabs-nav li a {
        width: 100%;
    }

    .content-toolbar {
        align-items: stretch;
    }

    .toolbar-group {
        width: 100%;
        justify-content: space-between;
    }

    .filter-toggle-row {
        width: 100%;
    }

    .title-hover-popover {
        left: 0;
        top: calc(100% + 8px);
        transform: none;
    }
}
