/* =========================================================
   RetourHub — müşteri paneli (sadece ekip için)
   ========================================================= */
:root {
  --brand-500: #1212A6;
  --brand-600: #0C0C80;
  --brand-100: #D9DAF6;
  --brand-50:  #EEEFFC;
  --navy-900: #0B0B57;
  --navy-50:  #F3F4FC;
  --text: #14142E;
  --muted: #5C5E80;
  --border: #E2E3F0;
  --white: #FFFFFF;
  --red-600: #C62F35;
  --red-50:  #FDEDEE;
  --amber-700: #8A5A00;
  --amber-50: #FFF6DB;
  --green-700: #13804A;
  --green-50: #E7F8EE;
  --gray-50: #F1F2F6;
  --radius: 14px;
  --shadow: 0 10px 30px -12px rgba(11, 11, 87, .22), 0 2px 6px -2px rgba(11, 11, 87, .08);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--navy-50); -webkit-font-smoothing: antialiased; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1.5px solid transparent; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s, transform .12s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand-500); color: var(--white); }
.btn-primary:hover { background: var(--brand-600); }
.btn-outline { background: var(--white); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--brand-500); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--gray-50); }
.btn-light { background: var(--white); color: var(--brand-500); }
.btn-danger-ghost { background: transparent; color: var(--red-600); padding-left: 0; padding-right: 0; }
.btn-danger-ghost:hover { text-decoration: underline; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--gray-50); font-size: 22px; line-height: 1; cursor: pointer; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(800px 500px at 80% 0%, rgba(80, 90, 255, .3), transparent 60%), var(--navy-900); }
.login-card { width: 100%; max-width: 380px; background: var(--white); border-radius: 20px; padding: 32px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5); display: grid; gap: 8px; }
.login-logo { width: 200px; height: auto; margin: 0 auto 8px; }
.login-card h1 { font-size: 22px; text-align: center; }
.login-card .muted { text-align: center; margin-bottom: 12px; font-size: 14px; }
.login-card label { font-size: 13px; font-weight: 700; margin-top: 4px; }
.login-card input { padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--navy-50); font-size: 16px; }
.login-card input:focus { outline: none; border-color: var(--brand-500); background: var(--white); }
.login-card .btn { margin-top: 12px; padding: 12px; }
.login-demo { font-size: 13px; text-align: center; background: var(--brand-50); color: var(--navy-900); padding: 8px 10px; border-radius: 10px; }
.login-error { min-height: 1.4em; color: var(--red-600); font-size: 14px; font-weight: 600; text-align: center; }

/* ---------- Top bar ---------- */
.topbar { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 14px; height: 64px; }
.topbar-logo img { height: 38px; width: auto; display: block; }
.topbar-title { font-weight: 700; color: var(--muted); padding-left: 14px; border-left: 1px solid var(--border); }
.topbar .btn { margin-left: auto; }
@media (max-width: 480px) { .topbar-title { display: none; } }

.demo-banner { background: var(--brand-500); color: var(--white); font-size: 14px; }
.demo-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; padding-bottom: 10px; }

.main { padding-top: 24px; padding-bottom: 60px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
button.stat { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
button.stat:hover { border-color: var(--brand-100); box-shadow: var(--shadow); }
button.stat.is-active { border-color: var(--brand-500); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 13px; }
.stat-danger .stat-value { color: var(--red-600); }
.stat-warn .stat-value { color: var(--amber-700); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 24px 0 14px; }
.toolbar input, .toolbar select { padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--white); font-size: 15px; }
.toolbar input { flex: 1 1 260px; min-width: 0; }
.toolbar select { flex: 0 1 200px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--brand-500); }
.toolbar-actions { display: flex; gap: 10px; margin-left: auto; }
@media (max-width: 640px) {
  .toolbar select { flex: 1 1 140px; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { flex: 1; }
}

/* ---------- Table ---------- */
.table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.customers { width: 100%; border-collapse: collapse; }
.customers th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--gray-50); padding: 12px 14px; }
.customers td { padding: 14px; border-top: 1px solid var(--border); vertical-align: top; }
.customers td small { display: block; color: var(--muted); font-size: 13px; }
.customers tr.is-cancelled td { opacity: .55; }
.customers tbody tr:hover { background: #FAFAFE; }
.actions { text-align: right; min-width: 290px; }
.actions .btn { margin: 3px 0 3px 6px; white-space: nowrap; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

.plan-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--brand-50); color: var(--brand-500); }
.plan-growth { background: var(--brand-500); color: var(--white); }
.plan-scale { background: var(--navy-900); color: var(--white); }
.plan-custom { background: var(--gray-50); color: var(--text); }

.badge { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.badge-ok { background: var(--green-50); color: var(--green-700); }
.badge-soon { background: var(--amber-50); color: var(--amber-700); }
.badge-overdue { background: var(--red-50); color: var(--red-600); }
.badge-cancelled, .badge-unknown { background: var(--gray-50); color: var(--muted); }
.customers td > strong + .badge { display: block; width: max-content; }

.status { font-size: 13px; font-weight: 700; }
.status-active { color: var(--green-700); }
.status-trial { color: var(--brand-500); }
.status-cancelled { color: var(--muted); }
.status-pending { color: var(--brand-500); }
.badge-pending { background: var(--brand-50); color: var(--brand-500); }
.customers tr.is-pending { background: #F7F7FF; }
.customers td small.online { color: var(--green-700); font-weight: 600; }

/* new registrations bar */
.pending-bar {
  width: 100%; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 14px 18px; text-align: left;
  background: var(--brand-500); color: var(--white); border: 0; border-radius: var(--radius); cursor: pointer; font-size: 15px;
}
.pending-bar:hover { background: var(--brand-600); }
.pending-dot { width: 10px; height: 10px; border-radius: 50%; background: #7CF0A8; box-shadow: 0 0 0 4px rgba(124, 240, 168, .25); flex: none; }
.pending-go { margin-left: auto; font-weight: 800; white-space: nowrap; }

/* table -> cards on small screens */
@media (max-width: 900px) {
  .customers thead { display: none; }
  .customers, .customers tbody, .customers tr, .customers td { display: block; }
  .customers tr { padding: 14px 16px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .customers tbody tr:first-child { border-top: 0; }
  .customers td { padding: 0; border: 0; }
  .customers td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .customers td:first-child { grid-column: 1 / -1; font-size: 16px; }
  .actions { grid-column: 1 / -1; text-align: left; white-space: normal; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
  .actions .btn { margin: 0; }
  .customers td { overflow-wrap: anywhere; }
}

/* ---------- Modal ---------- */
.modal { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); color: var(--text); }
.modal::backdrop { background: rgba(7, 7, 51, .55); }
.modal form { display: flex; flex-direction: column; max-height: inherit; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 8px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--gray-50); }
.spacer { flex: 1; }
fieldset { border: 0; padding: 0; margin: 14px 0 6px; }
legend { font-weight: 800; font-size: 15px; margin-bottom: 8px; padding: 0; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--navy-50); font-size: 15px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand-500); background: var(--white); }
.field textarea { resize: vertical; }
.modal-body > .field { margin-top: 12px; }
.hint { margin-top: 10px; font-size: 13px; color: var(--muted); background: var(--brand-50); padding: 10px 12px; border-radius: 10px; }
@media (max-width: 480px) { .modal-foot { flex-wrap: wrap; } .modal-foot .spacer { display: none; } .modal-foot .btn-primary, .modal-foot .btn-outline { flex: 1; } }

/* ---------- Customer detail (parcels + payments) ---------- */
.modal-wide { width: min(1080px, calc(100vw - 24px)); }
.detail-wrap { display: flex; flex-direction: column; max-height: inherit; }
.detail-wrap .modal-body { padding-top: 16px; }
.d-tabs { flex: none; display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.d-tabs::-webkit-scrollbar { display: none; }
.d-tabs button { flex: none; white-space: nowrap; border: 0; background: none; padding: 12px 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
.d-tabs button.is-active { color: var(--brand-500); border-bottom-color: var(--brand-500); }
.d-tabs em { font-style: normal; font-size: 12px; background: var(--gray-50); padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.d-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.d-form { background: var(--navy-50); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; display: grid; gap: 12px; }
.d-form h3 { margin: 0; font-size: 16px; }
.d-form .field input, .d-form .field select, .d-form .field textarea { background: var(--white); }
.grid-3 { display: grid; gap: 12px; }
@media (min-width: 620px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.d-form-foot { display: flex; justify-content: flex-end; gap: 10px; }
.photo-edit { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.photo-edit:empty { display: none; }
.photo-edit figure { position: relative; margin: 0; width: 84px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--white); }
.photo-edit img { width: 100%; height: 100%; object-fit: cover; }
.photo-edit button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(7, 7, 51, .8); color: var(--white); font-size: 14px; line-height: 1; cursor: pointer; }
.photo-edit figure.is-new { outline: 2px solid var(--brand-500); }
.upload-status { font-weight: 600; color: var(--brand-500); font-size: 14px; }
.upload-status:empty { display: none; }

.d-list { display: grid; gap: 10px; }
.d-parcel { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.d-thumbs { display: flex; gap: 4px; }
.d-thumbs img, .d-thumbs span { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: var(--gray-50); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.d-parcel strong { display: block; }
.d-parcel small { display: block; color: var(--muted); font-size: 13px; }
.d-parcel .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.d-parcel .actions { display: flex; gap: 6px; }
@media (max-width: 640px) {
  .d-parcel { grid-template-columns: 1fr; }
  .d-parcel .actions { justify-content: flex-start; }
}
.tag-request { background: #FFF4DB; color: #8A5A00; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--gray-50); }
.tag-stored { background: var(--brand-50); color: var(--brand-500); }
.tag-reshipped { background: var(--green-50); color: var(--green-700); }
.tag-good { background: var(--green-50); color: var(--green-700); }
.tag-opened { background: var(--amber-50); color: var(--amber-700); }
.tag-damaged { background: var(--red-50); color: var(--red-600); }
.table-scroll { overflow-x: auto; }
.d-table { width: 100%; border-collapse: collapse; }
.d-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--border); }
.d-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.d-table .num { text-align: right; font-weight: 700; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy-900); color: var(--white); padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); z-index: 100; max-width: calc(100vw - 32px); }
.toast.is-error { background: var(--red-600); }

/* ---------- Open customer requests (re-ship / send back) ---------- */
.requests { margin-bottom: 18px; padding: 18px; border-radius: var(--radius); background: #FFFBF0; border: 1px solid #F3D98B; }
.requests h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.requests > .muted { margin: 4px 0 14px; font-size: 14px; }
.req-count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: #E0A100; color: #fff; font-size: 13px; }
.req-list, #d-requests { display: grid; gap: 10px; }
#d-requests { margin-bottom: 16px; }
#d-requests[hidden] { display: none; }
#d-requests h3 { font-size: 15px; }
.req-item { display: grid; grid-template-columns: 1.2fr 1.4fr auto; gap: 12px 18px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--white); border: 1px solid var(--border); border-left: 4px solid #E0A100; }
.req-item.req-reship { border-left-color: var(--brand-500); }
.req-main { display: grid; gap: 2px; min-width: 0; }
.req-main small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.req-items { margin: 2px 0; padding-left: 18px; font-size: 14px; overflow-wrap: anywhere; }
.req-items li { margin: 1px 0; }
.req-items b { font-weight: 700; color: var(--brand-500); }
.req-type { justify-self: start; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #FFF4DB; color: #8A5A00; }
.req-reship .req-type { background: var(--brand-50); color: var(--brand-500); }
.req-address { white-space: pre-line; font-size: 14px; overflow-wrap: anywhere; }
.req-address span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.req-address em { display: block; margin-top: 4px; font-style: normal; color: var(--muted); font-size: 13px; }
.req-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.customers td small.req-flag { color: #B27A00; font-weight: 700; }
@media (max-width: 760px) {
  .req-item { grid-template-columns: 1fr; }
  .req-actions { justify-content: flex-start; }
}

/* ---------- Price + prepayment on requests, extra charges tab ---------- */
.req-price { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.req-price input { width: 84px; padding: 7px 9px; border-radius: 8px; border: 1.5px solid var(--border); font: inherit; font-size: 14px; color: var(--text); }
.req-price input:focus { outline: none; border-color: var(--brand-500); }
.req-prepay { flex-basis: 100%; margin: 0; color: #B42318; font-size: 13px; font-weight: 700; text-align: right; }
.req-paid { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.charge-sum { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: var(--gray-50); font-size: 14px; }
.charge-sum .req-prepay { text-align: left; }
@media (max-width: 760px) { .req-prepay { text-align: left; } }
.req-item.req-upgrade { border-left-color: #13A05B; }
.req-upgrade .req-type { background: #E7F8EE; color: #13804A; }
.req-item.req-cancel { border-left-color: #B42318; }
.req-cancel .req-type { background: #FDECEA; color: #B42318; }

/* ---------- Customer list: click a row to open the customer ---------- */
.customers tr.row-open { cursor: pointer; }
.customers tr.row-open:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.customers td .badge { display: block; width: max-content; margin-top: 4px; }
.customers .row-go { width: 32px; vertical-align: middle; text-align: right; font-size: 24px; color: var(--muted); }
.customers tr.row-open:hover .row-go { color: var(--brand-500); }
@media (max-width: 760px) {
  .customers tr { grid-template-columns: 1fr 1fr auto; }
  .customers .row-go { grid-row: 1; grid-column: 3; align-self: center; }
}

/* ---------- Customer overview tab ---------- */
.ov-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ov-requests:empty { display: none; }
.ov-requests { display: grid; gap: 10px; margin-bottom: 16px; }
.ov-ship { margin: 0; padding: 12px 14px; border-radius: 10px; background: #FFFBF0; border: 1px solid #F3D98B; font-weight: 600; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--brand-500); cursor: pointer; }
.ov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ov-card { padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--white); }
.ov-card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ov-facts { display: grid; gap: 8px; margin: 0; }
.ov-facts div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.ov-facts dt { color: var(--muted); font-size: 14px; }
.ov-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.ov-facts .badge { margin-left: 4px; }
.ov-facts .ok { color: var(--green-700); }
.ov-facts .warn { color: #B27A00; }
.pre { white-space: pre-line; }
.ov-notes { grid-column: 1 / -1; }
.ov-notes p { margin: 0; }
@media (max-width: 760px) {
  .ov-grid { grid-template-columns: 1fr; }
  .ov-facts div { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Customer code, expected returns, dispose ---------- */
.code-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--brand-50); color: var(--brand-500); font-size: 12px; font-weight: 800; letter-spacing: .02em; vertical-align: middle; }
.customers td small.exp-flag { color: var(--brand-500); font-weight: 700; }
#d-expected { display: grid; gap: 8px; margin-bottom: 16px; padding: 14px; border-radius: 12px; background: var(--brand-50); }
#d-expected[hidden] { display: none; }
#d-expected h3 { font-size: 15px; margin: 0 0 4px; }
.exp-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--white); border: 1px solid var(--border); }
.exp-item small { display: block; color: var(--muted); font-size: 13px; }
.exp-item .actions { display: flex; gap: 6px; }
.tag-disposed { background: var(--gray-50); color: var(--muted); }
.req-item.req-dispose { border-left-color: var(--muted); }
.req-dispose .req-type { background: var(--gray-50); color: var(--muted); }
