:root {
  --bg0: #0f1c18;
  --bg1: #152822;
  --bg2: #1c342c;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --line: rgba(214, 196, 160, 0.18);
  --text: #f4efe4;
  --muted: #b7c0b6;
  --accent: #c9a45c;
  --accent-2: #7eb89a;
  --danger: #e07171;
  --ok: #6fcf97;
  --warn: #e0b35c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-display: "Fraunces", "Times New Roman", serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--text);
  overflow-x: hidden;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(201, 164, 92, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(126, 184, 154, 0.14), transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1) 45%, #101a16);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 1.25rem 1rem 1.5rem;
  background: linear-gradient(180deg, rgba(17, 30, 26, 0.96), rgba(12, 22, 19, 0.98));
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 40;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 1.1;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-group { margin-bottom: 1.1rem; }
.nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
  background: var(--surface-2);
  text-decoration: none;
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(201, 164, 92, 0.22), rgba(126, 184, 154, 0.08));
  box-shadow: inset 0 0 0 1px rgba(201, 164, 92, 0.28);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--nav-h);
  padding: 0.75rem 1.25rem;
  backdrop-filter: blur(14px);
  background: rgba(15, 28, 24, 0.72);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0;
}

.content {
  padding: 1.25rem;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
  flex: 1;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #8f6b2c);
  color: #1a1408;
  font-weight: 700;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  animation: rise 0.45s ease both;
  overflow-x: hidden;
  max-width: 100%;
}

.panel + .panel { margin-top: 1rem; }

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 550;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.stat {
  padding: 1rem;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(201, 164, 92, 0.12), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line);
  animation: rise 0.55s ease both;
}

.stat:nth-child(2) { animation-delay: 0.06s; }
.stat:nth-child(3) { animation-delay: 0.12s; }

.stat-label { color: var(--muted); font-size: 0.8rem; }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 650;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, #d4b36a, #a67c2d);
  color: #1a1408;
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.btn-danger {
  background: rgba(224, 113, 113, 0.16);
  border-color: rgba(224, 113, 113, 0.35);
  color: #ffc9c9;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn-sm { min-height: 36px; padding: 0.35rem 0.7rem; font-size: 0.82rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.form-grid .full { grid-column: 1 / -1; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  padding: 0.65rem 0.8rem;
  font: inherit;
}

textarea { min-height: 110px; resize: vertical; }

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(201, 164, 92, 0.45);
  border-color: rgba(201, 164, 92, 0.55);
}

.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.45rem;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.88rem;
}

.table-wrap {
  overflow-x: visible;
  width: 100%;
  max-width: 100%;
}

table.data-table {
  width: 100% !important;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: auto;
}

table.data-table th,
table.data-table td {
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: normal;
  word-break: break-word;
  vertical-align: middle;
}

table.data-table th {
  color: var(--muted);
  font-weight: 650;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  animation: rise 0.35s ease both;
}

.alert-success { background: rgba(111, 207, 151, 0.12); color: #b8f0cc; }
.alert-error { background: rgba(224, 113, 113, 0.12); color: #ffc9c9; }
.alert-info { background: rgba(126, 184, 154, 0.12); color: #c9ead9; }

.impersonation-bar {
  background: linear-gradient(90deg, #7a3b12, #a66720);
  color: #fff7ea;
  padding: 0.55rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.guest-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.login-card {
  width: min(440px, 100%);
  padding: 1.6rem;
  border-radius: 24px;
  background:
    linear-gradient(165deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
    rgba(12, 22, 19, 0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0 0 0.35rem;
  color: var(--accent);
}

.login-card p { color: var(--muted); margin-top: 0; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 320px;
  overflow: auto;
}

.history-item {
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--line);
  font-size: 0.85rem;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.45rem;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 35;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .menu-toggle { display: inline-grid; place-items: center; }
  .stats { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .user-chip span.hide-sm { display: none; }
}

/* DataTables dark tune — PC'de yatay scrollbar yok */
.dataTables_wrapper {
  width: 100%;
  max-width: 100%;
  overflow: visible !important;
}

.dataTables_wrapper .dataTables_scroll,
.dataTables_wrapper .dataTables_scrollBody,
.dataTables_wrapper .dataTables_scrollHead {
  overflow: visible !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: rgba(0,0,0,0.22) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  min-height: 40px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--muted) !important;
  padding-top: 0.75rem !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  float: none !important;
  text-align: left;
  margin-bottom: 0.5rem;
}

.dataTables_wrapper .dataTables_filter {
  text-align: right;
}

.dataTables_wrapper .paginate_button {
  color: var(--text) !important;
  border-radius: 8px !important;
}

.dataTables_wrapper .paginate_button.current {
  background: rgba(201,164,92,0.25) !important;
  border: 1px solid rgba(201,164,92,0.4) !important;
}

.panel, .content, .main {
  min-width: 0;
  max-width: 100%;
}

.radio-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.radio-stack .check-item {
  width: 100%;
  cursor: pointer;
}

.radio-stack .check-item:has(input:checked) {
  border-color: rgba(201, 164, 92, 0.55);
  background: rgba(201, 164, 92, 0.12);
}

@media (min-width: 961px) {
  .table-wrap { overflow-x: hidden; }
  table.data-table th,
  table.data-table td { white-space: nowrap; }
  /* Geniş kolonlarda taşmayı kes */
  table.data-table td:nth-child(n) { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 960px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table.data-table th,
  table.data-table td { white-space: nowrap; }
  .dataTables_wrapper .dataTables_filter { text-align: left; }
}

/* SoftHer OPS tarzı güncelleme */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.ops-card {
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(201,164,92,0.10), rgba(255,255,255,0.03));
}
.ops-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.ops-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.15;
}
.ops-value-sm { font-size: 1.05rem; }
.ops-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1rem;
}
.ops-action-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.job-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.job-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7eb89a, #c9a45c);
}
.job-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  max-height: 280px;
  overflow: auto;
}
.release-notes {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 240px;
  overflow: auto;
}
.release-block {
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.16);
  font-size: 0.88rem;
}
.release-block ul { margin: 0.35rem 0 0; padding-left: 1.1rem; color: var(--muted); }

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