:root {
  --bg: #0a0c13;
  --bg-2: #0f1220;
  --panel: #141827;
  --panel-2: #1a1f33;
  --line: #252b44;
  --line-2: #323a5a;
  --text: #e8eaf4;
  --muted: #98a0c2;
  --dim: #6b7396;
  --accent: #7c5cff;
  --accent-2: #4f8cff;
  --grad: linear-gradient(135deg, #7c5cff 0%, #4f8cff 100%);
  --ok: #2ecc8f;
  --warn: #f5b84a;
  --danger: #ff5d73;
  --danger-bg: rgba(255, 93, 115, .12);
  --radius: 12px;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(124, 92, 255, .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3150; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- giriş ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; overflow: auto; height: 100vh;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, .22), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(79, 140, 255, .18), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: rgba(20, 24, 39, .82); backdrop-filter: blur(18px); border: 1px solid var(--line);
  border-radius: 20px; padding: 34px 30px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(124, 92, 255, .35); }
.brand-logo svg { width: 20px; height: 20px; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.steps { display: flex; gap: 6px; margin: 26px 0 22px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.steps span.on { background: var(--grad); }
.auth h1 { font-size: 22px; margin: 0 0 6px; }
.auth p.lead { color: var(--muted); margin: 0 0 22px; }
.auth .foot { margin-top: 22px; font-size: 12px; color: var(--dim); display: flex; gap: 8px; align-items: flex-start; }
.auth .foot svg { flex: none; width: 14px; height: 14px; margin-top: 2px; }
.bio { display: grid; place-items: center; margin: 6px 0 22px; }
.bio-ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle, rgba(124, 92, 255, .25), rgba(124, 92, 255, .02) 70%); }
.bio-ring::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(124, 92, 255, .5); animation: pulse 2s ease-out infinite; }
.bio-ring svg { width: 58px; height: 58px; color: #b9a8ff; }
.bio-ring.ok svg { color: var(--ok); }
.bio-ring.ok::before { border-color: var(--ok); animation: none; }
@keyframes pulse { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.sent { text-align: center; }
.sent .big { font-size: 44px; }

/* ---------- form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .lbl { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.input, .select, .textarea { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; transition: border .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .2); }
.textarea { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.hint { font-size: 12px; color: var(--dim); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--panel-2);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; transition: transform .05s, background .15s, border .15s; }
.btn:hover { background: #222844; border-color: #3c4570; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(124, 92, 255, .28); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger-bg); border-color: rgba(255, 93, 115, .4); color: #ff8b9b; }
.btn.danger:hover { background: rgba(255, 93, 115, .2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn.block { width: 100%; padding: 12px; font-size: 14px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.err { background: var(--danger-bg); border: 1px solid rgba(255, 93, 115, .35); color: #ffb3be; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.note { background: rgba(79, 140, 255, .1); border: 1px solid rgba(79, 140, 255, .3); color: #b8cdff; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }

/* ---------- uygulama iskeleti ---------- */
.shell { display: grid; grid-template-columns: 280px 1fr; height: 100vh; }
.side { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.side-body { flex: 1; overflow: auto; padding: 12px 10px; }
.side-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 10px 10px 6px; display: flex; align-items: center; justify-content: space-between; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 13px; min-width: 0; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.on { background: rgba(124, 92, 255, .14); color: #fff; }
.nav-item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.nav-item .c { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.nav-item svg { width: 15px; height: 15px; flex: none; opacity: .8; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.side-search { margin: 4px 4px 8px; }
.side-search .input { padding: 7px 10px; font-size: 13px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: rgba(10, 12, 19, .7); backdrop-filter: blur(10px); min-height: 58px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; flex: 1; flex-wrap: wrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--dim); }
.crumbs b { color: var(--text); font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; }
.idle { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.menu-btn { display: none; }
.content { flex: 1; overflow: auto; padding: 22px; min-height: 0; }
.content.flush { padding: 0; display: flex; flex-direction: column; overflow: hidden; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.card h3 { margin: 0; font-size: 15px; }
.proj-card { position: relative; overflow: hidden; }
.proj-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c, var(--accent)); }
.proj-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.proj-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 16px; }
.proj-head small { color: var(--muted); font-size: 12px; display: block; }
.db-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); margin-top: 8px; cursor: pointer; transition: border .15s, transform .1s; }
.db-row:hover { border-color: var(--accent); transform: translateX(2px); }
.db-row svg { width: 18px; height: 18px; color: var(--accent-2); flex: none; }
.db-row .n { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.db-row .l { font-size: 12px; color: var(--muted); }
.db-row .m { margin-left: auto; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat .k { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

.tbl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tbl-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: border .15s; min-width: 0; }
.tbl-card:hover { border-color: var(--accent); }
.tbl-card .n { font-family: var(--mono); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-card .m { font-size: 12px; color: var(--muted); display: flex; gap: 10px; margin-top: 4px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.badge.pk { background: rgba(245, 184, 74, .14); color: #f8c96e; border-color: rgba(245, 184, 74, .35); }
.badge.fk { background: rgba(79, 140, 255, .14); color: #8db4ff; border-color: rgba(79, 140, 255, .35); }
.badge.ok { background: rgba(46, 204, 143, .12); color: #6be3b2; border-color: rgba(46, 204, 143, .35); }
.badge.danger { background: var(--danger-bg); color: #ff9aa8; border-color: rgba(255, 93, 115, .35); }
.badge.acc { background: rgba(124, 92, 255, .16); color: #c3b4ff; border-color: rgba(124, 92, 255, .4); }

/* ---------- tablo görünümü ---------- */
.tabs { display: flex; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--bg); }
.tab { padding: 12px 14px; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--text); }
.tab.on { color: #fff; border-bottom-color: var(--accent); }
.tab svg { width: 15px; height: 15px; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .input, .toolbar .select { padding: 7px 10px; font-size: 13px; width: auto; }
.search-box { position: relative; flex: 1; min-width: 180px; max-width: 420px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--dim); }
.search-box .input { padding-left: 32px; width: 100%; }
.grid-wrap { flex: 1; overflow: auto; min-height: 0; }
table.data { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); border-right: 1px solid rgba(37, 43, 68, .6); text-align: left; max-width: 360px; }
table.data th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-weight: 600; white-space: nowrap; user-select: none; }
table.data th .ty { display: block; font-weight: 500; font-size: 10.5px; color: var(--dim); font-family: var(--mono); }
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { background: var(--panel-2); }
table.data th .arrow { color: var(--accent); margin-left: 4px; }
table.data td { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.data tbody tr:hover td { background: rgba(124, 92, 255, .05); }
table.data tbody tr.sel td { background: rgba(124, 92, 255, .12); }
table.data td.editable { cursor: text; }
table.data td.editing { padding: 0; overflow: visible; }
table.data td.editing input { width: 100%; min-width: 160px; border: 2px solid var(--accent); background: var(--bg); padding: 6px 10px; outline: none; font: inherit; border-radius: 0; }
table.data .cb { width: 38px; text-align: center; position: sticky; left: 0; z-index: 1; background: var(--bg); }
table.data th.cb { z-index: 3; background: var(--panel); }
table.data .act { width: 1%; position: sticky; right: 0; background: var(--bg); text-align: right; }
table.data th.act { background: var(--panel); }
.null { color: var(--dim); font-style: italic; font-size: 11px; }
.bool-t { color: var(--ok); } .bool-f { color: var(--danger); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .sp { flex: 1; }
.pager .select { width: auto; padding: 5px 8px; font-size: 13px; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--dim); margin-bottom: 8px; }

.struct { padding: 22px; overflow: auto; flex: 1; }
.struct h2 { font-size: 15px; margin: 26px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.struct h2:first-child { margin-top: 0; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.plain th, table.plain td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.plain th { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 700; background: var(--panel-2); }
table.plain tr:last-child td { border-bottom: 0; }
table.plain td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }
table.plain td .def { color: var(--muted); font-family: var(--mono); font-size: 12px; word-break: break-all; }
.actions { display: flex; gap: 4px; justify-content: flex-end; }

.sql-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sql-editor { padding: 16px 22px; border-bottom: 1px solid var(--line); }
.sql-editor .textarea { min-height: 150px; font-size: 13.5px; line-height: 1.55; background: #080a11; }
.sql-meta { font-size: 12px; color: var(--muted); padding: 8px 22px; border-bottom: 1px solid var(--line); }

/* ---------- çekmece / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4, 5, 10, .6); backdrop-filter: blur(3px); z-index: 50; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 51; display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; z-index: 51; padding: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: pop .15s ease-out; }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
@keyframes pop { from { transform: translate(-50%, -48%) scale(.98); opacity: 0; } }
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal .sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.vfield { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--bg-2); }
.vfield-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.vfield-head .n { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.vfield-head .t { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.vfield-head .sp { flex: 1; }
.vfield-head .check { font-size: 12px; color: var(--muted); }
.vfield .input:disabled, .vfield .textarea:disabled { opacity: .45; }
.col-rows { display: flex; flex-direction: column; gap: 8px; }
.col-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto auto auto auto; gap: 8px; align-items: center; }
.col-row .input { padding: 8px 10px; font-size: 13px; }
.col-row .check { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; font-size: 13px; }
.chip.on { border-color: var(--accent); background: rgba(124, 92, 255, .15); }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--ok); padding: 10px 14px; border-radius: 10px; font-size: 13px; max-width: 380px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); animation: slide .2s; }
.toast.err { border-left-color: var(--danger); }

.log-row { display: grid; grid-template-columns: 150px 180px 1fr; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.log-row .d { color: var(--muted); font-size: 12px; font-family: var(--mono); word-break: break-word; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .top, .toolbar, .tabs, .pager, .sql-editor { padding-left: 16px; padding-right: 16px; }
  .struct { padding: 16px; }
  .col-row { grid-template-columns: 1fr 1fr; }
  .log-row { grid-template-columns: 1fr; gap: 2px; }
  .user-chip .who, .idle { display: none; }
}
