:root {
  --green: #16a34a;
  --green-dark: #15803d;
  --green-light: #dcfce7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --red: #dc2626;
  --red-light: #fee2e2;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --orange: #ea580c;
  --orange-light: #ffedd5;
  --radius: 16px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
  font-size: 17px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------- topbar --- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-size: 30px; line-height: 1; }
.brand-name { font-weight: 800; font-size: 18px; }
.brand-sub { font-size: 13px; color: var(--gray-500); }
.tabs {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.tab {
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-500);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--green-dark); border-bottom-color: var(--green); }

/* ---------------------------------------------------------- container --- */
.container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 40px;
  flex: 1;
}
.footer {
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
  padding: 16px;
}

/* --------------------------------------------------------------- cards --- */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-head h2 { font-size: 22px; font-weight: 800; }
.muted { color: var(--gray-500); font-size: 14px; }

/* --------------------------------------------------------------- stats --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.green { background: var(--green-light); }
.stat-icon.blue { background: var(--blue-light); }
.stat-icon.orange { background: var(--orange-light); }
.stat-icon.red { background: var(--red-light); }
.stat-label { font-size: 13px; color: var(--gray-500); }
.stat-value { font-weight: 800; font-size: 18px; }

/* --------------------------------------------------------------- forms --- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 14px 14px;
  font-size: 18px;
  border: 2px solid var(--gray-300);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  color: var(--gray-900);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* --------------------------------------------------------------- buttons - */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  background: var(--green);
  color: #fff;
  min-height: 52px;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--green-dark); }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-lg { font-size: 20px; padding: 18px 24px; min-height: 60px; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost {
  background: transparent;
  color: var(--green-dark);
  min-height: auto;
  padding: 8px 12px;
  font-size: 15px;
}
.btn-ghost:hover { background: var(--green-light); }
.btn-sm { padding: 8px 12px; font-size: 15px; min-height: 40px; }

/* ---------------------------------------------------------------- table --- */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  margin-bottom: 8px;
}
.list-item .item-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list-item .item-title { font-weight: 700; }
.list-item .item-sub { font-size: 13px; color: var(--gray-500); }
.item-right { text-align: right; display: flex; align-items: center; gap: 10px; }
.qty-badge {
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 10px;
  white-space: nowrap;
}
.amount { font-weight: 800; color: var(--green-dark); white-space: nowrap; }
.amount.red { color: var(--red); }
.inline-actions { display: flex; gap: 6px; }

/* --------------------------------------------------------------- badges --- */
.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }

/* --------------------------------------------------------------- alerts --- */
.alert {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
}
.alert-error { background: var(--red-light); color: #991b1b; }
.alert-success { background: var(--green-light); color: var(--green-dark); }
.alert-info { background: var(--blue-light); color: #1e40af; }

/* -------------------------------------------------------------- worker --- */
.worker-hero {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.worker-hero h2 { font-size: 22px; }
.worker-hero .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.worker-hero .cell { background: rgba(255,255,255,0.18); border-radius: 12px; padding: 10px; text-align: center; }
.worker-hero .cell .lbl { font-size: 12px; opacity: 0.9; }
.worker-hero .cell .val { font-size: 18px; font-weight: 800; }

/* ---------------------------------------------------------------- login --- */
.login-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 16px;
}
.login-logo {
  width: 84px; height: 84px;
  background: var(--green);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  margin: 0 auto 16px;
}
.login-wrap h1 { text-align: center; font-size: 26px; }
.login-wrap .sub { text-align: center; color: var(--gray-500); margin-bottom: 24px; }

/* ------------------------------------------------------------- workers --- */
.worker-card {
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fff;
}
.worker-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.avatar {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--green-light); color: var(--green-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px;
}
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] .worker-card { box-shadow: var(--shadow); }
.chevron { transition: transform 0.2s; color: var(--gray-500); }
details[open] .chevron { transform: rotate(180deg); }

.bread-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.bread-row input { flex: 1; }
.remove-row {
  background: var(--red-light); color: var(--red); border: none;
  width: 44px; height: 44px; border-radius: 10px; font-size: 20px; cursor: pointer;
  flex-shrink: 0;
}

.empty { text-align: center; color: var(--gray-500); padding: 30px 10px; }
.empty .icon { font-size: 40px; display: block; margin-bottom: 8px; }

@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
