:root {
  --bg: #eef3fb;
  --text: #182436;
  --muted: #667085;
  --line: #d9e2ef;
  --white: #ffffff;
  --primary: #2157f2;
  --primary-hover: #1946ce;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, #d8e7ff 0%, transparent 42%),
    var(--bg);
}

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

.sidebar {
  background: #0f172a;
  color: #dbe7ff;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 6px 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.sidebar-brand h1 {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
  letter-spacing: 0.8px;
}

.sidebar-brand p {
  margin: 4px 0 0;
  color: #a6b6d4;
  font-size: 0.86rem;
}

.menu {
  margin-top: 14px;
  display: grid;
  gap: 6px;
}

.menu a {
  text-decoration: none;
  color: #c9d9f8;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.93rem;
  transition: 0.2s ease;
}

.menu a:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.menu a.active {
  background: #1d4ed8;
  color: #fff;
}

.menu .logout-link {
  margin-top: 10px;
  color: #fecaca;
}

.main-content {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 18px 45px rgba(30, 41, 59, 0.06);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ccdaee;
  background: linear-gradient(130deg, #ffffff 0%, #f3f7ff 100%);
}

.topbar h2 {
  margin: 0;
  border: 0;
  padding: 0;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  background: #e3ecff;
  color: #2147ba;
  border: 1px solid #bfd2ff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  padding-bottom: 8px;
  border-bottom: 1px dashed #d5dfec;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.list-header h2 {
  margin: 0;
  border: 0;
  padding: 0;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #324054;
}

.field-hint {
  margin-top: 4px;
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.profile-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 14px;
}

.profile-fields {
  display: grid;
  gap: 10px;
}

.logo-preview-card {
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(155deg, #f8fbff 0%, #eef5ff 100%);
}

.logo-preview-card h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: #1d4ed8;
}

.logo-preview-frame {
  min-height: 190px;
  border: 1px dashed #aac3f7;
  border-radius: 12px;
  background: repeating-linear-gradient(
    45deg,
    #f1f6ff,
    #f1f6ff 10px,
    #eaf2ff 10px,
    #eaf2ff 20px
  );
  display: grid;
  place-items: center;
  padding: 12px;
}

.logo-preview-frame img {
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(30, 64, 175, 0.15));
}

#logoPreviewPlaceholder {
  font-size: 1.4rem;
  letter-spacing: 3px;
  font-weight: 800;
  color: #6b7280;
}

.logo-preview-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d4dcec;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #7aa2ff;
  box-shadow: 0 0 0 3px rgba(56, 127, 245, 0.16);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.04s ease, background 0.2s ease;
}

button:hover {
  background: var(--primary-hover);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #edf2ff;
  color: #2643a1;
  border: 1px solid #d7e0fa;
}

button.secondary:hover {
  background: #e4ecff;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: var(--danger-hover);
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.items-toolbar {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d8e1ef;
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 840px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e6edf7;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

th {
  background: #f3f7ff;
  color: #273a58;
  font-weight: 700;
}

tbody tr:nth-child(odd) {
  background: #fafcff;
}

tbody tr:hover {
  background: #eef4ff;
}

.totals {
  margin-top: 14px;
  margin-left: auto;
  width: min(360px, 100%);
  border: 1px solid #d6e1f0;
  border-radius: 12px;
  background: #f9fbff;
  padding: 12px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #d8e1ef;
}

.totals div:last-child {
  border-bottom: 0;
  font-size: 1.04rem;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: min(450px, 100%);
}

.login-card h1 {
  margin: 0 0 8px;
}

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

.alert {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 9px;
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: 13px;
}

@media (max-width: 1140px) {
  .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu .logout-link {
    margin-top: 0;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .grid.two,
  .grid.three,
  .grid.four,
  .menu {
    grid-template-columns: 1fr;
  }
}

/* ── TEMA SEÇİCİ ─────────────────────────────────────── */
.theme-picker { margin-top: 24px; }
.theme-picker h3 { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 12px; }

.theme-options {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.theme-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.theme-card input[type="radio"] { display: none; }
.theme-card span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: color .2s;
}

.theme-preview {
  width: 140px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: border-color .2s, box-shadow .2s;
}
.theme-card input[type="radio"]:checked ~ .theme-preview {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(33,87,242,.2);
}
.theme-card input[type="radio"]:checked ~ span { color: var(--primary); font-weight: 700; }

/* Klasik tema önizleme */
.classic-preview { background: #fff; }
.classic-preview .tp-header { height: 28px; background: linear-gradient(135deg, #c8dce8 0%, #0a2248 100%); }
.classic-preview .tp-banner { height: 14px; background: #0f2745; border-top: 2px solid #c9a83c; border-bottom: 2px solid #c9a83c; }
.classic-preview .tp-body { padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.classic-preview .tp-row { height: 8px; border-radius: 2px; background: #e8edf3; }
.classic-preview .tp-row.dark { background: #0f2745; }

/* Modern tema önizleme */
.modern-preview { background: #fff; }
.modern-preview .tp-topbar { height: 5px; background: #0d6e6e; }
.modern-preview .tp-header-modern { height: 30px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.modern-preview .tp-body { padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.modern-preview .tp-row { height: 8px; border-radius: 2px; background: #e6f4f4; }
.modern-preview .tp-row.teal { background: #0d6e6e; }
.modern-preview .tp-row.teal-light { background: #b2dfdb; }

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  button {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border-color: #d1d5db;
  }
}
