:root {
    --primary: #d96c4b;
    --secondary: #f2bf5e;
    --accent: #1f9a8a;
    --accent-deep: #0f5c61;
    --ink: #142033;
    --muted: #5f6b7c;
    --soft: #f5efe7;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-strong: #ffffff;
    --line: rgba(20, 32, 51, 0.1);
    --line-strong: rgba(20, 32, 51, 0.18);
    --shadow: 0 24px 60px rgba(18, 29, 44, 0.14);
    --shadow-soft: 0 16px 35px rgba(18, 29, 44, 0.1);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    position: relative;
    color: var(--ink);
    font-family: "Aptos", "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(242, 191, 94, 0.3), transparent 30%),
        radial-gradient(circle at 82% 14%, rgba(31, 154, 138, 0.2), transparent 26%),
        radial-gradient(circle at 50% 100%, rgba(217, 108, 75, 0.16), transparent 40%),
        linear-gradient(160deg, #fffaf4 0%, #f7fbff 45%, #f3f8f4 100%);
    background-attachment: fixed;
}

body::before,
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    filter: blur(12px);
    opacity: 0.85;
}

body::before {
    width: 320px;
    height: 320px;
    left: -110px;
    top: 110px;
    background: radial-gradient(circle, rgba(217, 108, 75, 0.2), transparent 65%);
}

body::after {
    width: 360px;
    height: 360px;
    right: -140px;
    bottom: 30px;
    background: radial-gradient(circle, rgba(31, 154, 138, 0.16), transparent 65%);
}

img {
    max-width: 100%;
}

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

a {
    color: inherit;
}

.page {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 26px 0 54px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 26px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand img,
.brand-badge {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    flex: 0 0 auto;
}

.brand img {
    padding: 7px;
    object-fit: contain;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 252, 0.98));
    border: 1px solid rgba(20, 32, 51, 0.08);
    box-shadow: 0 14px 34px rgba(20, 32, 51, 0.12);
    display: block;
}

.brand-badge {
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 14px 34px rgba(217, 108, 75, 0.25);
}

.title {
    margin: 0;
    font-family: "Aptos Display", "Aptos", "Segoe UI", sans-serif;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.tagline {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-switch {
    display: inline-flex;
    border: 1px solid rgba(20, 32, 51, 0.09);
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.lang-btn {
    display: inline-block;
    padding: 9px 12px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    color: #4a5668;
    border-right: 1px solid rgba(20, 32, 51, 0.08);
}

.lang-btn:last-child {
    border-right: 0;
}

.lang-btn.active {
    color: #072f32;
    background: linear-gradient(135deg, rgba(31, 154, 138, 0.18), rgba(242, 191, 94, 0.18));
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(360px, 0.94fr);
    gap: 24px;
    align-items: start;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 22px;
}

.hero,
.card,
.table-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.85);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88));
    box-shadow: var(--shadow);
}

.hero::before,
.card::before,
.table-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.25));
}

.hero {
    min-height: 100%;
    padding: 34px;
    background:
        radial-gradient(circle at 85% 18%, rgba(31, 154, 138, 0.16), transparent 24%),
        radial-gradient(circle at 8% 0%, rgba(242, 191, 94, 0.2), transparent 28%),
        linear-gradient(145deg, rgba(255, 250, 244, 0.96), rgba(247, 251, 255, 0.9) 52%, rgba(246, 255, 251, 0.92));
}

.hero::after {
    content: "";
    position: absolute;
    right: -88px;
    bottom: -92px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 108, 75, 0.18), transparent 62%);
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: rgba(255, 255, 255, 0.72);
    color: var(--accent-deep);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero h2 {
    margin: 18px 0 0;
    font-family: "Aptos Display", "Aptos", "Segoe UI", sans-serif;
    font-size: clamp(2rem, 4.3vw, 3.25rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
    max-width: 12ch;
}

.hero p {
    margin: 16px 0 0;
    max-width: 60ch;
    color: #344154;
    line-height: 1.72;
    font-size: 1rem;
}

.pill-row,
.hero-stats,
.metric-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: rgba(255, 255, 255, 0.82);
    color: #334155;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 12px 20px rgba(20, 32, 51, 0.05);
}

.hero-stats {
    margin-top: 24px;
}

.hero-stat {
    min-width: 132px;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 12px 24px rgba(20, 32, 51, 0.07);
}

.hero-stat-value {
    display: block;
    font-family: "Aptos Display", "Aptos", "Segoe UI", sans-serif;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.hero-stat-label {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
}

.card,
.table-card {
    padding: 24px;
}

.card h3,
.table-card h3,
.legal-card h4 {
    margin: 0;
    font-family: "Aptos Display", "Aptos", "Segoe UI", sans-serif;
    letter-spacing: -0.03em;
}

.card > p:first-of-type,
.table-card > p:first-of-type {
    margin-top: 10px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-head-copy p,
.section-head .subtle {
    margin: 8px 0 0;
}

.dashboard-hero {
    padding: 28px 30px;
    margin-bottom: 22px;
}

.dashboard-hero h2 {
    max-width: none;
    font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.metric-grid {
    margin-top: 22px;
}

.metric-card {
    min-width: 160px;
    padding: 16px 18px;
    border-radius: 22px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 22px rgba(20, 32, 51, 0.06);
}

.metric-value {
    display: block;
    font-family: "Aptos Display", "Aptos", "Segoe UI", sans-serif;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.metric-label {
    display: block;
    margin-top: 6px;
    font-size: 0.84rem;
    color: var(--muted);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: block;
    margin-bottom: 7px;
    color: #243247;
    font-size: 0.92rem;
    font-weight: 700;
}

input,
select,
textarea,
button {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(20, 32, 51, 0.12);
    background: rgba(255, 255, 255, 0.96);
    padding: 13px 14px;
    color: var(--ink);
    transition: border-color 0.18s ease, box-shadow 0.2s ease, transform 0.18s ease, background 0.18s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: rgba(20, 32, 51, 0.2);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(31, 154, 138, 0.45);
    box-shadow: 0 0 0 4px rgba(31, 154, 138, 0.12);
    background: #fff;
}

input::placeholder,
textarea::placeholder {
    color: #96a0af;
}

input[type="file"] {
    padding: 10px;
    background: linear-gradient(180deg, #ffffff, #f9fbfd);
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    cursor: pointer;
}

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

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -0.01em;
    transition: transform 0.18s ease, box-shadow 0.22s ease, opacity 0.18s ease;
}

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

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #d96c4b, #f08c62);
    box-shadow: 0 18px 32px rgba(217, 108, 75, 0.28);
}

.btn-secondary {
    color: #fff;
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    box-shadow: 0 18px 32px rgba(31, 154, 138, 0.28);
}

.btn-outline {
    color: #243247;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(20, 32, 51, 0.12);
    box-shadow: 0 12px 24px rgba(20, 32, 51, 0.07);
}

.btn[disabled],
button[disabled],
input[disabled] {
    cursor: not-allowed;
    opacity: 0.68;
}

.notice {
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft);
    line-height: 1.55;
}

.notice-success {
    color: #0d5a44;
    background: linear-gradient(135deg, #ecfff7, #f6fffb);
    border-color: #b8efda;
}

.notice-error {
    color: #892f22;
    background: linear-gradient(135deg, #fff1ee, #fff8f6);
    border-color: #ffc7bc;
}

.subtle {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.kpi {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(31, 154, 138, 0.16);
    background: rgba(31, 154, 138, 0.12);
    color: var(--accent-deep);
    font-size: 0.82rem;
    font-weight: 800;
}

.attention-note {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(242, 191, 94, 0.42);
    background: linear-gradient(135deg, rgba(255, 247, 220, 0.98), rgba(255, 241, 235, 0.98));
    color: #8b4a10;
    font-weight: 800;
    box-shadow: 0 14px 26px rgba(242, 191, 94, 0.16);
}

.preview-shell,
.result-media,
.upload-preview-card {
    border-radius: 20px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: linear-gradient(180deg, #ffffff, #f8fbfd);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.preview-shell {
    margin-top: 12px;
    padding: 12px;
}

.table-card {
    padding-bottom: 18px;
}

.history-item {
    padding: 18px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(249, 251, 253, 0.96));
    box-shadow: 0 14px 30px rgba(20, 32, 51, 0.06);
}

.history-item + .history-item {
    margin-top: 16px;
}

.history-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.history-text {
    margin-top: 12px;
    line-height: 1.7;
    color: #2e3a4c;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.media-card {
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: linear-gradient(180deg, #ffffff, #f8fbfd);
}

.media-card img,
.uploaded-image,
.compare-image {
    width: 100%;
    display: block;
    border-radius: 14px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: #f7fafc;
}

.uploaded-image {
    max-height: 240px;
    object-fit: contain;
}

.compare-image {
    height: 220px;
    object-fit: contain;
}

.generated-preview {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 250px;
    margin-top: 8px;
    padding: 18px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    border-radius: 22px;
    background:
        radial-gradient(circle at top, rgba(242, 191, 94, 0.16), transparent 30%),
        linear-gradient(180deg, #f9fcff 0%, #edf6ff 100%);
    overflow: hidden;
}

.generated-preview-image {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    display: block;
}

.generated-preview-logo-badge {
    position: absolute;
    right: 14px;
    bottom: 14px;
    max-width: 28%;
    line-height: 0;
}

.generated-preview-logo {
    display: block;
    max-width: 100%;
    max-height: 48px;
    object-fit: contain;
}

.timestamp-row {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(20, 32, 51, 0.12);
}

.footer-note {
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.65;
}

.legal-links,
.legal-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.legal-links {
    margin-top: 14px;
}

.legal-link,
.legal-footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: rgba(255, 255, 255, 0.86);
    color: #30445d;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
}

.consent-box {
    margin-top: 18px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(20, 32, 51, 0.08);
    background: linear-gradient(180deg, rgba(250, 252, 255, 0.96), rgba(246, 249, 253, 0.98));
}

.consent-box p {
    margin: 0 0 12px;
    color: #3e4d62;
    line-height: 1.65;
}

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 12px;
    color: #243247;
    font-size: 0.93rem;
    line-height: 1.55;
}

.consent-check input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    flex: 0 0 auto;
}

.legal-page {
    display: grid;
    gap: 20px;
}

.legal-hero {
    padding-bottom: 28px;
}

.legal-card {
    padding: 26px;
}

.legal-card h4 {
    margin: 18px 0 10px;
    font-size: 1.02rem;
}

.legal-card p {
    margin: 0 0 14px;
    color: #324155;
    line-height: 1.72;
}

.legal-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.crop-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 16px;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
}

.crop-modal.is-open {
    display: flex;
}

.crop-dialog {
    width: min(92vw, 500px);
    padding: 18px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.35);
}

.crop-dialog h3 {
    margin: 0 0 8px;
}

.crop-canvas-wrap {
    width: min(100%, 390px);
    margin: 14px auto;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(20, 32, 51, 0.12);
    background: #0f172a;
}

#crop-canvas {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: block;
    touch-action: none;
    cursor: grab;
}

#crop-canvas:active {
    cursor: grabbing;
}

.crop-zoom-label {
    margin-top: 12px;
}

.auth-card {
    padding-top: 28px;
}

.auth-card .actions .btn,
.auth-card .actions a,
.logout-link {
    width: auto;
}

.helper-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.helper-pill {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(20, 32, 51, 0.08);
    color: #38506a;
    font-size: 0.86rem;
    font-weight: 700;
}

@media (max-width: 1080px) {
    .layout,
    .section-grid {
        grid-template-columns: 1fr;
    }

    .hero h2,
    .dashboard-hero h2 {
        max-width: none;
    }
}

@media (max-width: 820px) {
    .page {
        width: min(100vw - 20px, 100%);
        padding-top: 14px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
    }

    .topbar-actions {
        justify-content: space-between;
    }

    .hero,
    .card,
    .table-card,
    .legal-card {
        padding: 20px;
        border-radius: 24px;
    }

    .metric-card,
    .hero-stat {
        min-width: calc(50% - 6px);
    }
}

@media (max-width: 620px) {
    body::before,
    body::after {
        display: none;
    }

    .page {
        width: calc(100vw - 16px);
        padding-bottom: 32px;
    }

    .brand img,
    .brand-badge {
        width: 54px;
        height: 54px;
        border-radius: 16px;
    }

    .title {
        font-size: 1.14rem;
    }

    .tagline {
        font-size: 0.86rem;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .lang-switch,
    .logout-link {
        width: auto;
    }

    .grid-2,
    .media-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 22px 18px;
    }

    .hero h2 {
        font-size: clamp(1.7rem, 8vw, 2.2rem);
    }

    .hero p,
    .subtle,
    .legal-card p {
        font-size: 0.92rem;
    }

    .hero-stat,
    .metric-card {
        width: 100%;
        min-width: 100%;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn,
    .actions a,
    .logout-link,
    .auth-card .actions .btn,
    .auth-card .actions a {
        width: 100%;
    }

    .generated-preview {
        min-height: 210px;
        padding: 14px;
    }

    .generated-preview-logo-badge {
        right: 10px;
        bottom: 10px;
        max-width: 34%;
    }

    .compare-image {
        height: 200px;
    }
}