:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6573;
  --line: #dfe3e8;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --accent-soft: #e6f4f2;
  --danger: #b42318;
  --red: #dc2626;
  --orange: #f59e0b;
  --blue: #2563eb;
  --plate: #ffffff;
  --shape: #1f2937;
  --grid: #eef0f3;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --text: #e8eaee;
    --muted: #9aa3b2;
    --line: #2d323b;
    --accent: #2dd4bf;
    --accent-text: #06201d;
    --accent-soft: #123330;
    --danger: #f97066;
    --plate: #23272f;
    --shape: #e5e7eb;
    --grid: #2a2f38;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 20px 16px; }
a { color: var(--accent); }
h1, h2 { line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.red { color: var(--red); } .orange { color: var(--orange); } .blue { color: var(--blue); }

/* Üst çubuk */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand span { font-weight: 500; color: var(--muted); }
.brand svg { width: 22px; height: 22px; fill: var(--accent); }
nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
nav a { color: var(--muted); text-decoration: none; }
nav a.active { color: var(--text); font-weight: 600; }
.chip { font-size: .8rem; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--text); white-space: nowrap; }
.chip.full { background: #fde8e7; color: #8a1c12; }

/* Form öğeleri */
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
label small { font-weight: 400; color: var(--muted); }
input[type=email], input[type=password], input[type=number], input:not([type]), select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, .drop:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
label.check input { margin-top: 3px; flex: none; }
label output { font-weight: 400; color: var(--muted); margin-left: 4px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0; margin-bottom: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { margin: 0; font-size: .82rem; color: var(--muted); }
details summary { cursor: pointer; font-weight: 600; font-size: .9rem; margin-bottom: 10px; }

.btn {
  font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.big { padding: 12px 16px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; }
nav button.link { color: var(--muted); }
button.icon {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 1.1rem; cursor: pointer; line-height: 1;
}
.error { color: var(--danger); margin: 0; min-height: 0; }
.error:empty, .msg:empty { display: none; }
.error.big { margin-top: 12px; padding: 10px 14px; border: 1px solid var(--danger); border-radius: 8px; }
.msg { margin: 0; color: var(--accent); }
.msg.bad { color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* Giriş */
.auth { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; padding-top: 40px; }
.auth h1 { font-size: 1.9rem; margin: 0 0 16px; }
.checks { padding-left: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  font: inherit; font-weight: 600; background: none; border: 0; padding: 8px 12px; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected=true] { color: var(--text); border-color: var(--accent); }

/* Dönüştürücü */
.studio { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel form > fieldset + fieldset, .panel details { border-top: 1px solid var(--line); padding-top: 14px; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 400; color: var(--muted);
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop b { color: var(--accent); }
#thumb { max-width: 100%; max-height: 120px; object-fit: contain; background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 50% / 12px 12px; border-radius: 4px; }
#file-info { margin: -6px 0 0; word-break: break-all; }

.work { min-width: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.layers { display: flex; gap: 8px; flex-wrap: wrap; }
.layer {
  flex-direction: row; align-items: center; gap: 6px; font-weight: 400; font-size: .85rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; cursor: pointer;
}
.layer b { font-variant-numeric: tabular-nums; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.red { background: var(--red); } .sw.orange { background: var(--orange); } .sw.blue { background: var(--blue); }
.zoom { display: flex; gap: 6px; }

.stage {
  position: relative; height: min(68vh, 680px); min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius);
  background-color: var(--plate); overflow: hidden; touch-action: none; cursor: grab; color: var(--shape);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 20px 20px;
}
.stage.dark { --plate: #1b1e24; --grid: #262a32; --shape: #f3f4f6; }
.stage.light { --plate: #ffffff; --grid: #eef0f3; --shape: #1f2937; }
.stage.dragging { cursor: grabbing; }
.stage > svg { width: 100%; height: 100%; display: block; }
.stage.hide-ince #risk-ince, .stage.hide-ince #isaret-ince,
.stage.hide-bosluk #risk-bosluk, .stage.hide-bosluk #isaret-bosluk,
.stage.hide-duzeltilen #duzeltilen, .stage.hide-duzeltilen #isaret-duzeltilen { display: none; }
.placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 16px; }
.placeholder p { margin: 2px; }
.busy {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: color-mix(in srgb, var(--plate) 75%, transparent); font-weight: 600;
}
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.result { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.size { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.warnings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.warnings li { padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--orange); font-size: .9rem; }
.warnings li.ok { border-left-color: var(--accent); }

/* Hesap */
.account { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.card.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

.foot { text-align: center; padding: 16px; }

/* KVKK sayfası */
.doc { max-width: 720px; }
.notice { padding: 10px 14px; border: 1px solid var(--orange); border-radius: 8px; background: color-mix(in srgb, var(--orange) 12%, transparent); }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; gap: 20px; padding-top: 8px; }
  .auth h1 { font-size: 1.5rem; }
  .stage { height: 60vh; }
}
@media (max-width: 480px) {
  .row2 { grid-template-columns: 1fr; }
  nav { gap: 10px; font-size: .9rem; }
}

/* ---------- Yönetim paneli ---------- */
.tag { font-style: normal; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--text); }
.admin { display: flex; flex-direction: column; gap: 16px; }
.admin .tabs { margin-bottom: 0; overflow-x: auto; }
.stack-l { display: flex; flex-direction: column; gap: 16px; }
h3 { font-size: .95rem; margin: 0 0 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 0; flex: 1 1 160px; }
.filters .btn { flex: none; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { font-size: .82rem; color: var(--muted); }
.tile-value { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile-sub { font-size: .8rem; color: var(--muted); }

.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); }
.chart .gridline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .baseline { stroke: var(--muted); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }
.chart .hit.on { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.chart-tip {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  background: var(--text); color: var(--surface); font-size: .8rem; padding: 4px 8px; border-radius: 6px;
}

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--surface); }
.card table.grid, .sheet table.grid { background: transparent; }
table.grid th { text-align: left; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid.clickable tbody tr[tabindex] { cursor: pointer; }
table.grid.clickable tbody tr[tabindex]:hover, table.grid.clickable tbody tr[tabindex]:focus-visible { background: var(--accent-soft); outline: none; }
details table.grid { margin-top: 8px; max-width: 320px; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--line); color: var(--text); white-space: nowrap; }
.badge.ok { background: #dcfce7; color: #14532d; }
.badge.bad { background: #fee2e2; color: #7f1d1d; }
.badge.accent { background: var(--accent-soft); color: var(--text); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pager span { margin-right: auto; }

dialog.sheet {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
}
dialog.sheet.narrow { width: min(520px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-head h2 { margin: 0; word-break: break-all; }
.sheet-body { padding: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) {
  .badge.ok { background: #14532d; color: #dcfce7; }
  .badge.bad { background: #7f1d1d; color: #fee2e2; }
  .chip.full { background: #7f1d1d; color: #fee2e2; }
}

/* Planlar (Hesabım) */
.plan-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.plan.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-name { font-weight: 700; }
.plan-price { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-feats { margin: 4px 0; padding-left: 18px; font-size: .85rem; color: var(--muted); flex: 1; }
.plan .btn { width: 100%; }

/* ---------- Ürünler, yazı, 3D, geçmiş ---------- */
.src-tabs { margin-bottom: 0; }
textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%; resize: vertical; min-height: 72px;
}
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.products button {
  font: inherit; font-size: .8rem; line-height: 1.2; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer;
}
.products button[aria-checked=true] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.products button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.p-icon { font-size: 1.2rem; line-height: 1; color: var(--accent); }
input[type=color] { width: 100%; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }

.view-tabs { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-tabs button { font: inherit; font-weight: 600; font-size: .85rem; padding: 6px 14px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; }
.view-tabs button[aria-selected=true] { background: var(--accent); color: var(--accent-text); }
.view-tabs button:disabled { opacity: .45; cursor: not-allowed; }
.toolbar .layers { flex: 1; }
.stage-wrap { position: relative; }
.stage3d { cursor: grab; background-image: none; }
.stage3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.dl-row { display: flex; gap: 8px; flex-wrap: wrap; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.palette:empty { display: none; }
.swatch { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-variant-numeric: tabular-nums; }
.swatch .dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgb(0 0 0 / .2); display: inline-block; }

.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--danger); }
.page-title { font-size: 1.4rem; margin: 0; }
.history { display: flex; flex-direction: column; gap: 14px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.h-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.h-thumb { aspect-ratio: 4 / 3; background: var(--plate); color: var(--shape); display: flex; align-items: center; justify-content: center; padding: 10px; border-bottom: 1px solid var(--line); }
.h-thumb svg { width: 100%; height: 100%; }
.h-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.h-name { font-weight: 600; word-break: break-word; }
.h-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.h-actions .btn { padding: 5px 10px; font-size: .85rem; }
@media (max-width: 480px) { .products { grid-template-columns: repeat(2, 1fr); } }
