/* ==========================================================================
   OSION — Sistem yönetimi paneli
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --brand: #1c64d3;
  --brand-hover: #1554b8;
  --brand-deep: #0a2a66;
  --brand-soft: #eaf2ff;
  --brand-line: #c9dcfb;
  --ink: #111c2e;
  --text: #2b3a4f;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e4e9f1;
  --line-strong: #d3dbe7;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ok: #15803d;
  --ok-bg: #e8f7ee;
  --warn: #b45309;
  --warn-bg: #fff4e0;
  --bad: #c2271d;
  --bad-bg: #fdecea;
  --info-bg: #eef4ff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 28, 46, .04), 0 4px 14px rgba(15, 28, 46, .04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --side: 264px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--brand); }
h1, h2, h3 { color: var(--ink); margin: 0; letter-spacing: -0.01em; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Açılış --- */
.gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }
.gate-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.gate-card h1 { font-size: 20px; }
.gate-card p { margin: 0; color: var(--muted); }
.gate-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px rgba(6, 26, 66, .12), inset 0 0 0 1px rgba(6, 26, 66, .08); flex-shrink: 0; }

/* --- Kabuk --- */
.shell { display: flex; min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 40;
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px 14px; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 6px 14px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: .06em; color: var(--ink); }
.side-pill { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 6px 12px; margin: 0 4px 12px; }
.side-pill svg { width: 13px; height: 13px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 500; font-size: 14.5px; border: 1.5px solid transparent;
}
.side-nav a svg { width: 18px; height: 18px; color: var(--muted); }
.side-nav a:hover { background: var(--bg); }
.side-nav a.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; border-color: var(--brand-line); }
.side-nav a.active svg { color: var(--brand); }
.side-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.side-links { margin-top: auto; padding: 14px 8px 8px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.side-links a { color: var(--muted); text-decoration: none; }
.side-links a:hover { color: var(--brand); }
.side-user { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 14px 6px 2px; }
.side-user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user-meta strong { font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-meta small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.avatar.sq { border-radius: 10px; width: 34px; height: 34px; font-size: 12px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.side-overlay { display: none; }

.main { flex: 1; margin-left: var(--side); min-width: 0; }
.mobile-bar { display: none; }
.content { max-width: 1240px; margin: 0 auto; padding: 36px 32px 64px; outline: none; }

/* --- Sayfa başlığı --- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.kicker { font-size: 13px; font-weight: 600; color: var(--brand); margin-bottom: 4px; }
.page-head h1 { font-size: 30px; font-weight: 800; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; max-width: 720px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Düğmeler --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: 600 14px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { background: var(--bad-bg); border-color: #f5c2bd; color: var(--bad); }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-link { border: none; background: none; color: var(--brand); padding: 0; min-height: 0; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--bad); }

/* --- Kartlar --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.card-head h2 { font-size: 17px; }
.card-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.stat { display: flex; gap: 14px; padding: 18px; }
.stat-ic { width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--brand); }
.stat-ic svg { width: 19px; height: 19px; }
.stat-ic.ok { background: var(--ok-bg); color: var(--ok); }
.stat-ic.warn { background: var(--warn-bg); color: var(--warn); }
.stat-ic.bad { background: var(--bad-bg); color: var(--bad); }
.stat-ic.info { background: var(--info-bg); color: var(--brand); }
.stat small { display: block; color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 24px; font-weight: 800; color: var(--ink); line-height: 1.25; }
.stat em { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 2px; }

.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 8px; }

.empty-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--bg); border-radius: 10px; color: var(--muted); }
.empty-row svg { width: 18px; height: 18px; color: var(--ok); flex-shrink: 0; }
.empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--card); }
.empty .stat-ic { margin: 0 auto 12px; width: 48px; height: 48px; }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 0 16px; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row strong { display: block; color: var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row small { color: var(--muted); font-size: 12.5px; }
.list-row .amount { font-weight: 700; color: var(--ink); white-space: nowrap; }

.bars { display: grid; gap: 12px; margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-track { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.bar-row b { text-align: right; color: var(--ink); }

/* --- Sekmeler ve filtreler --- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: none; background: none; padding: 10px 12px; font: 500 14px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }
.tab .count { font-size: 11.5px; font-weight: 700; background: var(--bg); color: var(--muted); border-radius: 999px; padding: 1px 7px; }
.tab.active .count { background: var(--brand-soft); color: var(--brand); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.input, .select, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
.search .input { padding-left: 38px; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(28, 100, 211, .14); }
.select { width: auto; min-width: 160px; 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='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; cursor: pointer; }
textarea.input { min-height: 96px; resize: vertical; }
.result-count { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }

/* --- Tablo --- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 13px 14px; border-bottom: 1px solid var(--line); background: #fbfcfe; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #f8faff; }
td .cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
td strong { color: var(--ink); font-weight: 600; display: block; }
td small { color: var(--muted); font-size: 12.5px; display: block; }
td.num { font-variant-numeric: tabular-nums; }
td.right, th.right { text-align: right; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.detail-json { font-family: var(--mono); font-size: 11.5px; color: var(--muted); max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 9px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--brand); }
.badge.dark { background: var(--ink); color: #fff; }

.progress { width: 140px; }
.progress .bar-track { height: 5px; margin-bottom: 4px; }
.progress .bar-fill.warn { background: var(--warn); }
.progress .bar-fill.bad { background: var(--bad); }

/* --- Planlar --- */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.plan-card { padding: 20px; display: flex; flex-direction: column; }
.plan-card.inactive { opacity: .7; }
.plan-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.plan-card h3 { font-size: 17px; }
.plan-code { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.plan-desc { color: var(--muted); font-size: 13.5px; margin: 10px 0 14px; min-height: 40px; }
.plan-prices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.plan-prices div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.plan-prices b { display: block; font-size: 18px; color: var(--ink); }
.plan-prices small { color: var(--muted); font-size: 12px; }
.plan-limits { display: grid; margin-bottom: 14px; }
.plan-limits div { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.plan-limits div:first-child { border-top: none; }
.plan-limits b { color: var(--ink); }
.plan-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.plan-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- Duyurular --- */
.ann-list { display: grid; gap: 12px; }
.ann { padding: 18px 20px; display: flex; gap: 16px; align-items: flex-start; }
.ann .grow { flex: 1; min-width: 0; }
.ann h3 { font-size: 15.5px; margin-bottom: 4px; }
.ann p { margin: 0 0 8px; color: var(--muted); white-space: pre-line; }
.ann-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); }

/* --- Formlar --- */
.form { display: grid; gap: 14px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field label span { color: var(--muted); font-weight: 400; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.section-card { padding: 0; overflow: hidden; }
.section-card > header { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.section-card > header h2 { font-size: 16px; }
.section-card > header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.section-card > .body { padding: 20px 22px; }
.narrow { max-width: 760px; }
.stack { display: grid; gap: 16px; }

/* --- Yan panel --- */
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(15, 28, 46, .42); z-index: 80; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); z-index: 90; background: var(--bg); box-shadow: -20px 0 50px rgba(15, 28, 46, .18); display: flex; flex-direction: column; animation: slideIn .2s ease-out; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-head small { color: var(--muted); }
.drawer .tabs { background: var(--card); padding: 0 16px; margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; display: grid; gap: 14px; align-content: start; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kv div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kv small { display: block; color: var(--muted); font-size: 12px; }
.kv b { color: var(--ink); font-size: 15px; }
.quick-renew { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-renew button { text-align: left; border: 1px solid var(--line-strong); background: var(--card); border-radius: 12px; padding: 12px 14px; cursor: pointer; font: inherit; }
.quick-renew button:hover { border-color: var(--brand); background: var(--brand-soft); }
.quick-renew b { display: block; color: var(--ink); }
.quick-renew small { color: var(--muted); }

/* --- İletişim kutusu --- */
.modal-backdrop { display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 48px 16px; z-index: 100; }
.modal-card { width: min(560px, 100%); background: var(--card); border-radius: 18px; box-shadow: 0 30px 80px rgba(15, 28, 46, .3); animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card > header { padding: 20px 22px 0; display: flex; justify-content: space-between; gap: 12px; }
.modal-card > header h2 { font-size: 18px; }
.modal-card > header p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.modal-card > .body { padding: 18px 22px 22px; }
.code-box { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.code-box span { flex: 1; }

/* --- Bildirim --- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(15, 28, 46, .25); font-size: 14px; max-width: 380px; animation: pop .18s; }
.toast.error { background: var(--bad); }
.toast.success { background: #14532d; }

/* --- Duyarlı --- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(15, 28, 46, .15); }
  .side.open { transform: none; }
  .side-overlay.open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 28, 46, .35); }
  .main { margin-left: 0; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .mobile-title { font-weight: 700; color: var(--ink); }
  .content { padding: 22px 16px 48px; }
  .page-head h1 { font-size: 24px; }
}

@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { flex-direction: column; gap: 10px; padding: 14px; }
  .stat b { font-size: 20px; }
  .form-2, .form-3, .kv, .quick-renew { grid-template-columns: 1fr; }
  .head-actions, .head-actions .btn { width: 100%; }
  .select { flex: 1; min-width: 0; }
  .bar-row { grid-template-columns: 96px 1fr 28px; }
  .toast-stack { left: 16px; right: 16px; }
}

@media (max-width: 360px) {
  .stats { grid-template-columns: 1fr; }
}
