:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --primary:#2563eb;
  --primary-2:#1d4ed8;
  --border:#e5e7eb;
  --sidebar:#0b1220;
  --sidebar-2:#0f172a;
}

*{ box-sizing:border-box; }
body{ margin:0; font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif; background:var(--bg); color:var(--text); }

a{ color:inherit; }

.app{ display:flex; min-height:100vh; }

.sidebar{
  width:270px;
  background:linear-gradient(180deg,var(--sidebar),var(--sidebar-2));
  color:#e2e8f0;
  padding:18px 14px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.sidebar-brand{ display:flex; gap:12px; align-items:center; padding:8px 10px; border-radius:14px; background:rgba(255,255,255,0.06); }
.logo{ width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:rgba(37,99,235,0.25); color:#fff; font-weight:800; }
.brand-title{ font-weight:800; letter-spacing:0.2px; }
.brand-sub{ font-size:12px; color:#94a3b8; margin-top:2px; }

.nav{ display:flex; flex-direction:column; gap:6px; padding:0 6px; }
.nav-section{ margin-top:10px; font-size:11px; text-transform:uppercase; letter-spacing:0.12em; color:#94a3b8; padding:6px 8px; }
.navlink{
  display:flex; align-items:center;
  padding:10px 10px;
  border-radius:12px;
  text-decoration:none;
  color:#cbd5e1;
}
.navlink:hover{ background:rgba(255,255,255,0.08); color:#fff; }

.sidebar-footer{ margin-top:auto; padding:10px 10px; border-radius:14px; background:rgba(255,255,255,0.06); }
.muted-small{ font-size:11px; color:#94a3b8; }
.small{ font-size:13px; }

.main{ flex:1; display:flex; flex-direction:column; }
.top{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 24px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
}

/*
  Use full available width for all main page content.
  (Previously we used a fixed max-width which made pages feel "narrow" on wide screens.)
*/
.container{ max-width:100%; margin:0; padding:22px 24px; width:100%; }

.page-header{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:14px; }
.page-header h1{ margin:0; font-size:26px; }
.muted{ color:var(--muted); margin:6px 0 0; }

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  box-shadow: 0 8px 18px rgba(15,23,42,0.04);
}

.card-link{ text-decoration:none; display:block; transition: transform 0.06s ease; }
.card-link:hover{ transform: translateY(-2px); }

.grid-2{ display:grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap:14px; }
.grid-3{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:14px; }
.grid-span-2{ grid-column: 1 / span 2; }

@media (max-width: 980px){
  .sidebar{ width:220px; }
  .grid-3{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px){
  .app{ flex-direction:column; }
  .sidebar{ width:auto; }
  .grid-2, .grid-3{ grid-template-columns: 1fr; }
  .grid-span-2{ grid-column:auto; }
}

.btn{
  display:inline-block;
  padding:10px 14px;
  background:var(--primary);
  color:#fff;
  border-radius:12px;
  text-decoration:none;
  border:none;
  cursor:pointer;
  font-weight:600;
}
.btn:hover{ background:var(--primary-2); }
.btn.tiny{ padding:6px 10px; border-radius:10px; font-size:12px; }
.btn.danger{ background:#ef4444; }
.btn.danger:hover{ background:#dc2626; }
.btn.secondary{ background:#e2e8f0; color:#0f172a; }
.btn.secondary:hover{ background:#cbd5e1; }
.toolbar{ display:flex; gap:10px; flex-wrap:wrap; margin: 10px 0 14px; }
.actions{ display:flex; gap:10px; flex-wrap:wrap; }

/* Stacked buttons (e.g. konfigurator okien actions) */
.btn-stack{
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:flex-start;
}
.btn-stack form{ margin:0; }

.pill{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  background:#eef2ff;
  color:#3730a3;
  border:1px solid #e0e7ff;
}

.link{ color:var(--primary-2); text-decoration:none; font-weight:600; }
.link:hover{ text-decoration:underline; }

.badge{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  font-size:11px;
  background:#f1f5f9;
  color:#334155;
  border:1px solid var(--border);
}
.badge.ok{ background:#ecfdf5; border-color:#a7f3d0; color:#065f46; }

.badge.warn{ background:#fffbeb; border-color:#fcd34d; color:#92400e; }

/* Green dot used next to "Konfigurator" visit counters on the project list. */
.badge .dot{ display:inline-block; width:8px; height:8px; border-radius:999px; background:#94a3b8; margin-right:6px; position:relative; top:-1px; }
.badge.ok .dot{ background:#22c55e; }
.badge.warn .dot{ background:#f59e0b; }

.details-summary{ cursor:pointer; color:var(--primary-2); font-weight:600; }
.details-box summary{ list-style:none; }
.details-box summary::-webkit-details-marker{ display:none; }

.form label{ display:block; font-size:12px; color:var(--muted); margin-bottom:6px; }
/*
  IMPORTANT:
  Do not apply "text input" styling to checkboxes/radios.
  Otherwise they become huge due to padding/width rules.
*/
.form input:not([type="checkbox"]):not([type="radio"]), .form select, .form textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  outline:none;
}
.form textarea{ min-height: 90px; resize: vertical; }
.form input:not([type="checkbox"]):not([type="radio"]):focus, .form select:focus, .form textarea:focus{
  border-color:#93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.12);
}

/* Form validation */
.form .errorlist{ margin:6px 0; padding:0; list-style:none; color:#b91c1c; font-size:12px; }
.form .errorlist li{ margin:0; }
.form .errorlist + input:not([type="checkbox"]):not([type="radio"]),
.form .errorlist + select,
.form .errorlist + textarea{ border-color:#ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,0.12); }

/* Form building blocks (used in offer line edit/add forms) */
.form .field{ display:flex; flex-direction:column; }
.form-actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }

.form .checkbox-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
}
.form .checkbox-row label{ display:inline; margin:0; font-size:13px; color:var(--text); font-weight:700; }
.form .checkbox-row input[type="checkbox"],
.form .checkbox-row input[type="radio"]{ width:18px; height:18px; margin:0; }

.alert{ background:#fff1f2; border:1px solid #fecdd3; padding:10px 12px; border-radius:12px; color:#9f1239; }
.help{ font-size:11px; color:var(--muted); margin-top:6px; }


.table-scroll{ overflow-x:auto; max-width:100%; }
.team-table{ width:100%; table-layout: fixed; }
.team-table td, .team-table th{ overflow-wrap:anywhere; word-break: break-word; }
.team-table details{ max-width: 100%; }
.team-table details .form{ min-width: 0; max-width: 100%; }
.team-table details .grid-2{ grid-template-columns: 1fr; }

.table{ width:100%; border-collapse: collapse; }
.table th, .table td{ padding:10px 8px; border-bottom:1px solid var(--border); text-align:left; vertical-align:top; }
.table th{ color:var(--muted); font-size:12px; font-weight:700; }
.table .right{ text-align:right; }

.messages{ list-style:none; padding:0; }
.messages li{ background:#ecfeff; border:1px solid #cffafe; padding:10px 12px; border-radius:12px; margin-bottom:10px; }

/* --- Team page (Users) --- */
.team-card__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.team-card__title{ margin:0; font-size:20px; }
.team-card__actions{ display:flex; gap:8px; flex-wrap:wrap; }

.team-view{ display:none; }
.team-view.active{ display:block; }

/* Scroll only vertically inside the users list panel. */
.team-users-list{
  max-height: calc(100vh - 320px);
  overflow-y:auto;
  border:1px solid var(--border);
  border-radius:12px;
}

/* Keep header visible while scrolling the user list. */
.team-users-list thead th{
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

.team-subtitle{ margin: 4px 0 10px; font-size:18px; }

/* Column widths to avoid horizontal scrolling. */
.team-table--users{ table-layout: fixed; }
.team-table--users th:nth-child(1),
.team-table--users td:nth-child(1){ width:42%; }
.team-table--users th:nth-child(2),
.team-table--users td:nth-child(2){ width:18%; }
.team-table--users th:nth-child(3),
.team-table--users td:nth-child(3){ width:22%; }
.team-table--users th:nth-child(4),
.team-table--users td:nth-child(4){ width:10%; }
.team-table--users th:nth-child(5),
.team-table--users td:nth-child(5){ width:8%; }


/* Anonymous visit cards on project detail (configurator). */
.visit-list{ display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:10px; margin-top:10px; }
.visit-card{ border:1px solid var(--border); border-radius:14px; padding:10px 12px; background:#fff; }
.visit-line{ display:flex; gap:8px; font-size:12px; line-height:1.35; margin:3px 0; }
.visit-label{ color:var(--muted); min-width:110px; font-weight:700; }
.visit-value{ color:var(--text); }
