:root {
  --black: #0a0a0a; --ink: #111; --g9: #2a2a2a; --g7: #555; --g5: #8a8a8a; --g3: #d4d4d4; --g2: #e8e8e8; --g1: #f4f4f4;
  --white: #fff; --line: #e6e6e6; --r: 14px;
  --font: 'Inter', system-ui, sans-serif; --display: 'Space Grotesk', 'Inter', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--ink); background: var(--g1); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; }
svg { display: block; }
.icon-sm { width: 18px; height: 18px; flex: none; }
.icon-xs { width: 14px; height: 14px; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; }
.muted { color: var(--g7); }
.small { font-size: 12.5px; }
small { color: var(--g5); }
.err { color: #b42318; display: block; }

/* Kabuk */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--black); color: #cfcfcf; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--white); font-family: var(--display); font-weight: 700; font-size: 16px; padding: 0 6px; }
.brand small { display: block; font-family: var(--font); font-weight: 500; font-size: 11.5px; color: var(--g5); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--white); color: var(--black); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 18px; }
.brand.big { color: var(--ink); margin-bottom: 6px; }
.brand.big .brand-mark { background: var(--black); color: var(--white); }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.08); color: var(--white); }
.side nav a.active { background: var(--white); color: var(--black); }
.side-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid #222; padding-top: 12px; }
.side-foot a, .side-foot button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; width: 100%; text-align: left; }
.side-foot a:hover, .side-foot button:hover { background: rgba(255,255,255,.08); color: var(--white); }
.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 16px 28px; background: rgba(244,244,244,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 22px; }
.menu-btn { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); cursor: pointer; place-items: center; }
.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; }

/* Kartlar */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head a { font-weight: 600; font-size: 13px; text-decoration: none; }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { margin-bottom: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2.tight { gap: 12px; }
.grid-side { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
.span-2 { grid-column: 1 / -1; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; transition: border-color .2s, transform .2s; }
a.stat:hover { border-color: var(--black); transform: translateY(-2px); }
.stat span:not(.stat-ic) { color: var(--g7); font-size: 13px; }
.stat strong { font-family: var(--display); font-size: 26px; }
.stat-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--g1); margin-bottom: 6px; }
.stat.dark { background: var(--black); color: var(--white); border-color: var(--black); }
.stat.dark span:not(.stat-ic) { color: #a5a5a5; }
.stat.dark .stat-ic { background: rgba(255,255,255,.1); }

/* Tablo */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--g5); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.dim td { opacity: .5; }
.table.kv td:first-child { color: var(--g7); width: 140px; }
.table .actions { white-space: nowrap; }
.table.products input.num { width: 90px; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st-pending { background: #fff5e6; color: #8a5300; }
.st-paid { background: var(--g1); color: var(--ink); }
.st-done { background: var(--black); color: var(--white); }
.st-cancel { background: #fff1f1; color: #9b1c1c; }

/* Form */
.form { display: flex; flex-direction: column; gap: 12px; }
.form.grid-2 { display: grid; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
label small { font-weight: 400; }
input, select, textarea { font: inherit; font-weight: 400; padding: 9px 12px; border: 1px solid var(--g3); border-radius: 10px; background: var(--white); color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--black); box-shadow: 0 0 0 3px rgba(0,0,0,.07); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--black); padding: 0; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; }
legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.checks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 220px; overflow: auto; }
.chk { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-radius: 10px 0 0 10px; }
.input-suffix em { font-style: normal; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--g3); border-left: 0; border-radius: 0 10px 10px 0; background: var(--g1); font-weight: 400; color: var(--g7); white-space: nowrap; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
form.inline { display: inline-block; margin: 8px 6px 0 0; }
.table form.inline { margin: 0 4px 0 0; }
.search { display: flex; gap: 6px; }
.search input { width: 240px; }
details.more { margin-top: 12px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--g7); }
details.more .form { margin-top: 10px; }
.danger-zone { margin-top: 14px !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--g3); background: var(--white); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--black); }
.btn-dark { background: var(--black); color: var(--white); border-color: var(--black); }
.btn-dark:hover { background: var(--g9); }
.btn-danger { color: #9b1c1c; border-color: #f0c4c4; }
.btn-danger:hover { background: #fff1f1; border-color: #9b1c1c; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.alert { padding: 11px 14px; border-radius: 12px; font-weight: 500; }
.alert-success { background: var(--black); color: var(--white); }
.alert-error { background: #fff1f1; color: #9b1c1c; border: 1px solid #f5c2c2; }
.alert-info { background: var(--white); border: 1px solid var(--line); }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--g1); }
.checks li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.checks li.ok span { background: var(--black); color: var(--white); }
.checks li.bad span { background: #f5a623; color: var(--white); }
.checks li a { margin-left: auto; font-weight: 600; font-size: 13px; }

.steps-box { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--g1); }
.steps-box ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.code-box { display: inline-flex; align-items: baseline; gap: 14px; padding: 16px 22px; border-radius: 14px; background: var(--black); color: var(--white); }
.code-box .mono { font-size: 34px; font-weight: 700; letter-spacing: .2em; }
.code-box small { color: #a5a5a5; }
.mail { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.mail summary { cursor: pointer; padding: 10px 14px; display: flex; flex-direction: column; }
.mail pre { margin: 0; padding: 12px 14px; border-top: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; font-size: 12.5px; max-height: 360px; overflow: auto; background: var(--g1); border-radius: 0 0 12px 12px; }

.order-rows { display: grid; gap: 8px; }
.order-row { border: 1px solid var(--line); border-radius: 12px; }
.order-row[open] { border-color: var(--black); }
.order-row summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 100px 1.6fr 1fr 120px auto; gap: 12px; align-items: center; padding: 10px 14px; }
.order-row summary::-webkit-details-marker { display: none; }
.order-row summary span { display: flex; flex-direction: column; min-width: 0; }
.order-row .form { padding: 4px 14px 14px; }
.pager { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pager a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; }
.pager a.active { background: var(--black); color: var(--white); border-color: var(--black); }

details.bal summary { cursor: pointer; font-size: 12px; color: var(--g7); margin-top: 2px; }
.bal-form { display: grid; gap: 6px; margin-top: 6px; min-width: 180px; }
.bal-form input { padding: 6px 9px; font-size: 13px; }

/* Giriş / kurulum */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--black); }
.auth-card { width: 100%; max-width: 400px; background: var(--white); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { height: 46px; margin-top: 4px; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .menu-btn { display: grid; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .order-row summary { grid-template-columns: 1fr auto; }
  .order-row summary > span:nth-child(3), .order-row summary > span:nth-child(4) { display: none; }
  .search input { width: 100%; }
  .checks-grid { grid-template-columns: 1fr; }
}
