* { box-sizing: border-box; }

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e7e9f0;
  --text: #2b2e38;
  --text-muted: #868c99;
  --blue: #2f6fed;
  --blue-soft: #eaf1ff;
  --blue-dark: #1d4ed8;
  --orange: #e8734a;
  --orange-soft: #fdece2;
  --green-soft: #dcf4e8;
  --green-text: #16794a;
  --shadow: 0 1px 2px rgba(30, 34, 54, 0.05), 0 4px 14px rgba(30, 34, 54, 0.06);
}

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

/* ---- Logo ---- */
.logo { display: flex; align-items: center; gap: 0.65rem; }
.logo-mark { width: 34px; height: 26px; flex-shrink: 0; }
.logo-lg .logo-mark { width: 68px; height: 52px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title {
  font-weight: 700; font-size: 0.75rem; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--text); white-space: nowrap;
}
.logo-lg .logo-title { font-size: 1.15rem; }
.logo-tagline { font-size: 0.66rem; color: var(--text-muted); white-space: nowrap; }
.logo-lg .logo-tagline { font-size: 0.85rem; }
.logo-link { text-decoration: none; }

/* ---- Header ---- */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 1.75rem; flex-wrap: wrap; row-gap: 0.4rem; }
.header-left nav { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
header a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; white-space: nowrap; }
header a:hover { color: var(--blue); }
.header-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; display: flex; align-items: center; gap: 0.4rem; }
.role-chip {
  background: var(--blue-soft); color: var(--blue-dark);
  border-radius: 999px; padding: 0.1rem 0.5rem; font-size: 0.68rem; text-transform: uppercase;
  white-space: nowrap;
}
/* The header logo stays a single-line wordmark — the tagline only appears on the login page. */
.header-left .logo-tagline { display: none; }
.header-left .logo-title { font-size: 0.85rem; }

main { padding: 1.75rem; max-width: 1100px; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); font-weight: 600; }
tbody tr:hover { background: var(--bg); }

.badge {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #eef0f5;
  color: #4b5265;
}
.badge-new { background: var(--blue-soft); color: var(--blue-dark); }
.badge-in_progress { background: #fef3d6; color: #93690b; }
.badge-awaiting_decision { background: #ede9fe; color: #6d28d9; }
.badge-waiting { background: var(--orange-soft); color: #b1502b; }
.badge-closed { background: var(--green-soft); color: var(--green-text); }
.badge-rejected { background: #eef0f5; color: #6b7280; }
.badge-spam { background: #f3f4f6; color: #9ca3af; }

form.inline { display: inline; }

input, select, button {
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

button {
  background: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s ease;
}
button:hover { opacity: 0.9; }
button.secondary { background: #eef0f5; color: var(--text); font-weight: 500; }

.error {
  color: #b1502b; background: var(--orange-soft);
  padding: 0.6rem 0.9rem; border-radius: 8px; margin-bottom: 1rem;
}
.notice {
  color: var(--green-text); background: var(--green-soft);
  padding: 0.6rem 0.9rem; border-radius: 8px; margin-bottom: 1rem;
}

.field { margin-bottom: 0.85rem; display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.8rem; color: var(--text-muted); }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: end; }

.bell { position: relative; }
.bell .count {
  position: absolute; top: -6px; right: -12px;
  background: var(--orange); color: #fff; border-radius: 999px;
  font-size: 0.62rem; padding: 0 5px; font-weight: 600;
}

/* ---- Product search ---- */
.criteria-row {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.75rem;
  background: var(--bg);
}
.remove-row-btn, .toggle-filters-btn { align-self: center; }

.row-filters {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}
.warehouse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem 1rem;
}
.checkbox-label {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.88rem; font-weight: 400; color: var(--text);
}
.checkbox-label input { width: auto; padding: 0; }

.thumb {
  width: 44px; height: 44px; object-fit: cover; border-radius: 6px;
  display: block; background: #eef0f5;
}
.thumb-empty { border: 1px dashed var(--border); }

.clickable-row { cursor: pointer; }
.desc-row td {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.88rem;
  white-space: pre-line;
}

/* ---- Incoming call screen-pop ---- */
.incoming-calls {
  position: fixed;
  top: 4.5rem;
  right: 1.5rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 300px;
}
.incoming-call-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--blue);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
  animation: call-pop-in 0.2s ease-out;
}
@keyframes call-pop-in {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.call-dismiss {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 0.85rem; padding: 0.1rem 0.4rem; cursor: pointer;
}
.call-phone { font-weight: 700; font-size: 1rem; padding-right: 1.2rem; }
.call-source { margin-top: 0.5rem; }

/* ---- Reports ---- */
.stat-tile {
  flex: 1;
  min-width: 160px;
  text-align: center;
}
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.stat-bar {
  background: var(--bg);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.stat-bar-fill {
  background: var(--blue);
  height: 100%;
  border-radius: 999px;
}

/* ---- Login page ---- */
.login-wrap {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 4.5rem;
}
.login-logo { margin-bottom: 1.75rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { margin-top: 0; font-size: 1.15rem; }
