:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --radius: 10px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: #f8fafc;
  color: var(--slate-800);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Header */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.01em;
}

.brand-text p {
  font-size: 12px;
  color: var(--slate-500);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--slate-100);
  border-radius: 20px;
  font-size: 13px;
  color: var(--slate-700);
  font-weight: 500;
}

.btn-logout {
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--danger-light);
  border-color: #fca5a5;
  color: var(--danger);
}

/* Main Layout */
main.main-content {
  flex: 1;
  padding: 28px 0 40px;
}

/* Upload Queue / Progress */
.upload-progress-container {
  margin-top: 16px;
  display: none;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--slate-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  width: 0%;
  transition: width 0.2s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--slate-600);
  margin-top: 6px;
}

/* Filter & Controls Bar */
.filter-bar {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
}

.filter-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
}

.segmented-control {
  display: inline-flex;
  background: var(--slate-100);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--slate-200);
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-600);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.seg-btn.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-box {
  position: relative;
  min-width: 260px;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

/* Day Groups */
.day-group {
  margin-bottom: 32px;
}

.day-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--slate-200);
  margin-bottom: 14px;
}

.day-group-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-count {
  background: var(--slate-200);
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.empty-group {
  background: #fff;
  border: 1px dashed var(--slate-200);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--slate-400);
  font-size: 13px;
}

/* File Table / Card */
.files-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.files-table th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
}

.files-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
  font-size: 14px;
}

.files-table tr:last-child td {
  border-bottom: none;
}

.files-table tr:hover td {
  background-color: var(--slate-50);
}

.file-info-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-ext-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.file-ext-icon.ext-spreadsheet {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.file-ext-icon.ext-document {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.file-ext-icon.ext-archive {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.file-ext-icon.ext-data {
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.file-ext-icon.ext-image {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.file-ext-icon.ext-other {
  background: var(--slate-100);
  color: var(--slate-600);
  border: 1px solid var(--slate-200);
}

.file-names {
  min-width: 0;
}

.file-original-name {
  font-weight: 600;
  color: var(--slate-900);
  word-break: break-word;
}

.file-desc-text {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 2px;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.badge-new {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.status-badge.badge-downloaded {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

/* Action Buttons */
.action-btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-action {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-download {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #bfdbfe;
}

.btn-download:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-delete {
  background: #fff;
  color: var(--slate-500);
  border-color: var(--slate-200);
}

.btn-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fca5a5;
}

/* Subgroup for Type View */
.type-subgroup {
  margin-top: 14px;
  margin-bottom: 20px;
}

.type-subgroup-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  background: var(--slate-100);
  border-radius: 6px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Footer */
.app-footer {
  margin-top: auto;
  background: #fff;
  border-top: 1px solid var(--slate-200);
  padding: 20px 0;
  font-size: 12px;
  color: var(--slate-500);
  text-align: center;
}

.footer-notice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--slate-100);
  padding: 4px 12px;
  border-radius: 20px;
  margin-top: 6px;
}

/* Login Page Styling */
.login-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-icon {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 auto 16px;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.25);
}

.login-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 4px;
}

.login-header p {
  font-size: 13px;
  color: var(--slate-500);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--slate-600);
  cursor: pointer;
  user-select: none;
}

.form-checkbox input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.btn-submit {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-submit:hover {
  background: var(--primary-hover);
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecaca;
}

/* Toast Notifications */


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

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    min-width: 100%;
  }
  .upload-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .files-table th:nth-child(3),
  .files-table td:nth-child(3) {
    display: none;
  }
}


/* ══ İKİ SÜTUNLU PORTAL DÜZENİ ══════════════════════════════════════ */
.portal-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.upload-sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.files-main { min-width: 0; }

.panel {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-muted { background: var(--slate-50); box-shadow: none; }

.panel-head { margin-bottom: 14px; }

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--slate-800);
  letter-spacing: -0.01em;
}

.panel-note {
  font-size: 12px;
  color: var(--slate-500);
  line-height: 1.55;
  margin-top: 12px;
}

/* Kompakt dropzone */
.dropzone {
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  background: var(--slate-50);
  cursor: pointer;
  transition: border-color .18s, background .18s;
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-icon { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--primary); }
.dropzone-title { font-size: 14px; font-weight: 600; color: var(--slate-800); }
.dropzone-subtitle { font-size: 12px; color: var(--slate-500); margin-top: 3px; }

.file-input-hidden {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}

.input-desc {
  width: 100%;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.input-desc:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.btn-block { width: 100%; justify-content: center; margin-top: 10px; }

/* ══ İSTATİSTİK ŞERİDİ ══════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-card.is-alert { border-color: #fbbf24; background: #fffbeb; }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--slate-500);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--slate-900);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.stat-card.is-alert .stat-value { color: #b45309; }

/* ══ FİLTRE ÇUBUĞU ══════════════════════════════════════════════════ */
.filter-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.toggle-pending {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--slate-600);
  cursor: pointer;
  user-select: none;
}

.toggle-pending input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ══ ONAY PENCERESİ (native confirm yerine) ═════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 20px;
  animation: fadeIn .15s ease;
}

.modal-overlay[hidden] { display: none !important; }

.modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .35);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  animation: modalPop .18s cubic-bezier(.2, .9, .3, 1.2);
}

.modal-title { font-size: 16px; font-weight: 700; color: var(--slate-900); }
.modal-text { font-size: 13.5px; color: var(--slate-600); margin-top: 8px; line-height: 1.6; word-break: break-word; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.btn-ghost, .btn-danger {
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s;
}

.btn-ghost { background: var(--slate-100); color: var(--slate-700); }
.btn-ghost:hover { background: var(--slate-200); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ══ MODERN BİLDİRİMLER ═════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1200;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 290px;
  max-width: 380px;
  padding: 13px 14px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--slate-400);
  border-radius: 12px;
  box-shadow: 0 10px 24px -8px rgba(15, 23, 42, .28);
  animation: toastIn .28s cubic-bezier(.2, .9, .3, 1.1);
  transition: opacity .3s ease, transform .3s ease;
}

.toast.is-leaving { opacity: 0; transform: translateX(14px); }

.toast-icon {
  flex: 0 0 20px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-top: 1px;
}

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--slate-900); }
.toast-msg { font-size: 12.5px; color: var(--slate-600); margin-top: 2px; line-height: 1.5; word-break: break-word; }

.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--slate-400); font-size: 16px; line-height: 1;
  padding: 0 2px;
}
.toast-close:hover { color: var(--slate-700); }

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-success .toast-icon { background: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-error .toast-icon { background: var(--danger); }
.toast.toast-info { border-left-color: var(--primary); }
.toast.toast-info .toast-icon { background: var(--primary); }

@keyframes toastIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ══ DUYARLI ════════════════════════════════════════════════════════ */
@media (max-width: 1080px) {
  .portal-layout { grid-template-columns: 1fr; }
  .upload-sidebar { position: static; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; max-width: none; }
}

/* ══ BUTON STİLLERİ ═════════════════════════════════════════════════ */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .18s;
  white-space: nowrap;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* İşlem sütunu — sıkışmayı önle */
.files-table th:last-child,
.files-table td:last-child { white-space: nowrap; }

.action-btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s;
}

.btn-action svg { width: 14px; height: 14px; flex: 0 0 14px; }

.btn-download { background: var(--primary-light); color: var(--primary); border-color: #bfdbfe; }
.btn-download:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.btn-delete { background: #fff; color: var(--slate-400); padding: 6px 9px; }
.btn-delete:hover { background: var(--danger-light); color: var(--danger); border-color: #fecaca; }

.status-badge { white-space: nowrap; }
