/* style.css — BESAFE LAB ERP ortak stil dosyası.
   Palet (BLUEPRINT bölüm 8): lacivert #071b33, koyu mavi #0b2447, yeşil #16a34a,
   amber #f5a623, açık zemin #f6f8fb, metin #1e293b. Sistem fontları. */

:root {
  --navy: #071b33;
  --navy-dark: #0b2447;
  --green: #16a34a;
  --amber: #f5a623;
  --bg: #f6f8fb;
  --text: #1e293b;
  --border: #e2e8f0;
  --thead-bg: #f1f5f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ---------------------------------------------------------------- üst bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy) 100%);
  border-bottom: 3px solid var(--green);
  box-shadow: 0 2px 14px rgba(7, 27, 51, 0.35);
}
.topbar-row {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--green), #128a3c);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 3px 8px rgba(22, 163, 74, 0.35);
}
.brand-text {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.6px;
  line-height: 1.15;
}
.brand-text em {
  font-style: normal;
  display: block;
  color: var(--amber);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 2px;
}
.menubar {
  background: rgba(0, 0, 0, 0.22);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.menu-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 12px;
}
.menu-link {
  color: #cbd5e1;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.menu-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.menu-link.active {
  background: rgba(22, 163, 74, 0.22);
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--green);
}
.user-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.user-name { color: #e2e8f0; font-weight: 600; line-height: 1.15; }
.user-name small { display: block; color: #94a3b8; font-weight: 400; font-size: 11px; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.icon-btn svg { flex: none; }
.menu-toggle {
  display: none;
  margin-left: auto;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  cursor: pointer;
}
.menu-toggle .bar {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: #e2e8f0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open .bar:nth-child(2) { opacity: 0; }
.menu-toggle.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------------------------------------------------------------- düzen */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 19px; margin: 20px 0 10px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.muted { color: #64748b; font-size: 14px; }

/* ---------------------------------------------------------------- kartlar */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  min-width: 0; /* grid içinde içeriğin kartı genişletmesini engeller */
}
.card h3 { margin: 0 0 12px; font-size: 16px; color: var(--navy); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
/* Dashboard kartlarındaki tablolar: başlıklar sarsın, dar kartta taşma olmasın */
.card-grid .table { table-layout: fixed; width: 100%; }
.card-grid .table th,
.card-grid .table td { white-space: normal; overflow-wrap: anywhere; }
.card-grid .table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- formlar */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #334155;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.form-group textarea { min-height: 70px; resize: vertical; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 0;
  border-color: var(--green);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.checkbox { font-size: 14px; display: flex; align-items: center; gap: 6px; margin: 8px 0 14px; }
.field-error { color: #dc2626; font-size: 13px; margin-top: 4px; }

/* ---------------------------------------------------------------- butonlar */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: #128a3c; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-dark); }
.btn-outline { background: transparent; color: #e2e8f0; border-color: #475569; }
.btn-outline:hover { border-color: #94a3b8; color: #fff; }
.btn-amber { background: var(--amber); color: #fff; }
.btn-amber:hover { background: #d18d13; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-gray { background: #e2e8f0; color: #334155; }
.btn-gray:hover { background: #cbd5e1; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* ---------------------------------------------------------------- tablolar */
.table-wrap { overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}
.table th {
  text-align: left;
  background: var(--thead-bg);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: #334155;
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tbody tr:hover { background: #f8fafc; }
.table .num { text-align: right; white-space: nowrap; }
.table .total-row td { font-weight: 700; background: #f8fafc; }

/* ---------------------------------------------------------------- rozetler */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-gray { background: #e2e8f0; color: #475569; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-amber { background: #fef3c7; color: #b45309; }

/* ---------------------------------------------------------------- flash */
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
}
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ---------------------------------------------------------------- giriş */
.auth-body { background: var(--navy); min-height: 100vh; }
.auth-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 60px 16px;
}
.auth-card { border: none; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-brand { color: var(--navy); margin: 0; }
.auth-sub { color: #64748b; margin: 4px 0 20px; }
.auth-note { font-size: 13px; color: #64748b; margin-top: 14px; }
.auth-portal-link { font-size: 14px; margin-top: 6px; }

/* ---------------------------------------------------------------- detay kutuları */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 24px;
  margin-bottom: 8px;
}
.detail-grid .item { font-size: 14px; }
.detail-grid .item b { display: block; font-size: 12px; color: #64748b; font-weight: 600; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: #64748b; font-weight: 600; }
.kv dd { margin: 0; }

/* ---------------------------------------------------------------- teklif satırları */
.line-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr 70px 110px 90px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: start;
}
.line-row input, .line-row select, .line-row textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

/* ---------------------------------------------------------------- print */
.print-header { border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 16px; }
.print-header h1 { margin: 0; color: var(--navy); }
.print-meta { font-size: 14px; }
.content-text { white-space: pre-wrap; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; padding: 0; }
  .card { border: none; padding: 0; }
  .table td, .table th { border-bottom: 1px solid #cbd5e1; }
}

@media (max-width: 900px) {
  .btn-label { display: none; }
  .icon-btn { padding: 6px; }
}

@media (max-width: 720px) {
  .line-row { grid-template-columns: 1fr 1fr; }
  .topbar-row { gap: 8px; padding: 8px 12px; }
  .menu-toggle { display: flex; }
  .user-name { display: none; }
  .menu-inner {
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding: 0 12px;
  }
  .menubar.open .menu-inner {
    max-height: 640px;
    padding: 8px 12px 12px;
  }
  .menu-link { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
  .menu-link.active { box-shadow: none; }
}
