:root {
  --bg: #0f1a24; --bg-2: #13212d; --panel: #172532; --panel-2: #1d2e3d; --line: #2a3a48;
  --text: #e8eef3; --text-2: #bfcbd6; --text-3: #8fa0ae;
  --cyan: #4cc3f2; --cyan-deep: #123b52; --good: #3ddc84; --warn: #e3a42a; --bad: #f2555a;
  --radius: 14px; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }
.mono { font-family: var(--mono); }
.dim { color: var(--text-3); }

/* ---- karkas ---- */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--bg-2); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 800; font-size: 20px; padding: 4px 10px 2px; letter-spacing: .3px; }
.brand span { color: var(--cyan); }
.firm { color: var(--text-3); font-size: 13px; padding: 0 10px 14px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 600; }
.nav:hover { background: var(--panel); }
.nav.on { background: var(--cyan-deep); color: var(--text); }
.nav .badge { margin-left: auto; }
.side .spacer { flex: 1; }
.me { padding: 10px 12px; font-size: 13px; color: var(--text-3); border-top: 1px solid var(--line); }
.main { padding: 22px 28px 60px; min-width: 0; }
.layout > div { min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { font-size: 22px; margin: 0; flex: 1; }
.topbar { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px; background: var(--bg-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  .topbar .nav { white-space: nowrap; padding: 8px 12px; }
  .main { padding: 16px 16px 60px; }
}

/* ---- elementlar ---- */
.btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--text-3); }
.btn.go { background: var(--cyan); color: #04202e; border-color: var(--cyan); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.busy { opacity: .6; pointer-events: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat b { display: block; font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat span { color: var(--text-3); font-size: 13px; }
.stat.warn b { color: var(--warn); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.badge.good { color: var(--good); border-color: #23593c; }
.badge.warn { color: var(--warn); border-color: #6b5220; }
.badge.bad { color: var(--bad); border-color: #6b2a2c; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--text-3); }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.input, select.input, textarea.input { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; outline: none; }
.input:focus { border-color: var(--cyan); }
.search { flex: 1; min-width: 200px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--text-3); font-weight: 600; font-size: 13px; background: var(--bg-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
tr.off td { opacity: .5; }
.who { display: flex; align-items: center; gap: 10px; }
.av { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #0f1a24; background-size: cover; background-position: center; }
.empty { padding: 30px; text-align: center; color: var(--text-3); }

/* ---- forma / oyna ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 10, 15, .66); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal header { padding: 16px 18px 6px; display: flex; align-items: center; gap: 10px; }
.modal header h2 { font-size: 18px; margin: 0; flex: 1; }
.modal .body { padding: 8px 18px 16px; overflow: auto; display: grid; gap: 12px; }
.modal footer { padding: 12px 18px 16px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; color: var(--text-3); font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--bg-2); padding: 8px 14px; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--cyan-deep); color: var(--text); }
.note { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text-2); font-size: 14px; }
.note.good { border-color: #23593c; } .note.bad { border-color: #6b2a2c; color: #ffc9cb; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; word-break: break-all; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; }
.login .brand { font-size: 30px; text-align: center; padding: 0; }
.login p { text-align: center; color: var(--text-3); margin: -6px 0 6px; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 16px; opacity: 0; transition: .2s; pointer-events: none; z-index: 40; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { border-color: var(--bad); color: #ffc9cb; }
.note.bill { margin-bottom: 14px; }
