:root {
    --bg: #f1f3f6;
    --panel: #ffffff;
    --side: #2f343a;
    --side-accent: #1c9fb4;
    --side-muted: #8b949e;
    --ink: #1f2933;
    --line: #e2e6eb;
    --pill: #f7f9fb;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

/* Layout */
.app {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: var(--side);
    color: #fff;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-right: 1px solid #242a30;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}
.logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1c9fb4, #1e5a7a);
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
}
.logo-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}
.brand-title-img {
    height: 22px;
    width: auto;
    display: block;
}
.auth-brand .brand-title-img {
    height: 26px;
}
.brand-title-row {
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
}
.brand-title-text {
    font-size: 20px;
    font-weight: 700;
    color: #1f2933;
    letter-spacing: 0.2px;
    align-self: flex-end;
    margin-bottom: -6px;
}
.brand-title-text-dark {
    color: #ffffff;
}
.search {
    display: flex;
    gap: 8px;
    background: #3b4147;
    border-radius: 8px;
    padding: 8px 10px;
}
.search input {
    background: transparent;
    border: none;
    color: #fff;
    outline: none;
    width: 100%;
}
.menu { display: flex; flex-direction: column; gap: 10px; }
.group {
    background: #3a4046;
    border-radius: 8px;
    padding: 10px;
}
.group-title {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    color: #c7d0d9;
    cursor: pointer;
    font-size: 15px;
}
.group-title .arrow { transition: transform 0.2s ease; }
.group.collapsed .group-title .arrow { transform: rotate(-90deg); }
.sub {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.sub a {
    text-decoration: none;
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    display: block;
    width: 100%;
    font-size: 14px;
}
.sub a.active,
.sub a:hover { border-color: #5d6975; background: rgba(255,255,255,0.08); }
.group.collapsed .sub { display: none; }
.group .sub { display: block; }
.side-card {
    background: var(--side-accent);
    border-radius: 12px;
    padding: 14px;
    color: #e9f8fb;
}
.side-card-value { font-size: 28px; font-weight: 700; margin-top: 4px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 16px 32px 24px; }
.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 10px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.crumbs { color: #6b7280; font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-right { margin-right: 8px; }
.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--ink);
    font-weight: 600;
}
.link-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    text-decoration: none;
    color: var(--ink);
    font-size: 14px;
}
.search-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 0;
}
.search-form input[type="text"] {
    width: 180px;
}
.file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.file-row input[type="file"] {
    display: none;
}
.file-btn {
    border: 1px solid var(--line);
    background: #f7f9fb;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}
.file-name {
    font-size: 14px;
    color: #4b5563;
}
.page-chip {
    background: #2f343a;
    color: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    display: inline-block;
    min-width: 28px;
    text-align: center;
    font-size: 14px;
}
.page-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    text-decoration: none;
    color: var(--ink);
    font-size: 14px;
    min-width: 28px;
    text-align: center;
    display: inline-block;
}
.page-btn.active {
    background: #2f343a;
    color: #fff;
    border-color: #2f343a;
}

.content > section { display: grid; gap: 16px; }
.content > section > h2 { margin: 0; }
.page-title { margin-top: -10px; }
.card {
    background: var(--panel);
    border-radius: 10px;
    border: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 16px;
}
.collapsible .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.collapsible.collapsed .section-body { display: none; }
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px 16px;
}
.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.filter-row .label {
    min-width: 70px;
    font-size: 13px;
    color: #6b7280;
}
.filter-row input,
.filter-row select {
    flex: 1;
    min-width: 140px;
}
.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px 12px;
}
.group-grid label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.sort-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.sort-row .label {
    font-size: 13px;
    color: #6b7280;
}
.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
}
.card-body { padding: 16px; }
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    min-height: 36px;
}
.toolbar-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
table td form {
    margin: 0;
}
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
    background: var(--pill);
    border: 1px solid var(--line);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
}
.row-actions { display: inline-flex; gap: 8px; align-items: center; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table.compact-table th,
table.compact-table td {
    padding: 8px 10px;
    line-height: 1.2;
}
table td button,
table td .link-btn {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.1;
}
table td select {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.1;
    height: 26px;
}
th, td {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: center;
    vertical-align: middle;
}
.row-link {
    cursor: pointer;
}
.row-link:hover {
    background: #f7f9fb;
}
th {
    background: #f7f9fb;
    font-weight: 600;
    color: #4b5563;
    text-align: center;
}
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px 16px;
}

form label { display: grid; gap: 6px; margin-bottom: 12px; }
input, textarea, select {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    outline: none;
}
.form-grid {
    display: grid;
    gap: 16px;
}
.form-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.form-grid.three-col {
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    column-gap: 24px;
    row-gap: 16px;
}
.form-row-inline {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    gap: 12px;
}
.form-row-inline textarea {
    width: 100%;
}
.form-label {
    font-weight: 600;
    color: #4b5563;
    text-align: right;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}
.menu-group {
    margin-top: 16px;
}
.menu-group-title {
    font-weight: 600;
    margin: 10px 0;
}
.menu-table {
    table-layout: fixed;
}
.menu-table th,
.menu-table td {
    width: 25%;
}
.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}
.section-divider {
    height: 1px;
    background: var(--line);
    margin: 12px 0 8px;
}
.section-title {
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 4px;
}
.btn-primary {
    background: #1c9fb4;
    border: 1px solid #17899b;
    color: #fff;
}
.btn-danger {
    background: #d54c4c;
    border: 1px solid #c04343;
    color: #fff;
}
.alert-warn {
    border: 1px solid #f1c36d;
    background: #fff7e3;
    color: #8a5a11;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}
button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #1c9fb4;
    color: #fff;
    cursor: pointer;
}
button:hover { background: #17899b; }
button:disabled, .link-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Auth pages */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2f343a 0%, #1f2933 60%, #1c9fb4 100%);
}
.auth-card {
    width: min(420px, 92vw);
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.auth-card.wide { width: min(740px, 92vw); padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.auth-title { font-weight: 700; }
.auth-sub { color: #6b7280; font-size: 13px; }
.form { display: grid; gap: 8px; }
.auth-link { display: inline-block; margin-top: 10px; color: #1c9fb4; text-decoration: none; }
.auth-hero {
    width: 100%;
    margin-bottom: 14px;
}
.auth-hero img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}
.chk-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.tos-body {
    max-height: 520px;
    overflow: auto;
    white-space: pre-wrap;
    background: #f7f9fb;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(15, 23, 42, 0.4);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
[hidden] { display: none !important; }
.modal.show { display: flex; }
.modal-card {
    width: min(420px, 92vw);
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 16px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}
.modal-card.large {
    width: min(720px, 94vw);
}
.modal-header { font-weight: 700; margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.upload-loading {
    display: none;
    margin-top: 8px;
    font-size: 13px;
    color: #64748b;
}
.upload-form.is-loading .upload-loading { display: block; }
.upload-form.is-loading button[type="submit"] {
    opacity: 0.7;
    cursor: progress;
}
.ai-textarea {
    width: 100%;
    margin-top: 6px;
}
.ai-response {
    margin-top: 12px;
    padding: 12px;
    background: #f7f9fb;
    border: 1px solid var(--line);
    border-radius: 8px;
    white-space: pre-wrap;
    max-height: 360px;
    overflow: auto;
}
.ai-error {
    margin-top: 12px;
    color: #b42318;
}
.ai-loading {
    margin-top: 10px;
    padding: 10px;
    background: #eef6ff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #1e5a7a;
}
.ai-file {
    margin-top: 10px;
}
.ai-preview-toolbar {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ai-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.ai-opt-row {
    display: inline-flex;
    gap: 12px;
    align-items: center;
}
.ai-query-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}
.ai-query-actions.inline {
    margin-top: 0;
    margin-left: auto;
}
.agg-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 12px 0 4px;
}
.sortable {
    cursor: pointer;
    position: relative;
}
.sortable::after {
    content: "⇅";
    font-size: 12px;
    color: #9aa4b2;
    margin-left: 6px;
}
.sortable[data-sort-dir="asc"]::after {
    content: "↑";
    color: #1c9fb4;
}
.sortable[data-sort-dir="desc"]::after {
    content: "↓";
    color: #1c9fb4;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    gap: 16px;
    grid-auto-rows: 360px;
    max-height: calc(360px * 3 + 16px * 2);
    overflow-y: auto;
    align-content: start;
}
.dash-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}
.section-title {
    font-weight: 600;
    color: #374151;
    margin: 6px 0 8px;
}
.chart-type-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.chart-type-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    display: grid;
    gap: 8px;
    justify-items: center;
    font-weight: 600;
    color: #374151;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.chart-type-card:hover {
    border-color: #1c9fb4;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}
.chart-type-card.selected {
    border-color: #1c9fb4;
    box-shadow: 0 6px 16px rgba(28, 159, 180, 0.25);
}
.chart-type-img {
    width: 100%;
    height: 52px;
    display: grid;
    place-items: center;
    background: #f8fafc;
    border-radius: 10px;
}
.chart-type-img svg {
    width: 72px;
    height: 36px;
    stroke: #1c9fb4;
    fill: none;
    stroke-width: 4;
}
.chart-type-img rect,
.chart-type-img line {
    stroke: #1c9fb4;
    fill: none;
    stroke-width: 3;
}
.chart-type-img .hole {
    fill: #fff;
    stroke: none;
}
.chart-preview {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
    background: #f8fafc;
}
.chart-preview-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}
.chart-preview-body {
    min-height: 120px;
    display: grid;
    place-items: center;
}
.chart-preview-body svg {
    width: 100%;
    height: 120px;
    stroke: #1c9fb4;
    fill: none;
    stroke-width: 4;
}
.chart-preview-body polygon {
    fill: rgba(28, 159, 180, 0.18);
    stroke: none;
}
.chart-preview-body .hole {
    fill: #f8fafc;
    stroke: none;
}
.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
}
.preview-table th,
.preview-table td {
    border: 1px solid var(--line);
    padding: 6px 8px;
    text-align: center;
}
.preview-table td.text-left { text-align: left; }
.preview-table td.text-right { text-align: right; }
.preview-bars {
    height: 120px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    align-items: end;
    width: 100%;
}
.preview-bars span {
    display: block;
    background: #1c9fb4;
    border-radius: 8px 8px 4px 4px;
}
.preview-bars {
    height: 120px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    align-items: end;
}
.preview-bars span {
    display: block;
    background: #1c9fb4;
    border-radius: 8px 8px 4px 4px;
}
.period-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.period-row input {
    width: 80px;
}
.chart-card.dragging {
    opacity: 0.6;
    border-style: dashed;
}
.chart-card {
    grid-column: span 1;
    grid-row: span 1;
    position: relative;
}
.chart-card.span-col-2 { grid-column: span 2; }
.chart-card.span-col-3 { grid-column: span 3; }
.chart-card.span-row-2 { grid-row: span 2; }
.chart-card.span-row-3 { grid-row: span 3; }
.chart-card {
    min-height: 320px;
}
.chart-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.chart-box {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chart-box .chart-meta {
    flex: 0 0 auto;
    min-height: 18px;
}
.line-box .chart-line {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
}
.bar-box .status-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-auto-rows: minmax(34px, 1fr);
    align-content: stretch;
}
.donut-box .chart-donut-wrap {
    flex: 1 1 auto;
}
.donut-box .chart-legend {
    flex: 0 0 auto;
    max-height: 64px;
    overflow: auto;
}
.table-box {
    overflow: auto;
}
.table-box table {
    width: 100%;
}
.chart-card .chart-line {
    width: 100%;
    height: 100%;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
}
.chart-card .chart-donut-wrap {
    width: min(180px, 55%);
    height: min(180px, 55%);
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    flex: 1 1 auto;
    max-width: 100%;
    max-height: 55%;
}
.chart-card .chart-donut {
    width: 100%;
    height: 100%;
}
.chart-meta { color: #6b7280; font-size: 12px; }
.chart-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-header > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-header .chart-actions form {
    margin: 0;
}
.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 4px 8px;
    cursor: pointer;
}
.icon-btn:hover {
    border-color: #1c9fb4;
}
.resize-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    right: 6px;
    bottom: 6px;
    cursor: se-resize;
    border-right: 2px solid #9aa4b2;
    border-bottom: 2px solid #9aa4b2;
}
.chart-card.resizing {
    border-style: dashed;
}
.chart-size-form {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.chart-size-form label {
    display: flex;
    align-items: center;
    gap: 4px;
}
.chart-size-form select {
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #fff;
}
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    color: #4b5563;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-blue { background: #1c9fb4; }
.dot-teal { background: #0ea5a4; }
.dot-purple { background: #7c3aed; }
.dot-orange { background: #f97316; }
.chart-line { width: 100%; height: 100%; fill: none; stroke: #1c9fb4; stroke-width: 3; }
.chart-line-fill { fill: rgba(28, 159, 180, 0.18); stroke: none; }
.chart-bar { width: 100%; height: 140px; fill: #1c9fb4; }
.chart-bar rect { rx: 6; }
.chart-donut-wrap { position: relative; }
.chart-donut { transform: rotate(-90deg); }
.donut-bg { fill: none; stroke: #e5e7eb; stroke-width: 16; }
.donut-slice { fill: none; stroke-width: 16; stroke-linecap: round; }
.slice-a { stroke: #1c9fb4; stroke-dasharray: 180 276; }
.slice-b { stroke: #7c3aed; stroke-dasharray: 60 276; stroke-dashoffset: -180; }
.slice-c { stroke: #f97316; stroke-dasharray: 36 276; stroke-dashoffset: -240; }
.donut-center {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
}
.donut-value { font-weight: 700; font-size: 18px; }
.donut-label { font-size: 12px; color: #6b7280; }
.mini-kpi { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.kpi-label { font-size: 12px; color: #6b7280; }
.kpi-value { font-size: 20px; font-weight: 700; }
.kpi-sub { font-size: 12px; color: #0f766e; }
.rank-list { display: grid; gap: 8px; }
.rank-item {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.rank-no {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1c9fb4;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 12px;
}
.rank-name { font-weight: 600; font-size: 13px; }
.rank-val { color: #6b7280; font-size: 12px; }
.stack-bar {
    display: flex;
    border-radius: 10px;
    overflow: hidden;
    height: 34px;
    border: 1px solid var(--line);
}
.stack {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    white-space: nowrap;
}
.stack.a { background: #1c9fb4; }
.stack.b { background: #0ea5a4; }
.stack.c { background: #7c3aed; }
.stack.d { background: #f97316; }
.status-list { display: grid; gap: 10px; }
.status-item {
    display: grid;
    grid-template-columns: 72px 1fr 90px;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
    white-space: nowrap;
}
.status-bar {
    position: relative;
    height: 14px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}
.status-bar em {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #1c9fb4;
    border-radius: 999px;
}
.chart-area { width: 100%; height: 120px; fill: none; stroke: #0ea5a4; stroke-width: 3; }
.chart-area-fill { fill: rgba(14, 165, 164, 0.18); stroke: none; }
.spark-grid { display: grid; gap: 10px; }
.spark {
    display: grid;
    grid-template-columns: 60px 1fr;
    align-items: center;
    gap: 10px;
}
.spark-label { font-size: 12px; color: #6b7280; }
.spark svg { width: 100%; height: 40px; }
.spark polyline { fill: none; stroke: #1c9fb4; stroke-width: 2; }
.ai-preview {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #f7f9fb;
}
.ai-preview img,
.ai-preview iframe {
    width: 100%;
    max-height: 420px;
    border: none;
    display: block;
}
.ai-preview.size-sm img,
.ai-preview.size-sm iframe { max-height: 260px; }
.ai-preview.size-md img,
.ai-preview.size-md iframe { max-height: 420px; }
.ai-preview.size-lg img,
.ai-preview.size-lg iframe { max-height: 640px; }
.ai-preview.zoom {
    max-height: 80vh;
    overflow: auto;
}
.ai-pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

@media (max-width: 980px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: sticky; top: 0; }
    .chart-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); max-height: none; }
}
