/* ============================================================
   İthalat Takip - Tema (BadBoy ERP tarzı)
   Koyu lacivert sidebar + teal vurgu, açık içerik alanı.
   ============================================================ */

:root {
  --brand:        #0ea5a4;
  --brand-dark:   #0c8f8e;
  --brand-soft:   rgba(14, 165, 164, .12);

  --sidebar:      #12232f;
  --sidebar-2:    #0e1c26;
  --sidebar-line: rgba(255, 255, 255, .07);
  --sidebar-txt:  #9fb3c0;
  --sidebar-txt-active: #ffffff;

  --bg:           #eef1f5;
  --card:         #ffffff;
  --text:         #0f1e2b;
  --muted:        #64748b;
  --line:         #e4e8ee;

  --green:  #10b981;  --green-bg:  #e7f7f0;
  --red:    #ef4444;  --red-bg:    #fdeaea;
  --amber:  #f59e0b;  --amber-bg:  #fdf3e2;
  --blue:   #3b82f6;  --blue-bg:   #e9f0fe;
  --violet: #8b5cf6;  --violet-bg: #f0ebfe;
  --teal:   #14b8a6;  --teal-bg:   #e4f7f4;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,30,43,.04), 0 4px 16px rgba(16,30,43,.04);
}

* { box-sizing: border-box; }

/* İkon boyutlandırma (varsayılan + bağlama özel) */
svg.ico { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.stat-icon svg { width: 20px; height: 20px; }
.brand-logo svg, .auth-logo svg { width: 22px; height: 22px; color: #06262a; }
.tl-dot svg { width: 14px; height: 14px; }
.pill svg, .chip svg, .btn svg, .card-head svg, .banner .title svg, .badge svg { width: 15px; height: 15px; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------- App iskeleti ----------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: var(--sidebar-txt);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--sidebar-line);
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), #17c3b2);
  display: grid; place-items: center;
  color: #06262a; font-weight: 800; font-size: 18px;
}
.brand-name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub { color: var(--sidebar-txt); font-size: 11px; }

.nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { padding: 12px 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: rgba(159,179,192,.65); }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--sidebar-txt); font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.10); color: var(--sidebar-txt-active); }
.nav-item .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid var(--sidebar-line); font-size: 11px; color: var(--sidebar-txt); }

/* ----------------------- İçerik ----------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 24px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .firma { font-size: 13px; color: var(--muted); }
.topbar .firma b { color: var(--text); }
.topbar .spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
.pill.green { color: #0a7d55; border-color: #bfe9d6; background: #eefaf4; }
.pill.date { background: #0f1e2b; color: #fff; border-color: #0f1e2b; }
.pill.rate { color: #0a7d55; border-color: #bfe9d6; background: #eefaf4; }

.content { padding: 24px; flex: 1; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ----------------------- Kart ----------------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

/* ----------------------- İstatistik kartları ----------------------- */
.stat-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 20px;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  display: block; color: var(--text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
a.stat:hover { border-color: var(--brand); box-shadow: 0 2px 14px rgba(14,165,164,.12); text-decoration: none; }
a.stat:active { transform: scale(.99); }
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 14px;
}
.stat .val { font-size: 24px; font-weight: 700; letter-spacing: -.4px; }
.stat .val small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat .sub { color: #94a3b8; font-size: 11.5px; margin-top: 6px; }

.i-green  { background: var(--green-bg);  color: var(--green); }
.i-red    { background: var(--red-bg);    color: var(--red); }
.i-teal   { background: var(--teal-bg);   color: var(--teal); }
.i-blue   { background: var(--blue-bg);   color: var(--blue); }
.i-amber  { background: var(--amber-bg);  color: var(--amber); }
.i-violet { background: var(--violet-bg); color: var(--violet); }

/* ----------------------- Aksiyon banner ----------------------- */
.banner {
  background: linear-gradient(180deg, #162a38, #12232f);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; color: #cbd5e1;
}
.banner .title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #e2e8f0; margin-bottom: 12px; font-size: 13.5px; }
.banner .chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); color: #e2e8f0;
}
.chip.green { color: #6ee7b7; border-color: rgba(16,185,129,.3); background: rgba(16,185,129,.10); }
.chip.amber { color: #fcd34d; border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.10); }
.chip.red   { color: #fca5a5; border-color: rgba(239,68,68,.3);  background: rgba(239,68,68,.10); }

/* ----------------------- Tablo ----------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 11px 16px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: #f8fafc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.text-amber { color: var(--amber); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

/* ----------------------- Rozet (durum) ----------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid; white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.st-slate   { color:#475569; background:#f1f5f9; border-color:#e2e8f0; }
.st-violet  { color:#7c3aed; background:#f3efff; border-color:#e6ddff; }
.st-amber   { color:#b45309; background:#fef6e7; border-color:#fbe4bd; }
.st-yellow  { color:#a16207; background:#fefbe8; border-color:#fbeeb0; }
.st-orange  { color:#c2410c; background:#fff1e8; border-color:#ffd9bd; }
.st-cyan    { color:#0e7490; background:#e8fbff; border-color:#bdeefb; }
.st-blue    { color:#1d4ed8; background:#eaf1ff; border-color:#cddffb; }
.st-rose    { color:#be123c; background:#fff0f3; border-color:#fbccd6; }
.st-teal    { color:#0f766e; background:#e6faf7; border-color:#bdefe8; }
.st-emerald { color:#047857; background:#e7f8f0; border-color:#bde9d3; }

/* ----------------------- Butonlar ----------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { color: var(--red); border-color: #f6c9c9; }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn .ico { width: 16px; height: 16px; }

/* ----------------------- Form ----------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.col-2 { grid-column: 1 / -1; }
label.lbl { font-size: 12.5px; font-weight: 600; color: #334155; }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea { resize: vertical; min-height: 76px; }
.field-err { color: var(--red); font-size: 12px; }

/* ----------------------- Timeline ----------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot {
  width: 24px; height: 24px; border-radius: 999px; border: 2px solid var(--line);
  background: #fff; display: grid; place-items: center; cursor: pointer;
  color: transparent; transition: .15s;
}
.tl-dot.done, .tl-dot.current { border-color: transparent; color: #fff; }
.tl-line { width: 2px; flex: 1; background: var(--line); min-height: 10px; }
.tl-line.filled { background: var(--brand); }
.tl-btn {
  background: none; border: 0; text-align: left; padding: 3px 8px 14px; cursor: pointer;
  color: var(--muted); font-size: 13px; font-family: inherit; flex: 1; border-radius: 8px;
}
.tl-btn:hover { color: var(--text); }
.tl-item.is-current .tl-btn { color: var(--text); font-weight: 600; }
.tl-current-tag { color: var(--brand-dark); font-size: 11px; margin-left: 6px; font-weight: 600; }
.dotbg-slate{background:#94a3b8}.dotbg-violet{background:#8b5cf6}.dotbg-amber{background:#f59e0b}
.dotbg-yellow{background:#eab308}.dotbg-orange{background:#f97316}.dotbg-cyan{background:#06b6d4}
.dotbg-blue{background:#3b82f6}.dotbg-rose{background:#f43f5e}.dotbg-teal{background:#14b8a6}
.dotbg-emerald{background:#10b981}

/* ----------------------- Yardımcılar ----------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; align-items: start; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.mt { margin-top: 20px; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; font-size: 13px; }
.divide > * + * { border-top: 1px solid var(--line); }
.divide > * { padding: 12px 0; }
.divide > *:first-child { padding-top: 0; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.summary .box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fafbfc; }
.summary .box .k { font-size: 11.5px; color: var(--muted); }
.summary .box .v { font-size: 15px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* İçerik bilgi ızgarası (detay) */
.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.info .k { font-size: 11.5px; color: var(--muted); }
.info .v { font-weight: 600; margin-top: 2px; word-break: break-word; }

/* Sekmeler */
.tabs { display: inline-flex; gap: 4px; background: #eef1f5; padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.tab {
  padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--muted); border: 0; background: transparent; font-family: inherit;
}
.tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.tab-panel { display: none; margin-top: 16px; }
.tab-panel.active { display: block; }

/* Flash / uyarı */
.flash-wrap { position: fixed; top: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 12px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow); border: 1px solid; min-width: 260px; background: #fff;
}
.flash.success { border-color: #bde9d3; color: #047857; background: #f0fbf5; }
.flash.error   { border-color: #f6c9c9; color: #b91c1c; background: #fdf2f2; }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.alert.error { border-color: #f6c9c9; color: #b91c1c; background: #fdf2f2; }

/* ----------------------- Giriş / kurulum ----------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-logo {
  width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--brand), #17c3b2); color: #06262a;
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
}
.auth-head h1 { margin: 0; font-size: 19px; }
.auth-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ----------------------- Mobil menü (hamburger + drawer) ----------------------- */
.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--text); cursor: pointer; flex-shrink: 0;
}
.menu-btn svg { width: 20px; height: 20px; }
.drawer-overlay {
  display: none; position: fixed; inset: 0; background: rgba(4, 15, 24, .5); z-index: 55;
}

/* ----------------------- Responsive ----------------------- */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 260px; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 50px rgba(0, 0, 0, .35);
  }
  .sidebar.open { transform: none; }
  .drawer-overlay.show { display: block; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .summary { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* iOS'ta odaklanınca yakınlaşmayı engelle + dokunma hedefleri */
  .input, .select, .textarea { font-size: 16px; height: auto; padding: 11px 12px; }
  .btn { padding: 11px 16px; }
  .btn-sm { padding: 8px 12px; }
  .topbar { position: sticky; top: 0; }
}

/* Tabloyu kart görünümüne çevir */
@media (max-width: 720px) {
  .table.responsive thead { display: none; }
  .table.responsive tbody tr { display: block; padding: 12px 14px; }
  .table.responsive tbody tr:hover { background: transparent; }
  .table.responsive tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 6px 0; border: 0; text-align: right;
  }
  .table.responsive tbody td::before {
    content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left;
  }
  .table.responsive tbody td.hide-sm { display: flex; }
  .table.responsive tbody td:first-child { font-size: 15px; padding-bottom: 8px; }
}

@media (max-width: 560px) {
  .content { padding: 14px; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .topbar .firma { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  /* Kartları kompakt: ikon solda, sayı sağda */
  .stat { display: flex; align-items: center; gap: 12px; padding: 13px; }
  .stat .stat-icon { margin-bottom: 0; width: 38px; height: 38px; }
  .stat .val { font-size: 20px; }
  .stat .lbl { font-size: 11.5px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 19px; }
  .hide-sm { display: none; }
  .pill { padding: 7px 10px; }

  /* Kart başlığındaki arama/filtre çubuğunu dikey ve tam genişlik yap */
  .card-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .card-head form.row { flex-direction: column; align-items: stretch; width: 100%; }
  .card-head form.row > div { width: 100%; }
  .card-head form.row .input,
  .card-head form.row .select { width: 100% !important; }

  /* Uzun başlık + butonlar mobilde alt alta */
  .page-head.row.between { flex-direction: column; align-items: stretch; gap: 12px; }
}
