:root {
  --navy: #0f2f56;
  --blue: #1d5f99;
  --pale: #f4f7fb;
  --line: #dbe3ee;
  --text: #1f2937;
  --muted: #667085;
  --green: #12715b;
  --red: #b42318;
  --amber: #a15c07;
  --white: #ffffff;
  --shadow: 0 10px 24px rgba(15, 47, 86, 0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--pale);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.42;
}

button, input, select, textarea { font: inherit; }

button {
  cursor: pointer;
  border: 0;
  border-radius: 7px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.topbar {
  background: var(--white);
  color: var(--navy);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.logo {
  width: 96px;
  height: 58px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav button {
  color: var(--navy);
  background: transparent;
  padding: 7px 8px;
  border-radius: 6px;
  border: 0;
}

.nav button.active,
.nav button:hover {
  background: #eef3f8;
}

main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 20px 42px;
}

.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

.hero {
  background: #e8edf3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px;
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 34px;
  align-items: center;
  overflow: hidden;
}

h1, h2, h3, h4 {
  color: var(--navy);
  margin: 0;
  letter-spacing: 0;
}

h1 { font-size: 29px; line-height: 1.14; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
h4 { font-size: 15px; margin-top: 14px; }

p { margin: 8px 0 0; color: var(--muted); }

.welcome-visual {
  margin-top: 22px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 300px;
  overflow: hidden;
}

.welcome-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-rules {
  margin: 0 0 22px;
  padding-left: 20px;
  color: #475467;
  font-weight: 700;
  line-height: 1.55;
}

.home-rules li { margin: 7px 0; }

.tender-status-box {
  display: grid;
  gap: 12px;
}

.status-toggle {
  width: 100%;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 15px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.status-toggle:hover {
  transform: translateY(-1px);
  border-color: #b8c8dc;
}

.status-toggle.active {
  border-color: var(--blue);
  background: #edf6ff;
}

.status-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}

.status-dot.green { background: #12b76a; }
.status-dot.red { background: #d92d20; }

.status-panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.status-panel.active { display: block; }

.status-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.status-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.status-list li:last-child { border-bottom: 0; }
.status-list small { display: block; margin-top: 3px; color: var(--muted); }

.notification-card {
  display: block;
}

.notification-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.notification-card p {
  margin-top: 10px;
  white-space: normal;
}

.process-cards { margin-top: 18px; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card,
.panel,
.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.process-card { position: relative; padding-top: 18px; }

.process-step {
  display: inline-flex;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: var(--white);
  font-weight: 800;
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

.grid.two,
.detail-layout {
  grid-template-columns: 0.9fr 1.1fr;
  display: grid;
  gap: 18px;
}

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

.filters {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr;
  gap: 10px;
  margin-bottom: 14px;
}

.admin-filters {
  grid-template-columns: minmax(260px, 520px);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--white);
  font-size: 13px;
}

label {
  display: block;
  color: #344054;
  font-weight: 700;
  font-size: 13px;
  margin: 12px 0 6px;
}

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

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.check input { width: auto; }

.actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.primary { background: var(--navy); color: var(--white); border-color: var(--navy); }
.secondary { background: #e9eef6; color: var(--navy); }
.outline { background: var(--white); color: var(--navy); border: 1px solid var(--line); }
.danger { background: #fee4e2; color: var(--red); }
.success { background: #dff5ed; color: var(--green); }
.finish-action { background: var(--red); color: var(--white); }

.notice {
  border-left: 4px solid var(--blue);
  background: #edf6ff;
  padding: 12px 14px;
  border-radius: 7px;
  color: #18466e;
  margin-top: 14px;
}

.kvkk-box {
  margin-top: 10px;
  color: #475467;
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 9px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #344054;
  background: #f8fafc;
  font-size: 13px;
}

tr:hover td { background: #fbfdff; }

.table-card {
  overflow-x: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.open { background: #dff5ed; color: var(--green); }
.badge.evaluation { background: #fff1d6; color: var(--amber); }
.badge.completed { background: #e9eef6; color: var(--navy); }
.badge.gray { background: #eef2f6; color: #475467; }

.deadline-countdown {
  display: block;
  margin-top: 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.deadline-countdown.urgent { color: var(--red); }
.deadline-countdown.done { color: #667085; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 24px;
  color: var(--navy);
}

.metric.green strong { color: var(--green); }
.metric.amber strong { color: #ffd400; }
.metric.red strong { color: var(--red); }
.metric span { color: var(--muted); font-size: 13px; }

.item-row {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.45fr 0.45fr 1.1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 10px;
  background: #fbfdff;
}

.item-row.no-brand {
  grid-template-columns: 1fr 0.45fr 0.45fr 1.1fr auto;
}

.import-box {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 10px 0 16px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.import-box span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.import-box .template-hint {
  color: var(--navy);
  font-weight: 700;
  font-size: 12px;
}

.item-images {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(260px, 2fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.image-help {
  color: var(--muted);
  font-size: 13px;
}

.image-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-thumb-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.image-chip img,
.image-thumb-button img {
  width: 92px;
  height: 72px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.image-chip button { padding: 7px 9px; }

.image-thumb-button.image-load-error {
  min-width: 92px;
  min-height: 72px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.image-thumb-button.image-load-error img {
  display: none;
}

.image-thumb-button.image-load-error::after {
  content: "Resim açılamadı";
  display: inline-flex;
  width: 92px;
  height: 72px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}

.offer-row {
  display: grid;
  grid-template-columns: 1.25fr 0.42fr 0.42fr 0.65fr 0.65fr 0.5fr 0.8fr 1fr;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 10px;
  background: #fbfdff;
}

.offer-row.medicine {
  grid-template-columns: 1.5fr 0.42fr 0.42fr 0.9fr 0.55fr 0.7fr 0.45fr 0.6fr 0.6fr 0.9fr;
}

.offer-row input[disabled] {
  background: #eef4fa;
  color: #33435a;
}

.offer-image-list {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px dashed #bdd0e8;
  border-radius: 8px;
  background: #f8fbff;
}

.offer-image-list strong {
  color: var(--navy);
}

.offer-image-list > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.offer-rules-box {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  background: #f8fbff;
}

.offer-rules-box h3 {
  margin-bottom: 8px;
}

.offer-rules-box pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  color: #475467;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.offer-rules-consent {
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tabs button {
  background: #e9eef6;
  color: var(--navy);
}

.tabs button.primary,
.tabs button.active {
  background: var(--navy);
  color: var(--white);
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.compare-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.5fr);
  gap: 20px;
}

.compare-layout > div:last-child {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.offer-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.offer-summary-grid div {
  background: #f4f8fc;
  border: 1px solid #d9e4f1;
  border-radius: 8px;
  padding: 10px 12px;
}

.offer-summary-grid span {
  display: block;
  color: #60708a;
  font-size: 12px;
  margin-bottom: 4px;
}

.offer-summary-grid strong {
  color: #102f55;
  font-size: 14px;
  word-break: break-word;
}

.selector-list {
  display: grid;
  gap: 10px;
}

.selector-list button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #f7fbff;
  border: 1px solid var(--line);
}

.selector-list button.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--navy);
  color: var(--white);
  padding: 18px 20px;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(16, 24, 40, 0.24);
  display: none;
  z-index: 20;
  max-width: 420px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  border-left: 6px solid #12b76a;
}

.toast.success { background: #087a55; }
.toast.error { background: var(--red); }

.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.72);
  z-index: 40;
}

.image-modal.active {
  display: flex;
}

.image-modal-content {
  position: relative;
  max-width: min(980px, 96vw);
  max-height: 92vh;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.image-modal-content img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 6px;
}

.image-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--navy);
  color: #fff;
  padding: 7px 10px;
}

@media (max-width: 900px) {
  .topbar-inner,
  .hero,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    display: grid;
  }

  .nav {
    justify-content: flex-start;
  }

  .filters,
  .form-grid,
  .cards,
  .metric-grid,
  .grid.two,
  .item-row,
  .import-box,
  .item-images,
  .offer-row,
  .offer-row.medicine,
  .compare-layout {
    grid-template-columns: 1fr;
  }

  .compare-layout > div:last-child {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .offer-summary-grid {
    grid-template-columns: 1fr;
  }

  main {
    padding: 14px;
  }
}
