/* =====================================================
   BELLY Coffee CRM — minimalistyczny styl
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f5f0;
  --surface:   #ffffff;
  --border:    #e2e0da;
  --text:      #1a1a1a;
  --muted:     #6b6b6b;
  --accent:    #3b1f0e;     /* ciemna kawa */
  --accent-lt: #7a4520;
  --green:     #2d6a4f;
  --red:       #c0392b;
  --orange:    #e67e22;
  --blue:      #2471a3;
  --radius:    6px;
  --shadow:    0 1px 3px rgba(0,0,0,.08);
  --font:      'Segoe UI', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

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

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--accent);
  color: #f0ebe5;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-logo {
  padding: 22px 20px 16px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  color: #fff;
}

.sidebar-logo small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  opacity: .65;
  margin-top: 2px;
}

.sidebar nav { flex: 1; padding: 12px 0; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.78);
  font-size: 14px;
  transition: background .15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}

.sidebar nav a .icon { font-size: 16px; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 13px;
  color: rgba(255,255,255,.55);
}

.sidebar-footer a { color: rgba(255,255,255,.7); }
.sidebar-footer .user-name { color: #fff; font-weight: 600; display: block; margin-bottom: 4px; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 18px; font-weight: 600; white-space: nowrap; }

.topbar h1 { font-size: 20px; font-weight: 600; }

.content { padding: 28px; flex: 1; overflow-y: auto; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ---- Stats row ---- */
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  flex: 1;
  min-width: 160px;
}

.stat-card .val { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat-card.accent .val { color: var(--accent); }
.stat-card.green  .val { color: var(--green);  }
.stat-card.orange .val { color: var(--orange); }
.stat-card.red    .val { color: var(--red);    }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }

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

thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  background: #faf9f7;
}

tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #faf9f7; }

.td-actions { white-space: nowrap; text-align: right; }
.td-actions a, .td-actions button { margin-left: 8px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s;
  line-height: 1.3;
}

.btn:hover { opacity: .85; text-decoration: none; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-danger    { background: var(--red);    color: #fff; }
.btn-success   { background: var(--green);  color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 5px 8px; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--muted); }
.form-group.full { grid-column: 1 / -1; }

input, select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  width: 100%;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-lt);
}

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

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Lead status badges */
.badge-lead-new           { background: #edf2f7; color: #4a5568; }
.badge-lead-offer_sent    { background: #ebf8ff; color: #2b6cb0; }
.badge-lead-reminder_sent { background: #fefcbf; color: #744210; }
.badge-lead-reminder2_sent{ background: #fef3c7; color: #92400e; }
.badge-lead-acquired      { background: #f0fff4; color: #22543d; }
.badge-lead-lost          { background: #fff5f5; color: #742a2a; }

.badge-overdue  { background: #fff5f5; color: var(--red); }
.badge-done     { background: #f0fff4; color: var(--green); }
.badge-pending  { background: #fffbeb; color: #92400e; }

/* Szybki formularz oferty w topbarze */
.quick-offer-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
  max-width: 480px;
  margin: 0 20px;
}
.quick-offer-form input {
  width: auto;
  flex: 1;
  padding: 7px 10px;
  font-size: 13px;
}
.quick-offer-form .btn { white-space: nowrap; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 14px;
}

.alert-success { background: #f0fff4; border: 1px solid #9ae6b4; color: #22543d; }
.alert-error   { background: #fff5f5; border: 1px solid #feb2b2; color: #742a2a; }
.alert-info    { background: #ebf8ff; border: 1px solid #90cdf4; color: #2a4365; }

/* ---- Pipeline board ---- */
.pipeline { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }

.pipeline-col {
  min-width: 220px;
  flex: 1;
  background: #faf9f7;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pipeline-col-header {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pipeline-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }

.deal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
}

.deal-card .deal-title { font-weight: 600; margin-bottom: 4px; }
.deal-card .deal-meta  { color: var(--muted); font-size: 12px; }
.deal-card .deal-value { font-weight: 700; color: var(--accent); margin-top: 6px; }

/* ---- Detail view ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.detail-row { display: contents; }
.detail-label { font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 500; }
.detail-value { font-size: 14px; padding: 4px 0; }

/* ---- Notes ---- */
.note-item {
  border-left: 3px solid var(--border);
  padding: 8px 14px;
  margin-bottom: 10px;
}

.note-item .note-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.note-item .note-content { font-size: 14px; white-space: pre-wrap; }

/* ---- Search bar ---- */
.search-bar { display: flex; gap: 8px; margin-bottom: 18px; }
.search-bar input { max-width: 320px; }

/* ---- Pagination (placeholder) ---- */
.empty { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }

/* ---- Login page ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 360px;
  box-shadow: var(--shadow);
}

.login-box .logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.login-box .sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .sidebar-logo { padding: 14px; }
  .sidebar-logo span, .sidebar nav a span, .sidebar-footer .user-name { display: none; }
  .sidebar nav a { padding: 12px; justify-content: center; }
  .content { padding: 16px; }
  .stats { flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
}
