:root {
    --bg: #f5f7fb;
    --bg-alt: #edf2f7;
    --panel: #ffffff;
    --panel-soft: rgba(255, 255, 255, 0.78);
    --text: #172033;
    --muted: #5f6d84;
    --line: #d8e1ed;
    --accent: #0f766e;
    --accent-dark: #0b5b55;
    --accent-soft: #d9f3ef;
    --gold: #d97706;
    --gold-soft: #fff1dd;
    --danger: #c2410c;
    --danger-soft: #ffe3d8;
    --success: #166534;
    --success-soft: #ddfbe5;
    --info: #1d4ed8;
    --info-soft: #dbeafe;
    --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.12);
    --shadow-md: 0 16px 36px rgba(15, 23, 42, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --content-width: 1180px;
    --heading-font: Georgia, "Times New Roman", serif;
    --body-font: "Segoe UI Variable", "Trebuchet MS", Tahoma, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(217, 243, 239, 0.95), transparent 32%),
        radial-gradient(circle at top right, rgba(255, 241, 221, 0.9), transparent 28%),
        linear-gradient(180deg, #fbfcfe 0%, #eff4fa 100%);
    font-family: var(--body-font);
    line-height: 1.6;
}

.body-home {
    background:
        radial-gradient(circle at top center, rgba(217, 243, 239, 0.85), transparent 26%),
        linear-gradient(180deg, #fcfdff 0%, #eef4fb 100%);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.site-shell,
.admin-shell {
    width: min(calc(100% - 32px), var(--content-width));
    margin: 0 auto;
}

.content-stack {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}

.hero,
.panel,
.login-card,
.admin-header,
.admin-tabs,
.page-footer {
    backdrop-filter: blur(18px);
}

.hero,
.panel,
.login-card,
.admin-header,
.admin-tabs {
    background: var(--panel-soft);
    border: 1px solid rgba(216, 225, 237, 0.9);
    box-shadow: var(--shadow-md);
}

.hero {
    margin: 28px 0 24px;
    padding: 26px;
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
}

.public-topbar {
    display: flex;
    justify-content: flex-start;
    padding: 28px 0 8px;
}

.public-hero {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.95fr);
    align-items: end;
}

.hero::after,
.login-card::after {
    content: "";
    position: absolute;
    inset: auto -60px -80px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.17), rgba(217, 119, 6, 0.12));
    filter: blur(8px);
}

.public-hero::after {
    inset: auto -40px -70px auto;
}

.topbar,
.admin-header,
.section-header,
.card-actions,
.form-actions,
.header-actions,
.table-actions,
.search-actions,
.preview-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.brand strong {
    display: block;
    font-size: 1rem;
}

.brand small {
    color: var(--muted);
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #115e59);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.06em;
    box-shadow: 0 14px 28px rgba(15, 118, 110, 0.24);
}

.hero-grid,
.login-card {
    display: grid;
    gap: 22px;
}

.hero-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
    margin-top: 34px;
}

.public-hero-copy {
    position: relative;
    z-index: 1;
}

.public-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    position: relative;
    z-index: 1;
}

.summary-card {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(216, 225, 237, 0.9);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.summary-card strong {
    display: block;
    margin-top: 10px;
    font-size: 1.45rem;
    line-height: 1.2;
    color: var(--accent-dark);
}

.summary-card-wide {
    grid-column: 1 / -1;
}

.hero-copy h1,
.public-hero-copy h1,
.section-header h1,
.section-header h2,
.catalog-heading h2,
.empty-state h3,
.login-copy h1,
.preview-banner h2 {
    margin: 0;
    font-family: var(--heading-font);
    line-height: 1.1;
}

.hero-copy h1,
.public-hero-copy h1,
.login-copy h1 {
    font-size: clamp(2.4rem, 4vw, 4rem);
    max-width: 12ch;
    margin: 12px 0 16px;
}

.public-hero-copy h1 {
    max-width: 13ch;
}

.hero-copy p,
.public-hero-copy p,
.login-copy p {
    max-width: 60ch;
    color: var(--muted);
    font-size: 1.02rem;
}

.hero-card,
.metric-card,
.app-card,
.login-form-panel,
.preview-banner {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(216, 225, 237, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.hero-card,
.login-form-panel {
    padding: 24px;
}

.hero-card h2,
.metric-card strong,
.app-card h3,
.login-form-panel h2 {
    margin: 0;
}

.info-list {
    margin: 18px 0 0;
    padding-left: 18px;
    color: var(--muted);
}

.eyebrow,
.section-label,
.metric-label,
.meta-label {
    display: inline-block;
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
}

.eyebrow,
.section-label {
    color: var(--accent);
}

.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.stat-pill,
.results-chip,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
}

.stat-pill,
.results-chip {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(216, 225, 237, 0.9);
    color: var(--text);
}

.badge {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 700;
}

.panel {
    padding: 24px;
    border-radius: var(--radius-xl);
}

.catalog-panel {
    padding-top: 22px;
}

.section-header {
    margin-bottom: 22px;
}

.catalog-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.section-header.compact {
    margin-bottom: 18px;
}

.section-header h1,
.section-header h2,
.catalog-heading h2 {
    margin-top: 8px;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.search-panel,
.form-grid,
.metric-grid,
.app-grid {
    display: grid;
    gap: 18px;
}

.search-panel {
    grid-template-columns: minmax(0, 1.7fr) minmax(190px, 0.7fr) auto;
    align-items: end;
}

.public-search-panel {
    gap: 16px;
}

.search-panel-admin {
    grid-template-columns: minmax(0, 1fr) auto;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.public-app-grid {
    gap: 20px;
}

.input-group {
    display: grid;
    gap: 8px;
}

.input-grow {
    min-width: 0;
}

.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 700;
    font-size: 0.95rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

textarea {
    resize: vertical;
    min-height: 150px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 5px rgba(15, 118, 110, 0.12);
    transform: translateY(-1px);
}

.btn,
.text-button {
    border: 0;
    border-radius: 14px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 14px 24px rgba(15, 118, 110, 0.2);
}

.btn:hover,
.text-button:hover {
    transform: translateY(-1px);
}

.btn:active,
.text-button:active {
    transform: translateY(0);
}

.btn-secondary,
.btn-outline {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: none;
}

.btn-small {
    padding: 10px 14px;
    font-size: 0.92rem;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    font-weight: 600;
}

.alert-success {
    background: var(--success-soft);
    border-color: rgba(22, 101, 52, 0.18);
    color: var(--success);
}

.alert-error {
    background: var(--danger-soft);
    border-color: rgba(194, 65, 12, 0.18);
    color: var(--danger);
}

.alert-info {
    background: var(--info-soft);
    border-color: rgba(29, 78, 216, 0.18);
    color: var(--info);
}

.metric-card {
    padding: 22px;
}

.metric-card strong {
    display: block;
    margin: 12px 0 10px;
    font-size: 2rem;
    color: var(--accent-dark);
}

.metric-card p,
.small-text,
.file-note,
.version-label,
.app-description,
.page-footer p,
.admin-user {
    color: var(--muted);
}

.app-card {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.public-app-card {
    gap: 16px;
    padding: 20px;
}

.app-card-top,
.card-title-row,
.table-app {
    display: flex;
    align-items: center;
    gap: 16px;
}

.card-title-row {
    justify-content: space-between;
    align-items: flex-start;
}

.app-title-block {
    min-width: 0;
    flex: 1;
}

.app-icon,
.preview-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    object-fit: cover;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(217, 119, 6, 0.16));
    padding: 6px;
}

.app-card h3 {
    font-size: 1.28rem;
    margin-bottom: 4px;
}

.version-label {
    margin: 0;
    font-weight: 700;
}

.app-description {
    margin: 0;
    min-height: 78px;
}

.app-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.app-stats span {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(240, 245, 251, 0.95);
    border: 1px solid rgba(216, 225, 237, 0.9);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(247, 250, 252, 0.95), rgba(240, 245, 251, 0.95));
    border: 1px solid rgba(216, 225, 237, 0.9);
}

.meta-grid strong {
    display: block;
    margin-top: 4px;
}

.file-note {
    font-size: 0.9rem;
    word-break: break-word;
}

.empty-state {
    padding: 44px 28px;
    text-align: center;
    background: rgba(255, 255, 255, 0.78);
    border: 1px dashed rgba(15, 118, 110, 0.3);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.empty-state.compact {
    padding: 28px;
}

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

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

.data-table th,
.data-table td {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(216, 225, 237, 0.9);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.table-thumb {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    object-fit: cover;
    background: var(--bg-alt);
    padding: 4px;
}

.table-app small {
    display: block;
    color: var(--muted);
}

.text-link,
.text-button {
    font-weight: 700;
    color: var(--accent-dark);
    background: transparent;
    padding: 0;
}

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

.table-actions {
    justify-content: flex-start;
    gap: 18px;
}

.stack-form {
    display: grid;
    gap: 22px;
}

.form-actions {
    justify-content: flex-start;
}

.preview-banner {
    padding: 18px;
    margin-bottom: 22px;
    justify-content: flex-start;
}

.preview-banner p {
    margin: 4px 0 0;
    color: var(--muted);
}

.admin-shell {
    padding-top: 24px;
}

.admin-header,
.admin-tabs {
    border-radius: var(--radius-lg);
}

.admin-header {
    padding: 18px 22px;
    margin-bottom: 16px;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    margin-bottom: 22px;
}

.admin-tabs a {
    padding: 12px 16px;
    border-radius: 14px;
    color: var(--muted);
    font-weight: 700;
}

.admin-tabs a.active,
.admin-tabs a:hover {
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent-dark);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    position: relative;
    width: min(1080px, 100%);
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    padding: 26px;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.login-copy,
.login-form-panel {
    position: relative;
    z-index: 1;
}

.page-footer {
    margin: 0 0 28px;
    padding: 18px 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(216, 225, 237, 0.9);
}

.public-footer {
    margin-top: 4px;
}

@media (max-width: 1080px) {
    .hero-grid,
    .public-hero,
    .metric-grid,
    .app-grid,
    .login-card {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 840px) {
    .site-shell,
    .admin-shell {
        width: min(calc(100% - 20px), var(--content-width));
    }

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

    .topbar,
    .catalog-heading,
    .admin-header,
    .section-header,
    .header-actions,
    .preview-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-grid,
    .public-hero,
    .public-summary,
    .login-card,
    .form-grid,
    .search-panel,
    .search-panel-admin,
    .app-grid,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .app-description {
        min-height: auto;
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    .public-topbar {
        padding-top: 20px;
    }
}

@media (max-width: 560px) {
    .brand {
        align-items: flex-start;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .hero-copy h1,
    .public-hero-copy h1,
    .login-copy h1 {
        font-size: 2rem;
    }

    .card-title-row,
    .card-actions,
    .form-actions,
    .table-actions,
    .hero-pills,
    .search-actions,
    .app-stats {
        flex-direction: column;
        align-items: stretch;
    }

    .app-card-top,
    .table-app {
        align-items: flex-start;
    }

    .btn,
    .btn-secondary,
    .btn-outline {
        width: 100%;
    }

    .btn-block-mobile {
        width: 100%;
    }
}
