/* ==========================================================================
   digitALL Panel — Tema v2  (app.css'in ÜSTÜNE yüklenir)
   Yön: sıcak kâğıt tonları + tek vurgu (petrol yeşili), düz yüzeyler,
   belirgin tipografi (Bricolage Grotesque + DM Sans), emoji yerine SVG.
   ========================================================================== */
:root, [data-theme="light"] {
  --font-body: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg-base: #f5f2ec;
  --bg-surface: #fdfbf7;
  --bg-surface-2: #efebe3;
  --bg-hover: #ebe6dc;
  --border: #e3ddd0;
  --border-strong: #cfc7b6;
  --text-primary: #1d1b16;
  --text-secondary: #55503f;
  --text-muted: #6f695a;

  --accent: #0f5f5a;
  --accent-fg: #f4faf9;
  --accent-soft: #dcece8;

  --sidebar-bg: #efebe2;
  --sidebar-text: #55503f;
  --sidebar-active: #0f5f5a;
  --sidebar-hover: #e6e0d3;
  --topbar-bg: rgba(245, 242, 236, .88);

  --shadow-sm: 0 1px 0 rgba(60, 50, 20, .04);
  --shadow-md: 0 6px 20px -8px rgba(60, 50, 20, .18);

  --paid-bg: #dcefe0;    --paid-text: #1e5b34;
  --pending-bg: #f6e7b8; --pending-text: #6e4a0c;
  --late-bg: #f7d9d3;    --late-text: #9b2c1c;
  --upcoming-bg: #f9e0c6;--upcoming-text: #8a430d;

  --ok: #2f8a4d; --warn: #c98a12; --crit: #c2402b;
}

[data-theme="dark"] {
  --bg-base: #14130f;
  --bg-surface: #1c1a15;
  --bg-surface-2: #25221c;
  --bg-hover: #2d2a23;
  --border: rgba(255, 240, 210, .09);
  --border-strong: rgba(255, 240, 210, .17);
  --text-primary: #f2eee4;
  --text-secondary: #bcb5a3;
  --text-muted: #948d7b;

  --accent: #4cc2b6;
  --accent-fg: #06201d;
  --accent-soft: rgba(76, 194, 182, .14);

  --sidebar-bg: #100f0c;
  --sidebar-text: #bcb5a3;
  --sidebar-active: #4cc2b6;
  --sidebar-hover: rgba(255, 240, 210, .07);
  --topbar-bg: rgba(20, 19, 15, .88);

  --shadow-sm: 0 1px 0 rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, .6);

  --paid-bg: rgba(74, 190, 110, .16);   --paid-text: #7fdc9c;
  --pending-bg: rgba(230, 180, 50, .16);--pending-text: #f0cc6a;
  --late-bg: rgba(235, 90, 70, .16);    --late-text: #f59a8b;
  --upcoming-bg: rgba(240, 140, 60, .16);--upcoming-text: #f5b47c;

  --ok: #5cc884; --warn: #e6b432; --crit: #ee6a55;
}

/* ── Tipografi ─────────────────────────────────────────────── */
body, button, input, select, textarea, .font-sans, .tabulator {
  font-family: var(--font-body) !important;
  font-feature-settings: 'ss01', 'cv11';
}
h1, h2, h3, .db-page-title, .pg-header h1, .topbar-title, .db-kpi-value, .stat-value,
.sidebar-logo-text, .pg-form-title, .db-panel-title, .db-section-title {
  font-family: var(--font-display);
  letter-spacing: -.02em;
}
.db-page-title, .pg-header h1 { font-size: 1.75rem; font-weight: 700; }
.db-kpi-value, .stat-value, .db-payment-amount, .db-table td, .pg-pay-stat-value, .srv-num {
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--accent); color: var(--accent-fg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Yüzeyler: düz, çerçeveli, gölgesiz ─────────────────────── */
.card, .db-section-card, .db-panel-card, .db-chart-card, .db-kpi-card, .client-card,
.pg-form-card, .pg-info-card, .stat-card, .pg-kanban-col {
  border-radius: 14px;
  box-shadow: none;
}
.card:hover, .client-card:hover, .stat-card:hover, .db-kpi-card:hover { box-shadow: none; transform: none; border-color: var(--border-strong); }
.card-header, .db-section-header, .db-chart-header, .db-panel-header, .db-pagination { background: transparent !important; }

/* ── Butonlar ──────────────────────────────────────────────── */
.btn { border-radius: 10px; font-weight: 600; transition: background-color .15s, border-color .15s, color .15s; }
.btn:active { transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-fg); box-shadow: none; }
.btn-primary:hover { opacity: 1; filter: brightness(1.12); }
.btn-secondary { box-shadow: none; }

/* ── Kenar çubuğu ──────────────────────────────────────────── */
.sidebar { backdrop-filter: none; border-right: 1px solid var(--border); }
.sidebar-logo-icon { background: var(--accent); color: var(--accent-fg); box-shadow: none; border-radius: 10px; }
.sidebar-logo-icon svg { width: 18px; height: 18px; }
.sidebar-logo-text { font-size: 1.15rem; font-weight: 700; }
.sidebar-section-label { font-weight: 600; letter-spacing: .08em; font-size: 10.5px; }
.sidebar-nav a { border-radius: 10px; font-weight: 500; transition: background-color .15s, color .15s; }
.sidebar-nav a:hover { box-shadow: none; background: var(--sidebar-hover); }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--accent); box-shadow: none; transform: none; font-weight: 600; }
.sidebar-nav a.active .nav-icon, .sidebar-nav a.active svg { color: var(--accent); }
.sidebar-nav a.nav-sub { padding-left: 34px; font-size: 13px; }
.avatar { background: var(--accent) !important; color: var(--accent-fg) !important; box-shadow: none !important; }

/* ── Üst çubuk ─────────────────────────────────────────────── */
.topbar { backdrop-filter: saturate(1.2) blur(10px); }
.topbar-btn { transition: background-color .15s, border-color .15s; }
.topbar-btn:hover { transform: none; border-color: var(--border-strong); }
.notif-badge { animation: none; background: var(--crit); }
.notif-dot { background: var(--crit); }

/* ── Formlar ───────────────────────────────────────────────── */
.form-control, .form-select, .form-textarea, .pg-form-group input, .pg-form-group select, .pg-form-group textarea {
  border-radius: 10px; box-shadow: none; background: var(--bg-surface);
}
.form-control:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }

/* ── Tablo ─────────────────────────────────────────────────── */
.db-table th { font-weight: 600; letter-spacing: .06em; }

/* ── Sunucu izleme ─────────────────────────────────────────── */
.srv-stats { display: flex; flex-wrap: wrap; gap: 8px 40px; margin: 4px 0 28px; }
.srv-stat .srv-num { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.srv-stat .srv-lbl { font-size: 12px; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }

.srv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.srv-card { display: block; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 18px 16px; color: inherit; text-decoration: none; transition: border-color .15s; }
.srv-card:hover { border-color: var(--accent); }
.srv-card.is-offline { border-color: color-mix(in srgb, var(--crit) 45%, var(--border)); }
.srv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.srv-name { font-family: var(--font-display); font-weight: 650; font-size: 1.05rem; letter-spacing: -.01em; }
.srv-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-family: var(--font-mono); }
.srv-meta { display: flex; justify-content: space-between; margin-top: 14px; font-size: 12px; color: var(--text-muted); }

.srv-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-muted); flex: none; }
.srv-dot.ok { background: var(--ok); } .srv-dot.warn { background: var(--warn); }
.srv-dot.offline { background: var(--crit); } .srv-dot.new, .srv-dot.disabled { background: var(--text-muted); opacity: .6; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--paid-bg); color: var(--paid-text); }
.pill-warn { background: var(--pending-bg); color: var(--pending-text); }
.pill-offline { background: var(--late-bg); color: var(--late-text); }
.pill-new, .pill-disabled { background: var(--bg-surface-2); color: var(--text-muted); }

.meter-row { display: grid; grid-template-columns: 42px 1fr 46px; align-items: center; gap: 10px; font-size: 12px; margin-top: 9px; }
.meter-row span:first-child { color: var(--text-muted); font-weight: 600; letter-spacing: .04em; }
.meter-row b { font-family: var(--font-mono); font-weight: 500; text-align: right; font-size: 12px; }
.meter { height: 6px; background: var(--bg-surface-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.meter.is-warn i { background: var(--warn); } .meter.is-crit i { background: var(--crit); }
.srv-card.is-offline .meter i { background: var(--text-muted); opacity: .5; }

.srv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1024px) { .srv-layout { grid-template-columns: 1fr; } }
.srv-panel { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.srv-panel + .srv-panel { margin-top: 16px; }
.srv-panel h3 { font-size: .95rem; font-weight: 650; margin: 0 0 14px; }
.srv-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .srv-charts { grid-template-columns: 1fr; } }
.srv-chart-box { position: relative; height: 190px; }
.srv-chart-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; letter-spacing: .04em; text-transform: uppercase; }
.srv-range { display: inline-flex; background: var(--bg-surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.srv-range a { padding: 5px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-decoration: none; }
.srv-range a.on { background: var(--bg-surface); color: var(--text-primary); }

.srv-kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 13px; margin: 0; }
.srv-kv dt { color: var(--text-muted); } .srv-kv dd { margin: 0; text-align: right; font-family: var(--font-mono); font-size: 12.5px; word-break: break-all; }

.rec { display: flex; gap: 10px; padding: 11px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; background: var(--bg-surface-2); }
.rec + .rec { margin-top: 8px; }
.rec .srv-dot { margin-top: 6px; }
.rec.danger { background: var(--late-bg); color: var(--late-text); } .rec.danger .srv-dot { background: var(--crit); }
.rec.warn { background: var(--pending-bg); color: var(--pending-text); } .rec.warn .srv-dot { background: var(--warn); }
.rec.ok { background: var(--paid-bg); color: var(--paid-text); } .rec.ok .srv-dot { background: var(--ok); }

.codebox { position: relative; background: #12110d; color: #e7e2d3; border-radius: 10px; padding: 14px 16px; font-family: var(--font-mono); font-size: 12px; line-height: 1.65; overflow-x: auto; white-space: pre; }
.codebox-copy { position: absolute; top: 8px; right: 8px; font-size: 11px; padding: 4px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #e7e2d3; cursor: pointer; }
.codebox-copy:hover { background: rgba(255,255,255,.14); }

.empty { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty h3 { font-family: var(--font-display); color: var(--text-primary); font-size: 1.15rem; margin: 12px 0 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ── Sunucu detay v2 ───────────────────────────────────────── */
.live-tag { display: inline-flex; align-items: center; gap: 6px; }
.live-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-surface); margin-bottom: 20px; overflow: hidden; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--border); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi-l { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.kpi-v { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.kpi-v.kpi-sm { font-size: 1.05rem; letter-spacing: -.01em; padding: 9px 0 8px; font-family: var(--font-mono); font-weight: 500; }
.kpi-s { font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 720px) { .kpi { border-bottom: 1px solid var(--border); } }
.muted { color: var(--text-muted); font-weight: 400; font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.tbl-wrap { overflow-x: auto; margin: 0 -8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 6px 8px 10px; }
.tbl td { padding: 9px 8px; border-top: 1px solid var(--border); vertical-align: middle; }
.tbl .r, .tbl th.r { text-align: right; }
.tbl tr.bad td { background: color-mix(in srgb, var(--crit) 8%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.proc { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.proc:first-child { border-top: 0; padding-top: 0; }

/* Açılır panel */
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h3 { margin: 0; }
details.fold > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold .fold-body { margin-top: 14px; }

/* v3: bakım, diskler */
.pill-maint { background: var(--accent-soft); color: var(--accent); }
.srv-dot.maint { background: var(--accent); }
.disk-row { display: grid; grid-template-columns: minmax(70px, 140px) 1fr minmax(120px, auto); gap: 12px; align-items: center; padding: 7px 0; font-size: 12.5px; }
.disk-row b { text-align: right; font-weight: 500; }

/* ── Sunucu listesi: araç çubuğu, tablo, kanban ── */
.srv-toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 0 0 18px; }
.srv-search { flex: 1 1 220px; max-width: 320px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-surface); }
.seg button { border: 0; background: transparent; color: var(--text-secondary); padding: 8px 13px; font: inherit; font-size: 13px; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.srv-count { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.srv-tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-surface); }
.srv-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.srv-table th { position: sticky; top: 0; background: var(--bg-surface-2); text-align: left; padding: 9px 12px; font-weight: 600; font-size: 12px; color: var(--text-secondary); white-space: nowrap; cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); }
.srv-table th.nosort { cursor: default; }
.srv-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.srv-table tr:last-child td { border-bottom: 0; }
.srv-table tbody tr:hover { background: var(--bg-surface-2); }
.srv-table a.srv-link { color: var(--text-primary); text-decoration: none; font-weight: 600; }
.srv-table a.srv-link:hover { color: var(--accent); }
.pct { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.pct.is-warn { color: var(--warn); font-weight: 600; } .pct.is-crit { color: var(--crit); font-weight: 700; }
.kb-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; }
.kb-col { background: var(--bg-surface-2); border-radius: 14px; padding: 10px; min-height: 120px; }
.kb-col h4 { margin: 2px 4px 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.kb-col h4 .n { margin-left: auto; color: var(--text-muted); font-weight: 500; }
.kb-card { display: block; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.kb-card:hover { border-color: var(--accent); }
.kb-card b { font-size: 14px; } .kb-card .sub { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.kb-card .m { font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.mute-btn { border: 1px solid var(--border); background: transparent; color: var(--text-secondary); border-radius: 8px; padding: 3px 8px; font-size: 12px; cursor: pointer; }
.mute-btn.is-off { color: var(--warn); border-color: var(--warn); }
[hidden] { display: none !important; }

/* ═══ Responsive (tüm sistem) ═══ */
html, body { max-width: 100%; overflow-x: clip; }
.main-content, .page-content { min-width: 0; max-width: 100%; }
.page-content img, .page-content canvas, .page-content svg, .page-content video, .page-content iframe { max-width: 100%; }
.page-content { overflow-wrap: anywhere; }
.page-content pre { white-space: pre-wrap; overflow-x: auto; max-width: 100%; }
.page-content code, .mono { overflow-wrap: anywhere; }
.page-content input, .page-content select, .page-content textarea { max-width: 100%; min-width: 0; }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.tbl-scroll > table { min-width: 100%; }
.tbl-scroll table th, .tbl-scroll table td { overflow-wrap: normal; }
.srv-panel, .srv-card, .kpi, .rec { min-width: 0; }
.srv-layout > *, .srv-charts > * { min-width: 0; }
.srv-kv dd { min-width: 0; }
.chips > * { max-width: 100%; }
.pg-header-actions form, .pg-header-actions a { max-width: 100%; }
@media (max-width: 767px) {
  .page-content { padding: 12px !important; }
  .pg-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .pg-header-left h1 { font-size: 1.35rem; }
  .pg-header-actions { width: 100%; }
  .pg-header-actions > * { flex: 1 1 auto; }
  .pg-header-actions form { flex-wrap: wrap; }
  .pg-header-actions .btn { justify-content: center; }
  .srv-panel { padding: 14px; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .srv-kv { grid-template-columns: 1fr; gap: 2px 0; }
  .srv-kv dd { text-align: left; margin-bottom: 8px; }
  .srv-range a { padding: 5px 9px; }
  .srv-chart-box { height: 170px; }
  .tbl-wrap { margin: 0; }
  .form-grid, .pg-form-grid, .grid-2, .grid-3, .form-row { grid-template-columns: 1fr !important; }
  .btn, .form-input, .form-select, input, select, textarea { font-size: 16px; }
  .btn-sm { font-size: 13px; }
  .modal, .modal-content, .modal-box { max-width: calc(100vw - 24px) !important; width: auto; }
  #notifDropdown, .notif-dropdown { max-width: calc(100vw - 16px); right: 8px !important; left: auto !important; }
}
@media (max-width: 420px) {
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .kpi-v { font-size: 1.15rem; }
  .btn { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 767px) {
  .pg-header-actions .btn, .pg-header-actions select { font-size: 14px; padding: 9px 12px; }
  .kpi-strip { gap: 0; }
  .kpi { border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 14px; }
  .kpi:nth-child(odd) { border-right: 1px solid var(--border); }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }
  .kpi-v { font-size: 1.5rem; }
  .kpi-v.kpi-sm { font-size: .95rem; }
  .srv-panel [style*="display:flex"] { flex-wrap: wrap; }
}
@media (max-width: 900px) { .page-content [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; } }
.chips .pill { white-space: normal; max-width: 100%; overflow-wrap: anywhere; line-height: 1.45; border-radius: 14px; padding-top: 5px; padding-bottom: 5px; }
