:root {
    --bg: #f4f5f9;
    --surface: #ffffff;
    --ink: #161a2e;
    --muted: #667085;
    --line: #e3e6ee;
    --brand: #3d4db3;
    --brand-ink: #2c3a94;
    --brand-soft: #eef0fb;
    --ok: #17734a;
    --ok-soft: #e4f4ec;
    --warn: #9a5b00;
    --warn-soft: #fff3dc;
    --bad: #b3261e;
    --bad-soft: #fdecea;
    --info: #1f5fa8;
    --info-soft: #e7f0fb;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(22, 26, 46, .05), 0 4px 16px rgba(22, 26, 46, .04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 16px; }
h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 10px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--brand-soft); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
small { color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.block { display: block; }

/* Yerleşim */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    background: var(--surface); border-right: 1px solid var(--line);
    padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: block; padding: 0 8px; }
.brand img { width: 112px; height: auto; display: block; mix-blend-mode: multiply; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
    color: #3b4257; font-weight: 500;
}
.sidebar nav a:hover { background: var(--bg); text-decoration: none; }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.sidebar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.me { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 6px 0; display: grid; gap: 8px; }
.me-name { display: flex; align-items: center; gap: 10px; color: inherit; }
.me-name:hover { text-decoration: none; }
.me-name strong, .me-name small { display: block; line-height: 1.3; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; }
.credit { font-size: 11.5px; line-height: 1.4; color: #8b93a7; margin: 0; padding: 0 6px; }
.login-card .credit { margin-top: 22px; padding: 0; }
.main { padding: 28px 36px 60px; max-width: 1240px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.back { font-size: 13px; color: var(--muted); display: inline-block; margin-bottom: 6px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }

/* Bileşenler */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2 { margin-bottom: 12px; }
.card-head { margin-bottom: 14px; }
.card-head h2 { margin-bottom: 2px; }
.narrow { max-width: 520px; }
.table-card { padding: 0; overflow-x: auto; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.columns > .card { margin-bottom: 0; }

.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 9px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; line-height: 1.3;
}
.btn:hover { border-color: #c9cede; text-decoration: none; }
.btn small { color: inherit; opacity: .7; font-weight: 400; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); }
.btn-block { width: 100%; justify-content: center; padding: 10px 14px; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: #bfe3d0; }
.flash-error { background: var(--bad-soft); color: var(--bad); border-color: #f5c6c2; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge-lg { padding: 6px 14px; font-size: 13.5px; }
.badge-queued { background: #eef0f4; color: #4a5268; }
.badge-running { background: var(--info-soft); color: var(--info); }
.badge-done { background: var(--ok-soft); color: var(--ok); }
.badge-failed { background: var(--bad-soft); color: var(--bad); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: #3b4257; background: var(--surface); white-space: nowrap; }
.tag-instagram { color: #a02c6b; border-color: #efc9dd; background: #fcf1f6; }
.tag-website { color: var(--brand-ink); border-color: #cfd5f3; background: var(--brand-soft); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { font-size: 24px; letter-spacing: -.01em; }

/* Tablolar */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table td small { display: block; }
.row-link { color: inherit; display: block; }
.row-link strong { display: block; }
.row-link:hover { text-decoration: none; }
.row-link:hover strong { color: var(--brand); }
.row-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.row-actions form { margin: 0; }
.inline-form summary { list-style: none; cursor: pointer; }
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form form { display: flex; gap: 8px; margin-top: 8px; }

.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1 1 260px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 6px; }
.empty { text-align: center; padding: 64px 20px; background: var(--surface); border: 1px dashed #cfd4e2; border-radius: var(--radius); }
.empty h1, .empty h2 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin-bottom: 18px; }

/* Formlar */
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #cfd4e2; border-radius: 9px; background: #fff; color: var(--ink); font: inherit;
}
.filters select, .filters input { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
textarea { resize: vertical; }
label { display: grid; gap: 6px; font-weight: 550; font-size: 14px; }
label small { font-weight: 400; }
.stack { display: grid; gap: 16px; }
.stack > *, .logo-row > * { min-width: 0; }
input[type=file] { max-width: 100%; font: inherit; font-size: 13px; }
.stack h2 { margin: 6px 0 -4px; }
.stack h2:first-of-type { margin-top: 0; }
.form { display: grid; gap: 20px; max-width: 860px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.span-2 { grid-column: 1 / -1; }
.field-lg input { padding: 12px 14px; font-size: 16px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 550; font-size: 14px; padding: 0; margin-bottom: 8px; }
.type-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-picker legend { grid-column: 1 / -1; }
.type-option { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid #cfd4e2; border-radius: 10px; cursor: pointer; font-weight: 400; }
.type-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.type-option input { margin-top: 4px; accent-color: var(--brand); }
.type-option strong, .type-option small { display: block; }
.optional { border-top: 1px solid var(--line); padding-top: 16px; }
.optional summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.form-foot p { font-size: 13.5px; max-width: 520px; }
[data-hidden], [hidden] { display: none !important; }

/* Analiz detayı */
.progress-card { border-color: #cfd5f3; }
.progress-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.bar { height: 10px; background: var(--brand-soft); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .6s ease; }
.decision { border-left: 4px solid var(--brand); }
.decision p { font-size: 15.5px; }
.reports { display: grid; gap: 14px; margin-bottom: 18px; }
.report { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 0; flex-wrap: wrap; }
.report h2 { margin-bottom: 2px; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 550; cursor: pointer; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab.active small { color: #c9cde0; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.previews a { position: relative; display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.previews a:hover { border-color: var(--brand); }
.previews img { width: 100%; height: auto; display: block; }
.previews span { position: absolute; right: 6px; bottom: 6px; background: rgba(22, 26, 46, .78); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.files li:last-child { border-bottom: 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.shots a { display: block; color: var(--muted); font-size: 12px; }
.shots img { width: 100%; height: 84px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 8px; display: block; margin-bottom: 4px; }
.log { list-style: none; margin: 0 0 16px; padding: 0; max-height: 340px; overflow-y: auto; font-size: 13.5px; }
.log li { display: grid; grid-template-columns: 62px 1fr; gap: 8px; padding: 5px 0; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-warn span { color: var(--warn); }
.log-error span { color: var(--bad); font-weight: 550; }
.log-empty { color: var(--muted); grid-template-columns: 1fr !important; }
.meta { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; border-top: 1px solid var(--line); padding-top: 14px; font-size: 13.5px; }
.meta:empty { display: none; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

/* Ayarlar */
.logo-row { display: flex; gap: 18px; align-items: center; }
.logo-row img { width: 120px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.checks { list-style: none; margin: 0 0 14px; padding: 0; }
.checks li { padding: 10px 0 10px 26px; border-bottom: 1px solid var(--line); position: relative; }
.checks li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 10px; height: 10px; border-radius: 50%; }
.checks .ok::before { background: #2aa56d; }
.checks .warn::before { background: #e0a020; }
.checks .bad::before { background: #d9453c; }
.checks span { display: block; font-weight: 550; }
.checks small { word-break: break-all; }

/* Giriş */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 34px 32px; width: 100%; max-width: 400px; text-align: center; }
.login-card h1 { font-size: 20px; }
.login-card form { text-align: left; margin-top: 22px; }
.login-card .flash { margin: 18px 0 0; text-align: left; }
.login-logo { width: 130px; margin-bottom: 14px; mix-blend-mode: multiply; }

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 12px 16px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand img { width: 84px; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
    .me { margin: 0; border: 0; padding: 0; grid-auto-flow: column; align-items: center; }
    .me-name span:last-child { display: none; }
    .sidebar .credit { flex-basis: 100%; }
    .main { padding: 20px 16px 48px; }
    .grid-2, .type-picker { grid-template-columns: 1fr; }
    .form-foot { flex-direction: column; align-items: stretch; }
    .meta { grid-template-columns: 1fr; }
    .meta dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .bar span { transition: none; }
}
