@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,600;1,600;1,700&display=swap');

:root {
    --ink: #17201d;
    --muted: #75807b;
    --soft: #a7b0ab;
    --line: #e4e9e4;
    --paper: #f7f8f5;
    --white: #ffffff;
    --forest: #173d32;
    --forest-light: #245748;
    --mint: #dff1e3;
    --coral: #e87555;
    --gold: #d6ad62;
    --shadow: 0 18px 50px rgba(31, 53, 43, .08);
    --display: 'Playfair Display', Georgia, serif;
    --body: 'DM Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--body);
    -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }
.eyebrow, .panel-kicker, .stat-mark {
    color: var(--coral);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .16em;
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { display: inline-grid; width: 27px; height: 27px; place-items: center; color: var(--forest); background: var(--mint); border-radius: 50%; font-size: 16px; line-height: 1; }
.brand-light { color: var(--white); }
.brand-light .brand-mark { color: var(--white); background: rgba(255,255,255,.16); }

/* Auth */
.auth-page { min-height: 100vh; background: var(--forest); }
.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(400px, 47%) 1fr; }
.auth-intro { position: relative; overflow: hidden; padding: 47px 9vw 40px 7vw; color: var(--white); background: linear-gradient(140deg, #173d32, #245447); }
.auth-copy { position: relative; z-index: 1; max-width: 430px; margin-top: 25vh; }
.auth-copy h1 { margin: 17px 0; font-family: var(--display); font-size: clamp(50px, 5vw, 82px); font-weight: 600; line-height: .98; letter-spacing: -.06em; }
.auth-copy h1 em { color: #d7eddb; font-weight: 600; }
.auth-copy p { max-width: 280px; color: rgba(255,255,255,.62); font-size: 14px; line-height: 1.8; }
.auth-intro .eyebrow { color: #a6d8af; }
.auth-footer { position: absolute; bottom: 40px; color: rgba(255,255,255,.38); font-family: var(--mono); font-size: 10px; letter-spacing: .1em; }
.auth-orbit { position: absolute; border: 1px solid rgba(214, 235, 214, .14); border-radius: 50%; pointer-events: none; }
.orbit-one { width: 54vw; height: 54vw; right: -32vw; bottom: -11vw; }
.orbit-two { width: 32vw; height: 32vw; right: -15vw; bottom: 4vw; border-color: rgba(214, 235, 214, .2); }
.auth-panel { display: grid; place-items: center; padding: 40px; background: var(--paper); }
.auth-card { width: min(100%, 380px); }
.auth-card h2 { margin: 14px 0 7px; font-family: var(--display); font-size: 42px; letter-spacing: -.05em; }
.auth-subtitle { margin: 0 0 35px; color: var(--muted); font-size: 13px; }
.mobile-brand { display: none; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { margin-top: 9px; color: var(--ink); font-size: 12px; font-weight: 600; }
.auth-form input { height: 52px; padding: 0 16px; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 4px; outline: none; transition: border .2s, box-shadow .2s; }
.auth-form input:focus { border-color: var(--forest-light); box-shadow: 0 0 0 3px rgba(36,87,72,.1); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 45px; padding: 0 18px; border: 0; border-radius: 3px; cursor: pointer; font-size: 12px; font-weight: 600; transition: transform .2s, background .2s, opacity .2s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .6; transform: none; }
.button-primary { color: #fff; background: var(--forest); }
.button-primary:hover { background: var(--forest-light); }
.button-secondary { color: var(--forest); background: var(--white); border: 1px solid var(--line); }
.button-secondary:hover { border-color: #c3d0c6; background: #fbfcfa; }
.button-full { width: 100%; height: 55px; margin-top: 23px; justify-content: space-between; padding: 0 20px; }
.button-arrow { font-size: 18px; font-weight: 400; }
.auth-hint { margin: 18px 0 0; color: var(--soft); font-family: var(--mono); font-size: 10px; }
.alert { margin: 0 0 13px; padding: 11px 13px; border-radius: 3px; font-size: 12px; }
.alert-error { color: #a4402a; background: #ffebe5; border: 1px solid #ffd4c8; }

/* App shell */
.app-page { min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { display: flex; width: 245px; flex: 0 0 245px; flex-direction: column; padding: 30px 19px 20px; background: var(--white); border-right: 1px solid var(--line); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.sidebar-rule { height: 1px; margin: 29px 10px 27px; background: var(--line); }
.side-nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; height: 47px; padding: 0 13px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; cursor: pointer; font-size: 12px; text-align: left; transition: color .2s, background .2s; }
.nav-item:hover { color: var(--forest); background: #f2f7f2; }
.nav-item.is-active { color: var(--forest); background: var(--mint); font-weight: 600; }
.nav-icon { width: 17px; color: currentColor; font-size: 19px; text-align: center; }
.sidebar-bottom { margin-top: auto; }
.provider-status { display: flex; position: relative; align-items: center; gap: 10px; margin: 0 6px 20px; padding: 14px 12px; background: #f6faf5; border: 1px solid #e5efe4; border-radius: 4px; }
.status-dot, .tiny-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; background: #62b575; border-radius: 50%; }
.provider-status strong { display: block; color: var(--forest); font-size: 11px; }
.provider-status small { display: block; margin-top: 3px; color: var(--soft); font-size: 10px; }
.status-pulse { width: 5px; height: 5px; margin-left: auto; background: #8bd297; border-radius: 50%; box-shadow: 0 0 0 4px rgba(139,210,151,.14); }
.profile-chip { display: flex; align-items: center; gap: 9px; padding: 10px 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.avatar { display: inline-grid; width: 28px; height: 28px; place-items: center; color: var(--forest); background: var(--mint); border-radius: 50%; font-size: 11px; font-weight: 700; }
.profile-name { overflow: hidden; flex: 1; color: var(--ink); font-weight: 600; text-overflow: ellipsis; }
.logout-icon { color: var(--soft); font-size: 17px; }
.mobile-close, .mobile-menu, .sidebar-backdrop { display: none; }
.main-content { min-width: 0; flex: 1; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 82px; padding: 0 clamp(24px, 5vw, 74px); background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--soft); font-family: var(--mono); font-size: 10px; letter-spacing: .03em; }
.topbar-breadcrumb b { color: #cbd2cd; font-weight: 400; }
.topbar-breadcrumb strong { color: var(--ink); font-weight: 500; }
.topbar-meta { display: flex; align-items: center; gap: 15px; color: var(--soft); font-family: var(--mono); font-size: 10px; }
.topbar-divider { width: 1px; height: 15px; background: var(--line); }
.user-label { color: var(--muted); }
.content-wrap { max-width: 1440px; padding: 55px clamp(24px, 5vw, 74px) 70px; }
.view { display: none; animation: fade-in .35s ease both; }
.view.is-visible { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.hero-heading, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 36px; }
.hero-heading h1, .section-heading h1 { margin: 13px 0 8px; font-family: var(--display); font-size: clamp(34px, 4vw, 53px); letter-spacing: -.055em; line-height: 1; }
.hero-heading p, .section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.hero-note { display: flex; align-items: center; gap: 10px; padding-bottom: 4px; color: var(--soft); font-family: var(--mono); font-size: 9px; letter-spacing: .12em; }
.hero-note span:first-child { color: var(--coral); font-size: 14px; }
.hero-note i { display: block; width: 42px; height: 1px; background: var(--line); }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, .92fr); gap: 18px; align-items: stretch; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 5px; box-shadow: var(--shadow); }
.composer-panel, .preview-panel { min-height: 535px; padding: 28px 30px 25px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 27px; }
.panel-heading h2 { margin: 9px 0 0; font-size: 18px; letter-spacing: -.03em; }
.step-number { color: #d0d8d2; font-family: var(--display); font-size: 27px; font-style: italic; }
.prompt-box { overflow: hidden; background: #fbfcfa; border: 1px solid var(--line); border-radius: 3px; }
.prompt-box textarea { display: block; width: 100%; height: 166px; padding: 18px; resize: none; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 13px; line-height: 1.75; }
.prompt-box textarea::placeholder { color: #aeb7b1; }
.prompt-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 13px; border-top: 1px solid var(--line); }
.prompt-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-chip { padding: 4px 7px; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 10px; }
.tool-chip:hover { color: var(--forest); }
.char-count { color: var(--soft); font-family: var(--mono); font-size: 9px; }
.options-heading { display: flex; align-items: center; gap: 12px; margin: 27px 0 17px; }
.options-line { height: 1px; flex: 1; background: var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field-group { display: grid; gap: 7px; }
.field-group.field-wide { grid-column: 1 / -1; }
.field-group > span { color: var(--muted); font-size: 10px; font-weight: 600; }
.field-group select { width: 100%; height: 40px; padding: 0 12px; color: var(--ink); background: #fbfcfa; border: 1px solid var(--line); border-radius: 3px; outline: 0; font-size: 11px; }
.field-group select:focus { border-color: #98b7a0; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 27px; padding-top: 19px; border-top: 1px solid var(--line); }
.form-tip { color: var(--soft); font-size: 10px; }
.tip-icon { display: inline-grid; width: 14px; height: 14px; margin-right: 4px; place-items: center; color: var(--muted); border: 1px solid #cdd6d0; border-radius: 50%; font-family: var(--mono); font-size: 9px; }
.generate-button { min-width: 130px; justify-content: space-between; }
.button-loading { display: none; }
.is-loading .button-label { display: none; }
.is-loading .button-loading { display: inline; }
.loading-dots { display: inline-block; width: 17px; overflow: hidden; animation: dots 1.1s steps(4, end) infinite; }
@keyframes dots { 0%, 20% { width: 0; } 50% { width: 8px; } 100% { width: 17px; } }
.form-message { min-height: 16px; margin-top: 10px; color: transparent; font-size: 11px; }
.form-message.is-visible { color: #b34e34; }
.form-message.success { color: #4d8e5c; }
.preview-panel { display: flex; flex-direction: column; background: #fbfcfa; }
.output-count { color: var(--soft); font-family: var(--mono); font-size: 10px; }
.result-stage { display: grid; min-height: 385px; flex: 1; place-items: center; padding: 14px; background: #f3f6f1; border: 1px dashed #dce5dc; border-radius: 3px; }
.empty-result { color: var(--muted); text-align: center; }
.empty-icon { display: grid; width: 53px; height: 53px; margin: 0 auto 17px; place-items: center; color: var(--forest); background: var(--mint); border-radius: 50%; font-size: 28px; }
.empty-result strong, .empty-history strong { display: block; color: var(--ink); font-size: 12px; }
.empty-result p, .empty-history p { margin: 8px 0 20px; color: var(--soft); font-size: 11px; }
.empty-rule { display: flex; align-items: center; justify-content: center; gap: 9px; color: #b5c0b7; font-family: var(--mono); font-size: 8px; letter-spacing: .1em; }
.empty-rule i { width: 20px; height: 1px; background: #d4ddd5; }
.result-grid { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.result-image { overflow: hidden; position: relative; min-width: 0; margin: 0; background: #e7eee7; border-radius: 3px; animation: reveal .45s ease both; }
.result-image img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.result-image figcaption { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; color: #748078; background: #fff; font-family: var(--mono); font-size: 8px; }
.result-image figcaption a { color: var(--forest-light); }
@keyframes reveal { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.preview-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; color: var(--soft); font-family: var(--mono); font-size: 9px; }
.preview-footer .tiny-dot { margin-right: 5px; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 18px; margin-top: 18px; }
.stat-card { position: relative; overflow: hidden; min-height: 115px; padding: 21px 23px; background: var(--white); border: 1px solid var(--line); border-radius: 5px; }
.stat-label { display: block; color: var(--muted); font-size: 11px; }
.stat-card strong { display: block; margin-top: 7px; color: var(--forest); font-family: var(--display); font-size: 32px; letter-spacing: -.05em; }
.stat-card-wide strong { overflow: hidden; margin-top: 13px; font-family: var(--body); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.stat-mark { position: absolute; right: 23px; bottom: 19px; color: #c2ccc3; font-size: 8px; }

/* History and settings */
.section-heading { align-items: end; }
.section-heading .button { margin-bottom: 3px; }
.history-toolbar { display: flex; justify-content: space-between; margin-bottom: 15px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.history-toolbar b { color: var(--forest); }
.toolbar-note { color: var(--soft); }
.history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.history-card { overflow: hidden; min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 8px 25px rgba(31,53,43,.04); }
.history-image-wrap { position: relative; background: #e7eee7; }
.history-image-wrap img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.history-model { position: absolute; top: 10px; left: 10px; padding: 5px 7px; color: #fff; background: rgba(23,61,50,.76); border-radius: 2px; font-family: var(--mono); font-size: 8px; }
.history-delete { display: grid; position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; place-items: center; color: #fff; background: rgba(23,61,50,.65); border: 0; border-radius: 50%; cursor: pointer; font-size: 17px; opacity: 0; transition: opacity .2s; }
.history-image-wrap:hover .history-delete { opacity: 1; }
.history-copy { padding: 13px 14px 14px; }
.history-copy p { overflow: hidden; height: 37px; margin: 0 0 13px; color: var(--ink); font-size: 11px; line-height: 1.65; }
.history-copy div { display: flex; align-items: center; gap: 7px; color: var(--soft); font-family: var(--mono); font-size: 8px; }
.history-copy div span { padding-right: 7px; border-right: 1px solid var(--line); }
.history-copy time { margin-left: auto; }
.empty-history { padding: 90px 20px; text-align: center; background: var(--white); border: 1px dashed #dce5dc; border-radius: 5px; }
.inline-error { grid-column: 1 / -1; padding: 20px; color: #b34e34; background: #ffebe5; border-radius: 4px; font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.setting-card { min-height: 330px; padding: 27px; }
.setting-icon { display: grid; width: 38px; height: 38px; margin-bottom: 26px; place-items: center; color: var(--forest); background: var(--mint); border-radius: 50%; font-size: 19px; }
.setting-card h2 { margin: 10px 0; font-size: 18px; }
.setting-card p { min-height: 55px; margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.setting-value { display: flex; align-items: center; gap: 8px; margin-bottom: 23px; padding: 12px; background: #f7faf6; border: 1px solid #e7efe5; border-radius: 3px; font-size: 11px; }
.setting-value code { color: var(--forest); font-family: var(--mono); }
.setting-ok { margin-left: auto; color: #5f9c6c; font-family: var(--mono); font-size: 9px; }
.setting-message { min-height: 19px; margin-top: 12px; font-size: 10px; }
.setting-message.is-success { color: #4d8e5c; }
.setting-message.is-error { color: #b34e34; }
.model-list { display: grid; gap: 15px; margin-top: 20px; }
.model-list > div { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; color: var(--ink); font-size: 11px; }
.model-list small { color: var(--soft); font-size: 9px; }
.model-dot { width: 7px; height: 7px; border-radius: 50%; }
.model-blue { background: #6f9bd3; }
.model-gold { background: var(--gold); }
.model-green { background: #70ae7a; }
.security-card p { min-height: auto; margin-bottom: 12px; }
.account-line { display: flex; align-items: center; gap: 10px; margin-bottom: 25px; }
.account-line .avatar { width: 32px; height: 32px; }
.account-role { margin-left: auto; color: var(--soft); font-family: var(--mono); font-size: 9px; }

/* Local cover generator */
.cover-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 36px; }
.cover-heading h1 { margin: 13px 0 8px; font-family: var(--display); font-size: clamp(34px, 4vw, 53px); letter-spacing: -.055em; line-height: 1; }
.cover-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.cover-badge { display: flex; align-items: center; gap: 12px; padding-bottom: 5px; color: var(--soft); font-family: var(--mono); }
.cover-badge span { color: var(--coral); font-family: var(--display); font-size: 34px; font-style: italic; }
.cover-badge small { padding-left: 12px; border-left: 1px solid var(--line); font-size: 9px; letter-spacing: .12em; }
.cover-layout { display: grid; grid-template-columns: minmax(310px, .76fr) minmax(490px, 1.24fr); gap: 18px; align-items: stretch; }
.cover-form-panel, .cover-preview-panel { min-height: 615px; padding: 28px 30px 25px; }
.cover-field { display: grid; gap: 8px; margin-bottom: 22px; }
.cover-field > span { color: var(--muted); font-size: 11px; font-weight: 600; }
.cover-field > span b, .cover-field > span em { margin-left: 6px; color: var(--coral); font-family: var(--mono); font-size: 8px; font-style: normal; font-weight: 400; }
.cover-field > input { width: 100%; height: 49px; padding: 0 14px; color: var(--ink); background: #fbfcfa; border: 1px solid var(--line); border-radius: 3px; outline: 0; font-size: 13px; }
.cover-field > input:focus { border-color: #98b7a0; box-shadow: 0 0 0 3px rgba(36,87,72,.06); }
.cover-field > small { color: var(--soft); font-size: 10px; }
.palette-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.palette-option { display: grid; position: relative; gap: 7px; padding: 11px 9px; background: #fbfcfa; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; transition: border .2s, background .2s; }
.palette-option.is-selected { background: #f5faf5; border-color: #a8c7ad; }
.palette-option input { position: absolute; opacity: 0; pointer-events: none; }
.palette-option strong { color: var(--ink); font-size: 10px; }
.palette-option small { color: var(--soft); font-size: 9px; }
.palette-swatch { width: 100%; height: 28px; border-radius: 2px; }
.palette-warm { background: linear-gradient(135deg, #f59409, #e93034); }
.palette-blue { background: linear-gradient(135deg, #338be2, #7044cf); }
.palette-green { background: linear-gradient(135deg, #c9972a, #df5b43); }
.cover-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.cover-presets > span { width: 100%; margin-bottom: 2px; color: var(--soft); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; }
.cover-presets button { padding: 6px 8px; color: var(--muted); background: #f5f8f3; border: 0; border-radius: 2px; cursor: pointer; font-size: 10px; }
.cover-presets button:hover { color: var(--forest); background: var(--mint); }
.cover-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 28px; padding-top: 19px; border-top: 1px solid var(--line); }
.cover-preview-panel { display: flex; flex-direction: column; background: #fbfcfa; }
.cover-preview-stage { display: grid; min-height: 490px; flex: 1; place-items: center; padding: 15px; background: #f3f6f1; border: 1px dashed #dce5dc; border-radius: 3px; }
.cover-empty { color: var(--muted); text-align: center; }
.cover-image { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 2px; box-shadow: 0 14px 36px rgba(50,60,40,.13); animation: reveal .45s ease both; }
.cover-preview-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 55px; padding-top: 16px; color: var(--soft); font-family: var(--mono); font-size: 9px; }
.cover-preview-footer .tiny-dot { margin-right: 5px; }
.cover-preview-footer .button { min-height: 34px; padding: 0 11px; font-family: var(--body); font-size: 10px; }
.cover-history-section { margin-top: 48px; }
.cover-history-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.cover-history-heading h2 { margin: 9px 0 0; font-family: var(--display); font-size: 28px; letter-spacing: -.05em; }
.cover-history-heading .button { min-height: 36px; }
.cover-history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.cover-history-card { overflow: hidden; min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 8px 25px rgba(31,53,43,.04); }
.cover-history-image { position: relative; background: #edf2ec; }
.cover-history-image img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.cover-history-ratio { position: absolute; top: 9px; left: 9px; padding: 4px 6px; color: #fff; background: rgba(23,61,50,.72); border-radius: 2px; font-family: var(--mono); font-size: 8px; }
.cover-history-copy { padding: 13px 14px 14px; }
.cover-history-copy strong { display: block; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.cover-history-copy p { overflow: hidden; height: 19px; margin: 7px 0 10px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.cover-history-copy div { display: flex; align-items: center; justify-content: space-between; color: var(--soft); font-family: var(--mono); font-size: 8px; }

/* Preset manager */
.preset-layout { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(370px, .82fr); gap: 18px; align-items: start; }
.preset-list-panel, .preset-editor-panel { min-height: 610px; padding: 28px 30px 25px; }
.preset-list-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 25px; }
.preset-list-heading h2 { margin: 9px 0 0; font-size: 18px; letter-spacing: -.03em; }
.preset-list { display: grid; gap: 12px; }
.preset-card { position: relative; padding: 17px 18px 14px; background: #fbfcfa; border: 1px solid var(--line); border-radius: 4px; transition: border .2s, box-shadow .2s; }
.preset-card:hover, .preset-card.is-selected { border-color: #a7c4ad; box-shadow: 0 8px 22px rgba(31,53,43,.06); }
.preset-card-top { display: flex; align-items: center; justify-content: space-between; }
.preset-status { display: flex; align-items: center; gap: 6px; color: var(--soft); font-family: var(--mono); font-size: 8px; }
.preset-status span { width: 6px; height: 6px; background: #b7c1ba; border-radius: 50%; }
.preset-status.is-on { color: #5f9c6c; }
.preset-status.is-on span { background: #62b575; }
.preset-date { color: var(--soft); font-family: var(--mono); font-size: 8px; }
.preset-card h3 { margin: 11px 0 10px; color: var(--ink); font-size: 14px; }
.preset-key-row { display: flex; align-items: center; gap: 9px; }
.preset-key-row code { overflow: hidden; flex: 1; padding: 8px 9px; color: var(--forest); background: var(--mint); border-radius: 2px; font-family: var(--mono); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.preset-key-row button { padding: 6px 7px; color: var(--forest); background: transparent; border: 1px solid #c9d9cb; border-radius: 2px; cursor: pointer; font-size: 9px; }
.preset-key-row button:hover { background: var(--white); }
.preset-card p { overflow: hidden; height: 36px; margin: 11px 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.preset-meta { display: flex; gap: 7px; color: var(--soft); font-family: var(--mono); font-size: 8px; }
.preset-meta span { padding-right: 7px; border-right: 1px solid var(--line); }
.preset-meta span:last-child { overflow: hidden; max-width: 190px; border-right: 0; text-overflow: ellipsis; white-space: nowrap; }
.preset-example { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px; background: #f2f6f1; border: 1px solid #e2ebe1; border-radius: 3px; }
.preset-example > span { flex: 0 0 auto; color: var(--forest); font-size: 9px; font-weight: 600; }
.preset-example code { overflow: hidden; flex: 1; color: var(--muted); font-family: var(--mono); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.preset-example button { flex: 0 0 auto; padding: 5px 6px; color: var(--forest); background: var(--white); border: 1px solid #c9d9cb; border-radius: 2px; cursor: pointer; font-size: 8px; }
.preset-example button:hover { background: var(--mint); }
.preset-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 11px; }
.preset-actions button { padding: 0; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 10px; }
.preset-actions button:hover { color: var(--forest); }
.preset-actions button:last-child:hover { color: var(--coral); }
.cover-field textarea { width: 100%; padding: 12px 14px; resize: vertical; color: var(--ink); background: #fbfcfa; border: 1px solid var(--line); border-radius: 3px; outline: 0; font-size: 12px; line-height: 1.7; }
.cover-field textarea:focus { border-color: #98b7a0; box-shadow: 0 0 0 3px rgba(36,87,72,.06); }
.preset-enabled { display: flex; align-items: center; gap: 8px; margin-top: 22px; color: var(--muted); font-size: 11px; cursor: pointer; }
.preset-enabled input { width: 15px; height: 15px; accent-color: var(--forest); }
.preset-editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 28px; padding-top: 19px; border-top: 1px solid var(--line); }

@media (max-width: 1150px) {
    .studio-grid { grid-template-columns: 1fr; }
    .preview-panel { min-height: 460px; }
    .history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .settings-grid { grid-template-columns: repeat(2, 1fr); }
    .cover-layout { grid-template-columns: 1fr; }
    .cover-form-panel { min-height: auto; }
    .cover-preview-panel { min-height: 600px; }
    .cover-history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .preset-layout { grid-template-columns: 1fr; }
    .preset-list-panel, .preset-editor-panel { min-height: auto; }
}

@media (max-width: 820px) {
    .sidebar { position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 12px 0 35px rgba(23,61,50,.12); }
    .sidebar.is-open { transform: translateX(0); }
    .mobile-close { display: block; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 25px; line-height: 1; }
    .mobile-menu { display: block; margin-right: 14px; color: var(--forest); background: transparent; border: 0; cursor: pointer; font-size: 19px; }
    .topbar { justify-content: flex-start; }
    .topbar-meta { display: none; }
    .sidebar-backdrop { display: block; position: fixed; z-index: 10; inset: 0; visibility: hidden; background: rgba(23,61,50,.22); opacity: 0; transition: opacity .25s, visibility .25s; }
    .sidebar-backdrop.is-visible { visibility: visible; opacity: 1; }
    .content-wrap { padding-top: 38px; }
    .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cover-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .auth-layout { display: block; }
    .auth-intro { display: none; }
    .auth-panel { min-height: 100vh; padding: 27px; }
    .mobile-brand { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 70px; color: var(--forest); font-size: 14px; font-weight: 700; }
    .auth-card h2 { font-size: 38px; }
    .content-wrap { padding: 34px 16px 50px; }
    .topbar { height: 65px; padding: 0 17px; }
    .topbar-breadcrumb { font-size: 9px; }
    .hero-heading, .section-heading { align-items: start; flex-direction: column; gap: 18px; margin-bottom: 27px; }
    .hero-heading h1, .section-heading h1 { font-size: 39px; }
    .hero-note { display: none; }
    .composer-panel, .preview-panel { min-height: auto; padding: 22px 18px 19px; }
    .prompt-box textarea { height: 190px; }
    .prompt-footer { align-items: start; flex-direction: column; padding: 10px 12px; }
    .form-grid { grid-template-columns: 1fr; }
    .field-group.field-wide { grid-column: auto; }
    .form-footer { align-items: start; flex-direction: column; }
    .generate-button { width: 100%; }
    .result-stage { min-height: 300px; }
    .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { min-height: 100px; padding: 16px; }
    .stat-card-wide { grid-column: 1 / -1; }
    .stat-mark { right: 15px; bottom: 15px; }
    .history-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .history-copy { padding: 10px; }
    .history-copy p { height: 50px; margin-bottom: 9px; font-size: 10px; }
    .history-copy div { flex-wrap: wrap; }
    .history-copy time { width: 100%; margin-left: 0; }
    .history-delete { opacity: 1; }
    .settings-grid { grid-template-columns: 1fr; }
    .cover-heading { align-items: start; flex-direction: column; gap: 18px; margin-bottom: 27px; }
    .cover-heading h1 { font-size: 39px; }
    .cover-badge { display: none; }
    .cover-form-panel, .cover-preview-panel { padding: 22px 18px 19px; }
    .palette-options { gap: 5px; }
    .palette-option { padding: 8px 6px; }
    .cover-form-footer, .cover-preview-footer { align-items: start; flex-direction: column; }
    .cover-form-footer .generate-button { width: 100%; }
    .cover-preview-stage { min-height: 270px; }
    .cover-preview-footer .button { width: 100%; }
    .cover-history-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .cover-history-copy { padding: 10px; }
    .preset-list-panel, .preset-editor-panel { padding: 22px 18px 19px; }
    .preset-editor-footer { align-items: start; flex-direction: column; }
    .preset-editor-footer .button { width: 100%; }
    .preset-meta span:last-child { max-width: 120px; }
}
