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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  color: #1a1a1a;
  background: #f5f5f3;
  min-height: 100vh;
}

/* ── LOGIN ─────────────────────────────────────── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem;
}
.login-card {
  background: #fff;
  border: 1px solid #e5e5e2;
  border-radius: 12px;
  padding: 2rem;
  width: 100%; max-width: 360px;
}
.login-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.login-sub   { font-size: 12px; color: #888; margin-bottom: 1.5rem; }

/* ── FORM ELEMENTS ─────────────────────────────── */
.fg { margin-bottom: 12px; }
.fg label { display: block; font-size: 11px; color: #666; margin-bottom: 4px; font-weight: 500; }

input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid #d8d8d5; border-radius: 6px;
  font-size: 13px; font-family: inherit; color: #1a1a1a;
  background: #fff; outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: #888; }
input[type=number].ci {
  width: 82px; padding: 4px 7px; font-size: 12px;
}

.btn-main {
  width: 100%; padding: 9px;
  background: #1a1a1a; color: #fff;
  border: none; border-radius: 7px;
  font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
}
.btn-main:hover { background: #333; }

.btn-sm {
  padding: 5px 11px;
  border: 1px solid #d8d8d5; border-radius: 6px;
  background: #fff; font-size: 12px; cursor: pointer;
  color: #1a1a1a; font-family: inherit;
  white-space: nowrap;
}
.btn-sm:hover { background: #f5f5f3; }
.btn-sm.danger { color: #c0392b; border-color: #f5c6c2; }
.btn-sm.danger:hover { background: #fff5f5; }
.btn-sm.primary { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn-sm.primary:hover { background: #333; }

.err { color: #c0392b; font-size: 12px; margin-top: 8px; min-height: 18px; }

/* ── TOPBAR ─────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #fff; border-bottom: 1px solid #e5e5e2;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 600; font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.t-name  { font-size: 13px; color: #555; }
.role-badge {
  font-size: 10px; padding: 2px 8px;
  border-radius: 20px; font-weight: 500;
  background: #e8f4fd; color: #1a6fa8;
}
.role-badge.lead { background: #f0f8ee; color: #2d7a22; }

/* ── TABS ───────────────────────────────────────── */
.tabs {
  display: flex; overflow-x: auto;
  background: #fff; border-bottom: 1px solid #e5e5e2;
  padding: 0 16px;
}
.tab {
  padding: 10px 16px; font-size: 12px; cursor: pointer;
  border-bottom: 2px solid transparent;
  color: #888; white-space: nowrap; flex-shrink: 0;
  transition: color .15s;
}
.tab:hover { color: #333; }
.tab.active { color: #1a1a1a; border-bottom-color: #1a1a1a; font-weight: 500; }

/* ── CONTENT ────────────────────────────────────── */
.content { padding: 16px; max-width: 1400px; }

/* ── STAT CARDS ─────────────────────────────────── */
.stats-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.sc {
  background: #fff; border: 1px solid #e5e5e2; border-radius: 8px;
  padding: 10px 14px; min-width: 120px;
}
.sc-label { font-size: 10px; color: #888; margin-bottom: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: .3px; }
.sc-val   { font-size: 22px; font-weight: 600; }
.sc-val.good { color: #1d7a4a; }
.sc-val.warn { color: #b07d10; }

/* ── TABLES ─────────────────────────────────────── */
.tbl-outer {
  overflow-x: auto;
  border: 1px solid #e5e5e2; border-radius: 8px;
  background: #fff; margin-bottom: 20px;
}
table { border-collapse: collapse; font-size: 12px; width: 100%; }
th {
  background: #fafaf8; padding: 8px 10px;
  text-align: left; font-weight: 500; font-size: 11px; color: #666;
  border-bottom: 1px solid #e5e5e2; white-space: nowrap;
}
td {
  padding: 6px 10px; border-bottom: 1px solid #f0f0ee;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf8; }

.metric-label { color: #555; min-width: 175px; }
.bold-metric  { font-weight: 600; color: #1a1a1a; }
.computed-cell { color: #777; }
.total-cell   { font-weight: 600; background: #fafaf8 !important; }
.total-row td { font-weight: 600; background: #fafaf8; }

/* ── PROJECT GROUP ──────────────────────────────── */
.project-group { margin-bottom: 24px; }
.project-name-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  background: #f5f5f3; border: 1px solid #e5e5e2;
  border-radius: 8px 8px 0 0; border-bottom: none;
}
.project-name  { font-weight: 600; font-size: 13px; }
.project-kpis  { font-size: 11px; color: #666; display: flex; gap: 12px; }
.project-kpis span { white-space: nowrap; }
.project-actions { display: flex; gap: 6px; }

/* ── DATE PICKER ROW ────────────────────────────── */
.date-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.date-row label { font-size: 12px; color: #666; }
.date-row input[type=date] { width: auto; font-size: 12px; }

/* ── SECTION HEADER ─────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 15px; font-weight: 600; }

/* ── USER LIST ──────────────────────────────────── */
.user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: #fff;
  border: 1px solid #e5e5e2; border-radius: 7px; margin-bottom: 6px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #e8f4fd; color: #1a6fa8;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.user-avatar.lead { background: #f0f8ee; color: #2d7a22; }
.user-info { flex: 1; }
.user-name  { font-weight: 500; font-size: 13px; }
.user-login { font-size: 11px; color: #888; }
.user-actions { display: flex; gap: 6px; }

/* ── MODAL ──────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: #fff; border-radius: 12px;
  padding: 1.5rem; width: 100%; max-width: 400px;
  max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1rem; }

/* ── EMPTY STATE ────────────────────────────────── */
.empty-state {
  padding: 2rem; text-align: center; color: #888; font-size: 13px;
}

/* ── OVERVIEW SPEC ROW ──────────────────────────── */
.spec-group-row td { font-weight: 600; background: #fafaf8; }
.proj-sub-row td:first-child { padding-left: 24px; color: #555; }

@media (max-width: 600px) {
  .project-kpis { display: none; }
  .sc-val { font-size: 18px; }
}
