:root {
    --bg: #eef3f9;
    --panel: #ffffff;
    --text: #142136;
    --muted: #5b6b83;
    --primary: #1e64f0;
    --primary-dark: #124cc0;
    --edit: #ff9b2f;
    --danger: #e04545;
    --ok: #188f4e;
    --avg: #1f6edb;
    --high: #d43a3a;
    --border: #d8e1ef;
    --shadow: 0 12px 30px rgba(24, 47, 86, 0.12);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
    color: var(--text);
    background: linear-gradient(160deg, #f6f9ff 0%, #e8f0ff 45%, #f5f7fb 100%);
}

.site-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

body.modal-blur-active .site-shell {
    filter: blur(7px);
    transition: filter 0.2s ease;
}

.site-header {
    width: 100%;
    background: #0f4bcc;
    color: #fff;
    box-shadow: 0 8px 18px rgba(15, 75, 204, 0.35);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    font-size: 1.1rem;
    font-weight: 700;
}

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

.site-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 2px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.welcome {
    font-size: 0.9rem;
    opacity: 0.95;
}

.main-content {
    width: 100%;
    max-width: 900px;
    margin: 24px auto;
    padding: 0 16px;
    display: grid;
    gap: 18px;
    flex: 1;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.panel-sm {
    max-width: 560px;
    justify-self: center;
    width: 100%;
}

.float-panel {
    transform: translateY(-2px);
}

h1,
h2 {
    margin: 0 0 10px;
}

.subtle {
    color: var(--muted);
    margin-top: 0;
}

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

label {
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c7d4e7;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 0.95rem;
    color: var(--text);
    background: #fbfdff;
}

input[type='checkbox'] {
    width: auto;
    margin-right: 6px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(30, 100, 240, 0.35);
    border-color: var(--primary);
}

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

.inline-form {
    margin: 0;
}

.btn,
.link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 0;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 9px 14px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 15px rgba(30, 100, 240, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-edit {
    background: var(--edit);
    color: #111;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 6px 9px;
}

.text-btn {
    border: 0;
    background: transparent;
    color: #2c4f87;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
}

.link-btn {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.notice {
    padding: 11px 13px;
    border-radius: 12px;
    font-weight: 500;
    margin-bottom: 10px;
}

.notice-success {
    background: #e8f8ef;
    border: 1px solid #b8e9ce;
    color: #14633a;
}

.notice-error {
    background: #ffecec;
    border: 1px solid #ffc8c8;
    color: #8f2727;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

th,
td {
    border-bottom: 1px solid #e0e8f5;
    text-align: left;
    padding: 11px 8px;
    font-size: 0.93rem;
}

th {
    color: #304564;
}

.price-low {
    color: var(--ok);
    font-weight: 700;
}

.price-avg {
    color: var(--avg);
    font-weight: 700;
}

.price-high {
    color: var(--high);
    font-weight: 700;
}

.price-offer {
    color: #b46b00;
    font-weight: 700;
}

.recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.recent-list li {
    background: #f8fbff;
    border: 1px solid #dbe6f6;
    border-radius: 12px;
    padding: 10px;
}

.recent-date {
    font-size: 0.82rem;
    color: #526687;
    margin-bottom: 4px;
}

.recent-range {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #e9f1ff;
    color: #234c86;
}

.recent-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.recent-details {
    margin-top: 8px;
}

.analyze-progress {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #e6edfb;
    overflow: hidden;
    border: 1px solid #ccd9f1;
}

.analyze-progress-bar {
    height: 100%;
    width: 5%;
    background: linear-gradient(90deg, #1e64f0 0%, #4b8cff 100%);
    transition: width 0.35s ease;
    transform: translateX(0);
}

.analyze-progress-bar.is-running {
    width: 32%;
    background: linear-gradient(
        110deg,
        #1e64f0 8%,
        #5d98ff 18%,
        #1e64f0 33%
    );
    background-size: 180% 100%;
    animation: analyzeIndeterminate 1.15s ease-in-out infinite;
}

@keyframes analyzeIndeterminate {
    0% {
        transform: translateX(-120%);
        background-position: 180% 0;
    }
    55% {
        transform: translateX(120%);
        background-position: 10% 0;
    }
    100% {
        transform: translateX(280%);
        background-position: -70% 0;
    }
}

.analyze-progress-text {
    margin: 4px 0 0;
    color: #325587;
    font-size: 0.9rem;
}

.sample-note {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    background: #fff1dd;
    color: #9a5a00;
}

.sample-help {
    margin-top: 10px;
    font-size: 0.85rem;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
}

.site-footer {
    margin-top: auto;
    border-top: 1px solid #d8e4f4;
    background: #f8fbff;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    color: #5b6b83;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-links {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #2c4f87;
}

.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    background: #fff;
    border: 1px solid #c9d9f1;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(18, 42, 79, 0.18);
    padding: 14px;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.cookie-banner[hidden] {
    display: none !important;
}

.cookie-banner p {
    margin: 0;
    color: #2f4262;
}

.cookie-actions {
    display: inline-flex;
    gap: 8px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 26, 47, 0.55);
    z-index: 1300;
}

.modal-backdrop[hidden] {
    display: none !important;
}

.legal-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 1400;
    padding: 16px;
}

.legal-modal[hidden] {
    display: none !important;
}

.legal-modal-inner {
    width: min(760px, 100%);
    max-height: 82dvh;
    overflow: auto;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 36px rgba(15, 35, 67, 0.25);
    padding: 20px;
    border: 1px solid #d0ddee;
}

.customer-modal .legal-modal-inner {
    width: min(1100px, 96vw);
    max-height: 90dvh;
    min-height: 68dvh;
    padding: 28px;
}

.customer-view-content h2 {
    font-size: 2rem;
    margin-bottom: 18px;
}

.customer-view-content p {
    font-size: 1.35rem;
    line-height: 1.5;
    margin: 0 0 14px;
}

.modal-close {
    border: 0;
    background: #edf3ff;
    color: #1f4c94;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    margin-bottom: 10px;
}

.legal-content h1,
.legal-content h2,
.legal-content h3 {
    margin-top: 0;
}

.rotate-notice {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #112f5e;
    color: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    z-index: 1500;
}

.rotate-notice[hidden] {
    display: none !important;
}

.rotate-notice p {
    margin: 0;
    font-size: 0.86rem;
}

.admin-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
}

.admin-tabs {
    display: grid;
    gap: 8px;
    align-content: start;
}

.tab-btn {
    border: 1px solid #c8d9f0;
    border-radius: 10px;
    background: #f5f9ff;
    color: #214879;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
}

.tab-btn.is-active {
    background: #1e64f0;
    border-color: #1e64f0;
    color: #fff;
}

.tab-pane {
    display: none;
}

.tab-pane.is-active {
    display: block;
}

.logo-preview-wrap {
    margin-bottom: 10px;
}

.logo-preview {
    max-width: 280px;
    width: 100%;
    border: 1px solid #d8e4f4;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
}

@media (max-width: 700px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav {
        width: 100%;
    }

    .main-content {
        margin-top: 16px;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

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

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

@media (max-width: 520px) and (orientation: portrait) {
    .rotate-notice[data-show='1'] {
        display: block;
    }
}
