/* sweet skin editorial clinic theme */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #F8F6F2;
    --bg-soft: #F3EFE8;
    --surface: #FFFFFF;
    --surface-muted: #F7F4EE;
    --text: #171717;
    --text-soft: #5E5A55;
    --text-faint: #8B857E;
    --line: #E7E1D8;
    --accent: #D9B8A7;
    --accent-strong: #C89F8A;
    --accent-soft: #F3E4DC;
    --success: #7E9A84;
    --warning: #C7A26A;
    --error: #B97872;

    --radius: 24px;
    --radius-sm: 14px;
    --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
    --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;

    /* Backward-compatible aliases used by template inline styles */
    --bg-primary: var(--bg);
    --bg-secondary: var(--surface);
    --bg-chat: var(--bg);
    --bg-user-msg: linear-gradient(135deg, #D8B3A1 0%, #C89F8A 100%);
    --bg-bot-msg: var(--surface);
    --bg-glass: rgba(255, 255, 255, 0.74);
    --text-primary: var(--text);
    --text-secondary: var(--text-soft);
    --accent-hover: var(--accent-strong);
    --accent-glow: rgba(200, 159, 138, 0.12);
    --accent-rose: #D1AFA4;
    --border: rgba(23, 23, 23, 0.1);
    --border-subtle: rgba(23, 23, 23, 0.07);
    --font: var(--font-body);
    --shadow-soft: 0 10px 34px rgba(23, 23, 23, 0.06);
    --shadow-glow: 0 6px 24px rgba(200, 159, 138, 0.12);
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: var(--text);
    background:
        radial-gradient(120% 68% at 50% 0%, rgba(217, 184, 167, 0.18) 0%, transparent 60%),
        radial-gradient(72% 50% at 88% 100%, rgba(231, 225, 216, 0.45) 0%, transparent 70%),
        var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: pageReveal 420ms ease-out;
}

@keyframes pageReveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1,
h2,
h3,
.display {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 0.95;
    color: var(--text);
}

h1 {
    font-size: clamp(42px, 7vw, 84px);
}

h2 {
    font-size: clamp(30px, 4vw, 52px);
}

h3 {
    font-size: clamp(22px, 2.8vw, 34px);
}

.eyebrow,
.meta,
.nav-label {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    color: var(--text-faint);
}

.container {
    width: min(1200px, calc(100% - 48px));
    margin-inline: auto;
}

.container-narrow {
    width: min(760px, calc(100% - 48px));
    margin-inline: auto;
}

.section {
    padding-block: clamp(56px, 8vw, 120px);
}

.stack-lg > * + * {
    margin-top: 32px;
}

.stack-md > * + * {
    margin-top: 20px;
}

.stack-sm > * + * {
    margin-top: 12px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(23, 23, 23, 0.06);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(23, 23, 23, 0.04);
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 32px;
    background: rgba(248, 246, 242, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
}

.header::after {
    content: '';
    position: absolute;
    left: 32px;
    right: 32px;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(200, 159, 138, 0.6), transparent);
}

.header h1 {
    font-size: clamp(30px, 4vw, 44px);
    font-weight: 500;
    line-height: 0.9;
}

.brand-mark {
    display: inline-flex;
    flex-direction: column;
    text-transform: lowercase;
    letter-spacing: 0.01em;
    line-height: 0.8;
}

.brand-mark span {
    display: block;
}

.brand-mark-hero {
    align-items: center;
}

.login-page {
    overflow: auto;
}

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

.auth-card {
    width: min(460px, 100%);
    background: var(--surface);
    border: 1px solid rgba(23, 23, 23, 0.07);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    padding: 34px 32px;
}

.auth-subtitle {
    margin-top: 14px;
    color: var(--text-soft);
    text-align: center;
    font-size: 14px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-form {
    margin-top: 28px;
    display: grid;
    gap: 14px;
}

.auth-form label {
    color: var(--text-faint);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.11em;
}

.auth-form .input {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 13px 14px;
    background: var(--surface-muted);
}

.auth-form .input:focus {
    border-color: var(--text-soft);
    background: #fff;
}

.auth-form .btn {
    margin-top: 8px;
    width: 100%;
}

.auth-error {
    margin-top: 16px;
    padding: 10px 12px;
    background: rgba(185, 120, 114, 0.1);
    border: 1px solid rgba(185, 120, 114, 0.35);
    border-radius: 12px;
    color: #7a312f;
    font-size: 14px;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
}

.status-dot.ok {
    background: var(--success);
}

.status-dot.warning {
    background: var(--warning);
}

.status-dot.error {
    background: var(--error);
}

.status-dot.loading {
    background: var(--warning);
    animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.88); }
}

.btn,
.btn-sm,
.send-btn,
.create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid var(--text);
    background: var(--text);
    color: #fff;
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: all 180ms ease;
}

.btn:hover,
.btn-sm:hover,
.send-btn:hover,
.create-btn:hover {
    background: transparent;
    color: var(--text);
}

.btn-secondary,
.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 180ms ease;
}

.btn-secondary:hover,
.nav-link:hover,
.nav-link.active {
    border-color: var(--text);
    background: var(--surface-muted);
}

.btn-sm {
    min-height: 40px;
    padding: 0 16px;
    font-size: 12px;
}

.send-btn {
    width: 50px;
    min-width: 50px;
    padding: 0;
    border-radius: 999px;
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

.send-btn:disabled,
.create-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: clamp(24px, 4vw, 42px) clamp(18px, 4vw, 44px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
}

.message {
    max-width: min(760px, 92%);
    padding: 18px 22px;
    border-radius: 22px;
    line-height: 1.68;
    font-size: 15px;
    border: 1px solid rgba(23, 23, 23, 0.06);
    animation: messageIn 320ms cubic-bezier(0.2, 0.75, 0.35, 1) both;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #D8B3A1 0%, #C89F8A 100%);
    color: #ffffff;
    border-bottom-right-radius: 8px;
    border-color: rgba(200, 159, 138, 0.3);
}

.message.bot {
    align-self: flex-start;
    background: var(--surface);
    color: var(--text);
    border-bottom-left-radius: 8px;
}

.message.error {
    border-left: 2px solid var(--error);
}

.message .label {
    font-size: 11px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-faint);
}

.message.user .label {
    color: rgba(255, 255, 255, 0.75);
}

.message .sql-preview,
.create-preview {
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-soft);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

.toggle-sql {
    margin-top: 10px;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

.toggle-sql:hover {
    color: var(--text);
}

.chart-wrapper {
    margin-top: 16px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 18px;
    min-height: 460px;
    display: flex;
    flex-direction: column;
}

.chart-wrapper canvas {
    flex: 1;
    min-height: 360px;
}

.expert-block {
    margin-top: 12px;
    padding: 18px 20px;
    background: var(--accent-soft);
    border: 1px solid rgba(200, 159, 138, 0.35);
    border-left: 3px solid var(--accent-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.72;
    color: var(--text);
}

.expert-block .expert-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-soft);
    margin-bottom: 10px;
}

.expert-block p {
    margin-bottom: 8px;
}

.expert-block ul {
    margin: 6px 0 8px;
    padding-left: 18px;
}

.expert-block li {
    margin-bottom: 4px;
    color: var(--text-soft);
}

.expert-block strong {
    color: var(--text);
    font-weight: 600;
}

.data-table-wrapper {
    margin-top: 16px;
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    position: sticky;
    top: 0;
    background: var(--surface-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--text-soft);
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.data-table td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(23, 23, 23, 0.05);
    color: var(--text-soft);
}

.data-table tr:hover td {
    background: var(--surface-muted);
    color: var(--text);
}

.typing {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

.typing span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--accent-strong);
    animation: typing 1.4s infinite;
    opacity: 0.5;
}

.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%,
    60%,
    100% { transform: translateY(0); opacity: 0.28; }
    30% { transform: translateY(-7px); opacity: 1; }
}

.welcome {
    text-align: center;
    padding: clamp(36px, 8vw, 72px) 24px 28px;
    color: var(--text-soft);
    max-width: 760px;
    margin: 0 auto;
}

.welcome h2 {
    font-size: clamp(38px, 7vw, 72px);
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text);
}

.welcome h2::after {
    content: '';
    display: block;
    width: 54px;
    height: 1px;
    margin: 14px auto 0;
    background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
}

.welcome p {
    margin: 0 auto 28px;
    max-width: 640px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-soft);
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.suggestion {
    padding: 10px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font-family: var(--font-body);
    font-size: 12px;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 180ms ease;
}

.suggestion:hover {
    border-color: var(--accent-strong);
    background: var(--accent-soft);
    color: var(--text);
}

.input,
.select,
.textarea,
.form-field input[type='text'],
.form-field textarea,
.form-field select {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    border-radius: 0;
    padding: 14px 0;
    font: inherit;
    color: var(--text);
    outline: none;
}

.input::placeholder,
.textarea::placeholder,
.form-field textarea::placeholder,
.form-field input[type='text']::placeholder {
    color: var(--text-faint);
}

.input:focus,
.select:focus,
.textarea:focus,
.form-field input[type='text']:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-bottom-color: var(--text);
}

.input-area {
    padding: 18px 28px;
    background: rgba(248, 246, 242, 0.94);
    border-top: 1px solid var(--line);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
    position: relative;
}

.input-area::before {
    content: '';
    position: absolute;
    left: 32px;
    right: 32px;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(200, 159, 138, 0.45), transparent);
}

.input-area textarea {
    flex: 1;
    min-height: 50px;
    max-height: 130px;
    resize: none;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    outline: none;
    transition: border-color 180ms ease, background-color 180ms ease;
}

.input-area textarea::placeholder {
    color: var(--text-faint);
}

.input-area textarea:focus {
    border-color: var(--text-soft);
    background: #fff;
}

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    max-width: 360px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    font-family: var(--font-body);
    font-size: 14px;
    animation: slideIn 300ms ease, fadeOut 300ms ease 4.7s;
}

.toast.info {
    border-left: 3px solid var(--accent-strong);
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast.success {
    border-left: 3px solid var(--success);
}

@keyframes slideIn {
    from {
        transform: translateX(12px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(94, 90, 85, 0.25);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(94, 90, 85, 0.45);
}

@media (max-width: 900px) {
    .header {
        padding: 14px 18px;
        align-items: flex-start;
        flex-direction: column;
    }

    .header h1 {
        font-size: clamp(28px, 8vw, 42px);
    }

    .header-actions {
        width: 100%;
    }

    .grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }

    .chat-container {
        padding: 20px 16px;
    }

    .input-area {
        padding: 12px 14px;
    }

    .input-area::before {
        left: 14px;
        right: 14px;
    }

    .message {
        max-width: 96%;
    }
}

@media (max-width: 640px) {
    .suggestions {
        justify-content: stretch;
    }

    .suggestion {
        width: 100%;
        text-align: left;
    }

    .toast-container {
        left: 14px;
        right: 14px;
        top: auto;
        bottom: 16px;
    }

    .toast {
        max-width: none;
    }
}
