/* Güney Cephe: dark app shell (top main menu, left sub-menu, account area top right). */
:root {
  --bg: #0b0b0c;
  --bg-2: #101012;
  --card: #161618;
  --card-2: #1d1d20;
  --card-3: #242428;
  --line: #242428;
  --line-2: #323238;
  --text: #f3f3f4;
  --text-2: #d4d4d8;
  --muted: #9a9aa3;
  --faint: #6e6e77;
  --ok: #46d18a;
  --bad: #ff6b6b;
  --warn: #f2b84b;
  --accent: #c9a84c;
  --accent-hover: #d8b95e;
  --accent-ink: #15120a;
  --accent-soft: rgba(201, 168, 76, .14);
  --accent-line: rgba(201, 168, 76, .45);
  --radius: 18px;
  --radius-sm: 10px;
  --top-h: 64px;
  --side-w: 248px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Plus Jakarta Sans", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 14.5px; font-weight: 700; margin: 22px 0 10px; color: var(--text-2); }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
code { background: var(--card-2); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; }
pre { background: var(--bg-2); color: var(--text-2); border: 1px solid var(--line); padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
a { color: var(--accent); }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
input, select, textarea { font: inherit; font-size: 14px; font-weight: 400; color: var(--text); padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--bg-2); width: 100%; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=file] { padding: 8px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; font-size: 13px; background: var(--card-3); color: var(--text); border: 0; border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9aa3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
textarea { min-height: 130px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }

/* ---------- Buttons ---------- */
button, .btn { font: inherit; font-size: 14px; font-weight: 600; border-radius: 12px; border: 0; padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, color .15s, border-color .15s, transform .1s; }
button:active, .btn:active { transform: translateY(1px); }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:hover { background: var(--accent-hover); }
.primary:disabled { opacity: .55; cursor: wait; }
.primary.big { width: 100%; padding: 14px; font-size: 15px; border-radius: 14px; }
.secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line-2); }
.secondary:hover { background: var(--card-3); }
.danger { background: transparent; color: var(--bad); border: 1px solid rgba(255, 107, 107, .35); }
.danger:hover { background: rgba(255, 107, 107, .1); }
.link { background: none; color: var(--accent); padding: 0; font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.btn.sm, button.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.danger-text { color: var(--bad) !important; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 15px; white-space: nowrap; }
.brand img { display: block; height: 32px; width: auto; }
.brand .logo-icon { display: none; border-radius: 8px; }
.brand .tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 3px 7px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { background: var(--card); width: 100%; max-width: 420px; padding: 32px; border-radius: 22px; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.login-card .brand { margin-bottom: 26px; }
.login-card button.primary { width: 100%; margin-top: 4px; padding: 12px; }
.login-card .link { margin-top: 14px; }
.login-card.wide { max-width: 580px; }
.error { color: var(--bad); min-height: 1.2em; margin: 10px 0 0; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 24px; padding: 0 20px; background: rgba(11, 11, 12, .88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.mainnav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.mainnav button, .mainnav a { background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 10px; font-size: 14.5px; font-weight: 600; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; }
.mainnav button:hover, .mainnav a:hover { color: var(--text); background: var(--card); }
.mainnav .active { color: var(--text); background: var(--card-2); }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.balance-chip { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; padding: 4px 4px 4px 12px; }
.bc-info { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding-right: 8px; }
.bc-info .i { color: var(--accent); }
.bc-text { display: flex; flex-direction: column; line-height: 1.15; }
.bc-label { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bc-amount { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bc-amount.low { color: var(--bad); }
.balance-chip .plus { display: none; font-size: 18px; line-height: 1; }

.account { position: relative; }
.account-btn { background: transparent; color: var(--text); padding: 4px 8px 4px 4px; border-radius: 14px; border: 1px solid transparent; gap: 10px; }
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--card); border-color: var(--line-2); }
.account-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; max-width: 170px; }
.account-text .org { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-hover)); flex: none; }
.chev { width: 16px; height: 16px; color: var(--muted); }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 290px; background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; padding: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .55); display: flex; flex-direction: column; gap: 2px; }
.am-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; word-break: break-all; }
.am-switch { padding: 6px 8px 10px; margin: 0 0 4px; border-bottom: 1px solid var(--line); }
.am-item { background: transparent; color: var(--text-2); text-decoration: none; justify-content: flex-start; padding: 9px 10px; border-radius: 10px; font-weight: 500; font-size: 14px; width: 100%; }
.am-item:hover { background: var(--card-2); color: var(--text); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.sidenav { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--bg); }
.side-title { font-size: 12px; font-weight: 600; color: var(--faint); padding: 0 10px 10px; }
.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-item, .templates button { background: transparent; color: var(--text-2); justify-content: flex-start; gap: 12px; padding: 7px 10px; border-radius: 12px; font-weight: 600; font-size: 14px; text-align: left; width: 100%; }
.side-item:hover, .templates button:hover { background: var(--card); color: var(--text); }
.side-item.active, .templates button.active { background: var(--card-2); color: var(--text); }
.ico { width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
.ico .i { width: 16px; height: 16px; }
.templates button { align-items: flex-start; }
.templates .t-text { display: flex; flex-direction: column; min-width: 0; }
.templates .t-text b { font-weight: 600; }
.templates .t-text .desc { font-size: 12px; font-weight: 400; color: var(--faint); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.templates button.active .ico { box-shadow: 0 0 0 1px var(--c); }

.content { padding: 28px 32px 64px; min-width: 0; max-width: 1320px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.panel { background: var(--card); border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); }
.view > .panel + .panel, .area > .panel + .panel, .panel + h3 { margin-top: 14px; }
.panel.narrow { max-width: 640px; }
.panel-head { margin-bottom: 16px; }
.panel-head h2 { margin-bottom: 2px; }
.panel-head p { margin: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1; min-width: 140px; }
form.row.panel { margin-bottom: 16px; }
form.row.panel > label { margin-bottom: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; }

/* ---------- Generate ---------- */
.gen-layout { display: grid; grid-template-columns: minmax(320px, 430px) minmax(0, 1fr); gap: 18px; align-items: start; }
.field-note { font-weight: 600; color: var(--accent); font-size: 11.5px; margin-left: 4px; }
.cost-hint { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 12px; padding: 11px 13px; font-size: 13px; margin: 6px 0 14px; color: var(--text-2); }
.cost-hint b { color: var(--text); }
.result { min-height: 520px; display: flex; flex-direction: column; gap: 14px; background: var(--bg-2); position: sticky; top: calc(var(--top-h) + 20px); }
.result .placeholder { margin: auto; color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.big-ico { width: 44px; height: 44px; stroke-width: 1.3; }
.result img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; align-self: center; background: repeating-conic-gradient(#1c1c1f 0% 25%, #141416 0% 50%) 50% / 20px 20px; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.meta div { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-size: 12.5px; color: var(--muted); }
.meta b { display: block; color: var(--text); font-size: 15px; }
.blocked { background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .3); color: #ffb3b3; padding: 12px 14px; border-radius: 12px; }
details summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13px; }
details pre { margin-top: 8px; }
.spinner { margin: auto; text-align: center; color: var(--muted); max-width: 320px; }
.spinner::before { content: ""; display: block; width: 40px; height: 40px; margin: 0 auto 14px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; background: var(--card-2); display: block; }
.card .body { padding: 11px 13px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.card .actions { display: flex; gap: 6px; padding: 0 13px 13px; }
.card .actions .btn, .card .actions button { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
#gallery-more { margin: 18px auto; display: flex; }

/* ---------- Balance and KPI cards ---------- */
.wallet-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; margin-bottom: 16px; }
.balance-card { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; display: flex; flex-direction: column; min-height: 200px; }
.balance-card::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none; }
.balance-card .bc-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.balance-card .bc-top .i { color: var(--accent); }
.balance-card .bc-big { font-size: 40px; font-weight: 800; letter-spacing: -.02em; margin-top: auto; font-variant-numeric: tabular-nums; line-height: 1.1; }
.balance-card .bc-big.low { color: var(--bad); }
.balance-card .bc-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.balance-card .bc-foot .muted { font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.kpi .sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--card-3); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.over span { background: var(--bad); }
.ref-box { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1px dashed var(--accent-line); border-radius: 12px; padding: 10px 12px; margin: 8px 0 12px; flex-wrap: wrap; }
.ref-box code { background: none; border: 0; font-size: 17px; font-weight: 700; color: var(--accent); letter-spacing: .04em; padding: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--bg-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .02); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap td select, .table-wrap td input { padding: 5px 8px; font-size: 13px; max-width: 150px; }
.table-wrap td select { padding-right: 28px; background-position: right 6px center; }
.status-succeeded { color: var(--ok); } .status-blocked, .status-failed { color: var(--bad); }
.neg { color: var(--bad); } .pos { color: var(--ok); }
.prose p, .prose li { max-width: 760px; color: var(--text-2); }
.prose h3:first-child { margin-top: 0; }

/* ---------- Dialog, banner, misc ---------- */
dialog { border: 1px solid var(--line-2); border-radius: 20px; padding: 0; max-width: min(1100px, 96vw); max-height: 94vh; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
dialog .dlg { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
dialog img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; color: var(--text-2); font-size: 13.5px; }
label.check input { margin-top: 3px; }
/* Invoice type (corporate / individual): two pill buttons over a radio pair. */
.choice { display: flex; gap: 6px; padding: 4px; margin-bottom: 14px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; }
.choice label { flex: 1; margin: 0; cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: block; text-align: center; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.choice input:checked + span { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px 2px; margin: 4px 0 14px; }
legend { font-weight: 700; padding: 0 6px; font-size: 13px; }
.turnstile { margin: 4px 0 12px; min-height: 0; }
.banner { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }
.banner .row { align-items: center; justify-content: space-between; }
.invite-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.status-pill.ok { color: var(--text-2); }
.status-pill.ok::before { background: var(--ok); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .account-text { display: none; }
  .gen-layout { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root { --top-h: 56px; }
  .topbar { height: auto; flex-wrap: wrap; gap: 0 10px; padding: 8px 12px 0; }
  .topbar .brand .logo-full { display: none; }
  .topbar .brand .logo-icon { display: block; }
  .mainnav { order: 3; flex: 1 1 100%; overflow-x: auto; padding: 6px 0 8px; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .bc-label { display: none; }
  .balance-chip .lbl, #admin-link .lbl { display: none; }
  .balance-chip .plus { display: inline; }
  #topup-btn { width: 34px; height: 34px; padding: 0; }
  #admin-link { display: none !important; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: static; height: auto; overflow: visible; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(11, 11, 12, .92); backdrop-filter: blur(14px); }
  .side-title { display: none; }
  .side-list { flex-direction: row; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .side-list::-webkit-scrollbar { display: none; }
  .side-item, .templates button { width: auto; white-space: nowrap; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
  .ico { width: 24px; height: 24px; border-radius: 50%; }
  .templates .t-text .desc { display: none; }
  .templates button { align-items: center; }
  .content { padding: 18px 14px 48px; }
  .gen-layout, .wallet-grid { grid-template-columns: minmax(0, 1fr); }
  .result { position: static; min-height: 300px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card .body { padding: 9px 10px; }
  .card .actions { padding: 0 10px 10px; }
  h1 { font-size: 21px; }
  .balance-card .bc-big { font-size: 34px; }
  .account-menu { position: fixed; right: 10px; left: 10px; top: 56px; width: auto; }
}
.ico { font-weight: 700; font-size: 13px; }
.panel.prose.narrow { max-width: 820px; }
.empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--faint); text-align: center; }
.empty p { margin: 0 0 8px; color: var(--muted); }
.content > .error:empty { display: none; }
.row.search { flex-wrap: nowrap; }
.row.search label { margin: 0; min-width: min(360px, 60vw); }
dialog#reauth { width: min(420px, 94vw); }
@media (max-width: 900px) {
  .mainnav a.active { order: -1; }
  .row.search { flex-wrap: wrap; }
  .top-right .lbl { display: none; }
  .top-right .status-pill { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
  .top-right .status-pill::before { display: inline-block; margin-right: 6px; vertical-align: middle; }
}
