:root {
  --sidebar-bg: #1e4976;
  --sidebar-text: #f0f6fc;
  --sidebar-hover: #2d5a8a;
  --sidebar-active: #3d6b9e;
  --sidebar-width: 260px;
  --main-bg: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 15px; }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-primary);
  background: var(--main-bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Layout: sol menü + sağ içerik */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1030;
  box-shadow: var(--shadow-md);
}

.app-sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.app-sidebar-brand:hover {
  color: #fff;
  opacity: 0.9;
}

.app-sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(226, 232, 240, 0.35) transparent;
}

/* WebKit scrollbar (Chrome/Edge) – minimal and only visible on hover */
.app-sidebar-nav::-webkit-scrollbar {
  width: 10px;
}
.app-sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.app-sidebar-nav::-webkit-scrollbar-thumb {
  background-color: rgba(226, 232, 240, 0.18);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}
.app-sidebar-nav:hover::-webkit-scrollbar-thumb {
  background-color: rgba(226, 232, 240, 0.35);
}

.app-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.app-sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.app-sidebar-link.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}

.app-sidebar-icon {
  font-size: 1.1rem;
  opacity: 0.9;
}

.app-sidebar-group {
  margin-top: 0.5rem;
}

.app-sidebar-group:first-child {
  margin-top: 0;
}

.app-sidebar-group-title {
  display: block;
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.app-sidebar-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
}

.app-sidebar-group-toggle:hover {
  color: #fff;
}

.app-sidebar-group-chevron {
  opacity: 0.8;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.app-sidebar-group-toggle:not(.collapsed) .app-sidebar-group-chevron {
  transform: rotate(0deg);
}

.app-sidebar-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-sidebar-group-items .app-sidebar-link {
  padding-left: 1.25rem;
  font-size: 0.8rem;
}

.app-sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: nowrap;
  min-height: 44px;
}
.app-sidebar-footer .app-sidebar-link {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  white-space: nowrap;
}
.app-sidebar-version {
  padding: 0;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}

.app-sidebar-user {
  padding: 0;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}

.app-content-wrap {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.app-tab-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.25rem 0.5rem 0 0.5rem;
  min-height: 42px;
  flex-shrink: 0;
  overflow-x: auto;
}

.app-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  background: transparent;
  cursor: pointer;
}

.app-tab:hover {
  color: var(--text-primary);
  background: var(--main-bg);
}

.app-tab.active {
  background: #d4deeb;
  color: #17385f;
  font-weight: 600;
  border-color: #a7b7cf;
  border-bottom: 1px solid #d4deeb;
  margin-bottom: -1px;
  box-shadow: inset 0 0 0 1px rgba(23, 56, 95, 0.12);
}

.app-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.app-tab-close:hover {
  background: rgba(0,0,0,0.08);
  color: var(--text-primary);
}

.app-main {
  flex: 1;
  padding: 1.75rem 2rem;
  background: var(--main-bg);
  overflow: auto;
  min-height: 0;
}

@media (max-width: 767px) {
  .app-sidebar {
    width: 72px;
    min-width: 72px;
    padding: 0;
  }
  .app-sidebar-brand span:not(.app-sidebar-icon) { display: none; }
  .app-sidebar-brand { font-size: 1.1rem; padding: 1rem; }
  .app-sidebar-link span:last-child { display: none; }
  .app-sidebar-link { justify-content: center; padding: 0.85rem; }
  .app-content-wrap { margin-left: 72px; }
  .app-main { padding: 1rem; }
}

/* Butonlar */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-outline-primary {
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline-primary:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Kartlar */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  padding: 1rem 1.25rem;
}

/* Tablolar */
.table {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table thead th {
  background: var(--main-bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-primary);
  padding: 0.85rem 1rem;
}

.table tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: rgba(99, 102, 241, 0.04);
}

/* Form */
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.2);
}

/* Alert */
.alert-success { background: #ecfdf5; color: #065f46; border: none; border-radius: 8px; }
.alert-warning { background: #fffbeb; color: #92400e; border: none; border-radius: 8px; }
.alert-info { background: #eff6ff; color: #1e40af; border: none; border-radius: 8px; }
.alert-danger { background: #fef2f2; color: #991b1b; border: none; border-radius: 8px; }

/* Genel */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
}

.text-muted {
  color: var(--text-muted) !important;
}

/* Doküman listelerinde dosya adı hizalaması (butonlar kaymasın) */
.doc-file-name {
  max-width: 260px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--text-muted);
}

/* Login sayfası */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1e293b 100%);
}
.login-container {
  width: 100%;
  max-width: 360px;
  padding: 1rem;
}
.login-card {
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
}
.login-card .card-body {
  padding: 2rem;
}
