/*
  Turna Yönetim Paneli
  Bu katman yalnızca görünümü iyileştirir; tablo, form ve işlem davranışları
  courier-console.js ve business-console.js içinde olduğu gibi korunur.
*/

:root {
  --panel-surface: #14161a;
  --panel-surface-raised: #1a1d22;
  --panel-surface-hover: #20242a;
  --panel-border: #30343b;
  --panel-border-soft: #252930;
  --panel-text: #f5f7fa;
  --panel-muted: #9aa3af;
  --panel-red: #e51d2a;
  --panel-red-bright: #ff4b56;
  --panel-red-soft: rgba(229, 29, 42, 0.15);
  --panel-green: #1ab982;
  --panel-shadow: 0 20px 48px rgba(0, 0, 0, 0.24);
}

#couriers .page-heading,
#businesses .page-heading {
  margin-bottom: 20px;
}

#couriers .page-heading .eyebrow,
#businesses .page-heading .eyebrow {
  color: #ff7a82;
  font-weight: 800;
  letter-spacing: 0.13em;
}

#couriers .page-heading h1,
#businesses .page-heading h1 {
  color: var(--panel-text);
  letter-spacing: -0.035em;
}

#couriers .subheading,
#businesses .subheading {
  color: var(--panel-muted);
  max-width: 68ch;
}

:where(#couriers, #businesses) .courier-console-card {
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.025), transparent 34%),
    var(--panel-surface);
  box-shadow: var(--panel-shadow);
}

:where(#couriers, #businesses) .courier-table-scroll {
  overflow: auto;
  overscroll-behavior-inline: contain;
}

:where(#couriers, #businesses) .courier-table {
  width: 100%;
  min-width: 1560px;
}

:where(#couriers, #businesses) .courier-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 84px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(10, 11, 13, 0.54);
}

:where(#couriers, #businesses) .courier-toolbar-left,
:where(#couriers, #businesses) .courier-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

:where(#couriers, #businesses) .courier-new-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--panel-red-bright);
  border-radius: 10px;
  background: linear-gradient(135deg, #f22d39, #cf0d19);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 18px rgba(229, 29, 42, 0.25);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

:where(#couriers, #businesses) .courier-new-button:hover {
  background: linear-gradient(135deg, #ff3b48, #df1320);
  box-shadow: 0 10px 22px rgba(229, 29, 42, 0.35);
  filter: none;
  transform: translateY(-1px);
}

:where(#couriers, #businesses) .courier-new-button:active {
  transform: translateY(0);
}

:where(#couriers, #businesses) .courier-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--panel-border-soft);
  border-radius: 11px;
  background: #0f1114;
}

:where(#couriers, #businesses) .courier-tabs button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--panel-muted);
  font-size: 0.78rem;
  font-weight: 700;
  transition: color 160ms ease, background 160ms ease;
}

:where(#couriers, #businesses) .courier-tabs button:hover {
  color: var(--panel-text);
  background: #1d2025;
}

:where(#couriers, #businesses) .courier-tabs button.active {
  background: var(--panel-red-soft);
  color: #ffb6bc;
  box-shadow: inset 0 0 0 1px rgba(255, 75, 86, 0.14);
}

:where(#couriers, #businesses) .courier-tabs b {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  margin-left: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 0.7rem;
}

:where(#couriers, #businesses) .courier-toolbar-right label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #cbd1da;
  font-size: 0.78rem;
  font-weight: 800;
}

:where(#couriers, #businesses) .courier-toolbar-right input {
  width: 176px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #3a3e46;
  border-radius: 9px;
  outline: 0;
  background: #101216;
  color: var(--panel-text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

:where(#couriers, #businesses) .courier-toolbar-right input::placeholder {
  color: #717985;
}

:where(#couriers, #businesses) .courier-toolbar-right input:focus {
  border-color: #f04a54;
  box-shadow: 0 0 0 3px rgba(229, 29, 42, 0.15);
}

:where(#couriers, #businesses) .table-export {
  display: inline-grid;
  width: 39px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease, filter 160ms ease;
}

:where(#couriers, #businesses) .table-export:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

:where(#couriers, #businesses) .table-export.green {
  background: linear-gradient(135deg, #20c997, #0b8d68);
}

:where(#couriers, #businesses) .table-export.red {
  background: linear-gradient(135deg, #f05259, #c5242d);
}

:where(#couriers, #businesses) .courier-table-scroll {
  scrollbar-color: #555b66 #101216;
  scrollbar-width: thin;
}

:where(#couriers, #businesses) .courier-table {
  border-collapse: separate;
  border-spacing: 0;
  color: #e9edf2;
}

:where(#couriers, #businesses) .courier-table th {
  padding: 14px 12px;
  border-color: var(--panel-border);
  background: #0c0e11;
  color: #adb6c2;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.34;
  text-transform: uppercase;
}

:where(#couriers, #businesses) .courier-table td {
  padding: 13px 12px;
  border-color: var(--panel-border-soft);
  background: rgba(20, 22, 26, 0.9);
  font-size: 0.78rem;
  line-height: 1.35;
  vertical-align: middle;
}

:where(#couriers, #businesses) .courier-table tbody tr {
  transition: background 160ms ease;
}

:where(#couriers, #businesses) .courier-table tbody tr:hover td {
  background: var(--panel-surface-hover);
}

:where(#couriers, #businesses) .courier-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--panel-red);
}

:where(#couriers, #businesses) .courier-name {
  color: #fff;
  font-size: 0.82rem;
}

:where(#couriers, #businesses) .courier-table small {
  color: #8993a0;
  font-size: 0.71rem;
  line-height: 1.45;
}

:where(#couriers, #businesses) .courier-pill,
:where(#couriers, #businesses) .courier-rate,
:where(#couriers, #businesses) .work-chip,
:where(#couriers, #businesses) .polygon-chip {
  border-radius: 999px;
  font-weight: 750;
}

:where(#couriers, #businesses) .courier-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.71rem;
}

:where(#couriers, #businesses) .courier-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

:where(#couriers, #businesses) .courier-pill.is-on {
  border-color: rgba(26, 185, 130, 0.46);
  background: rgba(15, 127, 88, 0.18);
  color: #5cf0b5;
}

:where(#couriers, #businesses) .courier-pill.is-off {
  border-color: rgba(238, 56, 65, 0.46);
  background: rgba(169, 17, 28, 0.15);
  color: #ff7c84;
}

:where(#couriers, #businesses) .courier-rate,
:where(#couriers, #businesses) .work-chip,
:where(#couriers, #businesses) .polygon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid;
  border-color: #393e47;
  background: #15181d;
  color: #d8dee7;
  font-size: 0.72rem;
}

:where(#couriers, #businesses) .courier-rate:hover,
:where(#couriers, #businesses) .work-chip:hover {
  border-color: #68717e;
  background: #22262c;
  color: #fff;
}

:where(#couriers, #businesses) .courier-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

:where(#couriers, #businesses) .courier-action {
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  box-shadow: none;
  transition: transform 160ms ease, filter 160ms ease;
}

:where(#couriers, #businesses) .courier-action.finance {
  background: #109b76;
}

:where(#couriers, #businesses) .courier-action.invoices {
  background: #2c6b9f;
}

:where(#couriers, #businesses) .courier-action.edit {
  background: #bb8414;
}

:where(#couriers, #businesses) .courier-action.active {
  background: #ba2d35;
}

:where(#couriers, #businesses) .courier-action:hover {
  filter: brightness(1.13);
  transform: translateY(-1px);
}

:where(#couriers, #businesses) .courier-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 20px;
  border-top-color: var(--panel-border-soft);
  background: #111317;
  color: #8d97a5;
  font-size: 0.75rem;
}

:where(#couriers, #businesses) .courier-empty {
  padding: 42px 22px;
  color: #8d97a5;
  font-size: 0.86rem;
}

.courier-modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(3, 4, 6, 0.76);
  backdrop-filter: blur(7px);
}

#courier-modal-layer:empty,
#business-modal-layer:empty {
  pointer-events: none;
}

.courier-modal {
  position: fixed;
  z-index: 31;
  inset: 50% auto auto 50%;
  width: min(760px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  overflow: auto;
  transform: translate(-50%, -50%);
  border: 1px solid #3a3f48;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 38%),
    #171a1f;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.courier-modal.wide {
  width: min(1040px, calc(100vw - 32px));
}

.courier-modal > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 82px;
  padding: 19px 23px;
  border-bottom-color: #30343b;
  background: rgba(11, 13, 16, 0.54);
}

.courier-modal > header p {
  color: #ff7b84;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.courier-modal > header h2 {
  color: #fff;
  letter-spacing: -0.025em;
}

.courier-modal-body {
  padding: 22px;
}

.modal-close {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #414650;
  border-radius: 9px;
  background: #20242a;
  color: #f4f5f7;
  font-size: 1.32rem;
  line-height: 1;
}

.modal-close:hover {
  border-color: #ff7079;
  background: #3a1d21;
}

.courier-card-form {
  display: grid;
  gap: 14px;
}

.courier-card-form section {
  padding: 17px;
  border: 1px solid #30343b;
  border-radius: 12px;
  background: #121419;
}

.courier-card-form section + section {
  margin-top: 14px;
}

.courier-card-form h3,
.ledger-section h3 {
  margin: 0 0 13px;
  color: #f0f3f7;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
}

.courier-card-form label {
  color: #aeb7c3;
  font-size: 0.75rem;
  font-weight: 700;
}

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

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

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

.courier-card-form input,
.courier-card-form select,
.inline-rate input,
.package-limit {
  width: 100%;
  min-height: 39px;
  padding: 0 10px;
  border-color: #3a4049;
  border-radius: 8px;
  background: #0e1014;
  color: #eef1f5;
}

.courier-card-form input:focus,
.courier-card-form select:focus,
.inline-rate input:focus,
.package-limit:focus {
  border-color: #f0505a;
  box-shadow: 0 0 0 3px rgba(229, 29, 42, 0.14);
  outline: 0;
}

.modal-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.modal-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #2f343c;
  border-radius: 8px;
  background: #171a1f;
}

.modal-checks input {
  width: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: var(--panel-red);
}

.modal-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
}

.primary-button,
.danger-button,
.secondary-button {
  min-height: 40px;
  border-radius: 9px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, #f02b37, #ce0f1a);
  box-shadow: 0 7px 16px rgba(229, 29, 42, 0.2);
}

.secondary-button {
  border-color: #3b4049;
  background: #20242a;
  color: #d9dfe7;
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid #363b44;
  border-radius: 10px;
  background: #111318;
}

.switch-field input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--panel-red);
}

.branch-form-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.branch-table-wrap {
  overflow-x: auto;
}

.branch-table {
  min-width: 780px;
}

.branch-status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
}

.branch-status.is-active {
  border-color: rgba(26, 185, 130, 0.48);
  background: rgba(15, 127, 88, 0.17);
  color: #5cf0b5;
}

.branch-status.is-passive {
  border-color: rgba(238, 56, 65, 0.48);
  background: rgba(169, 17, 28, 0.14);
  color: #ff858c;
}

.edit-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #bd8619;
  border-radius: 8px;
  background: #3a2b10;
  color: #ffd77c;
  font-size: 0.74rem;
  font-weight: 800;
}

.edit-button:hover {
  border-color: #f0b83b;
  background: #503a0f;
}

.ledger-table th {
  color: #abb4bf;
}

.ledger-table td {
  border-color: #2e333b;
}

.danger-button {
  border: 1px solid #fa5b65;
  background: #b91623;
  color: #fff;
}

.payment-cell {
  white-space: nowrap;
}

.payment-button {
  width: 34px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: #7954b7;
  color: #fff;
}

.mini-switch {
  display: inline-flex;
  width: 29px;
  height: 17px;
  margin-left: 7px;
  vertical-align: middle;
}

.mini-switch input {
  position: absolute;
  opacity: 0;
}

.mini-switch span {
  position: relative;
  width: 100%;
  border-radius: 99px;
  background: #60646b;
  transition: background 160ms ease;
}

.mini-switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 160ms ease;
}

.mini-switch input:checked + span {
  background: #1aae7d;
}

.mini-switch input:checked + span::after {
  transform: translateX(12px);
}

.inline-rate {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 92px;
}

.inline-rate input {
  min-width: 0;
}

.inline-rate button {
  min-height: 31px;
  padding: 0 8px;
  border: 1px solid #fa6c74;
  border-radius: 7px;
  background: #3c1b20;
  color: #ffc0c4;
  font-size: 0.68rem;
  font-weight: 800;
}

.package-limit {
  width: 62px;
}

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

.finance-metrics article {
  padding: 14px;
  border: 1px solid #333842;
  border-radius: 10px;
  background: #111318;
}

.finance-metrics span,
.finance-metrics strong {
  display: block;
}

.finance-metrics span {
  color: #98a2b0;
  font-size: 0.72rem;
  font-weight: 700;
}

.finance-metrics strong {
  margin-top: 7px;
  color: #f5f7fa;
  font-size: 1rem;
}

.ledger-section {
  margin-top: 20px;
}

.ledger-scroll {
  overflow: auto;
  border: 1px solid #30353e;
  border-radius: 10px;
}

.ledger-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.ledger-table th,
.ledger-table td {
  padding: 11px 12px;
  text-align: left;
}

.ledger-table th {
  background: #101216;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ledger-table td {
  background: #171a1f;
}

.positive-money {
  color: #62e9b5;
  font-weight: 800;
}

.negative-money {
  color: #ff7d85;
  font-weight: 800;
}

.invoice-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #4d5562;
  border-radius: 99px;
  color: #d9dfe7;
  font-size: 0.7rem;
  font-weight: 750;
}

.confirm-box {
  color: #cbd2dc;
  line-height: 1.6;
}

.confirm-box strong {
  color: #fff;
}

:where(#couriers, #businesses) button:focus-visible,
.courier-modal button:focus-visible,
.courier-modal input:focus-visible,
.courier-modal select:focus-visible {
  outline: 3px solid rgba(255, 97, 107, 0.72);
  outline-offset: 2px;
}

@media (max-width: 1080px) {
  :where(#couriers, #businesses) .courier-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  :where(#couriers, #businesses) .courier-toolbar-right {
    width: 100%;
  }
}

@media (max-width: 680px) {
  :where(#couriers, #businesses) .courier-toolbar {
    padding: 14px;
  }

  :where(#couriers, #businesses) .courier-toolbar-left,
  :where(#couriers, #businesses) .courier-toolbar-right {
    align-items: stretch;
    flex-wrap: wrap;
    width: 100%;
  }

  :where(#couriers, #businesses) .courier-new-button {
    width: 100%;
  }

  :where(#couriers, #businesses) .courier-tabs {
    width: 100%;
  }

  :where(#couriers, #businesses) .courier-tabs button {
    flex: 1;
  }

  :where(#couriers, #businesses) .courier-toolbar-right label {
    width: 100%;
  }

  :where(#couriers, #businesses) .courier-toolbar-right input {
    flex: 1;
    width: auto;
  }

  .courier-modal-body,
  .courier-modal > header {
    padding-left: 16px;
    padding-right: 16px;
  }

  .courier-modal {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .modal-grid.two,
  .modal-grid.three,
  .modal-checks,
  .finance-metrics {
    grid-template-columns: 1fr;
  }

  .modal-wide-field {
    grid-column: auto;
  }

  .modal-form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal-form-actions button {
    width: 100%;
  }

  :where(#couriers, #businesses) .courier-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-top: 11px;
    padding-bottom: 11px;
  }
}
