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

:root {
  --green: #41AF64;
  --green-dark: #1e5e38;
  --green-light: #EAF1D4;
  --cream: #FBFBFB;
  --black: #0C0903;
  --gold: #E8C46A;
  --white: #fff;
  --gray: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f5f4;
  --danger: #dc2626;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--black);
  background: var(--bg);
  line-height: 1.5;
  font-size: 14px;
}

.boot { padding: 80px; text-align: center; color: var(--gray); }

/* ===== Auth (login / wizard) ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(150deg, #217a40 0%, #2d8f4e 40%, #1e6b38 100%);
}
.auth-card {
  background: var(--white);
  border-radius: 20px;
  padding: 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.auth-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.auth-card .sub { color: var(--gray); margin-bottom: 24px; font-size: 13px; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: #16331f;
  color: #cfe3d6;
  padding: 22px 14px;
  display: flex; flex-direction: column;
}
.sidebar .brand { font-weight: 800; color: #fff; font-size: 17px; padding: 6px 12px 22px; letter-spacing: -0.3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px;
  color: #cfe3d6; text-decoration: none; cursor: pointer;
  font-weight: 600; font-size: 14px; margin-bottom: 3px;
  border: none; background: none; width: 100%; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: var(--green); color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .user { font-size: 12px; color: #8fb39c; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 10px; }
.sidebar .user b { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 18px; font-weight: 800; }
.content { padding: 28px; flex: 1; }

/* ===== Components ===== */
.card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 18px; }
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--gray); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 9px;
  font-family: inherit; font-size: 14px; background: var(--cream); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(65,175,100,0.12); background: #fff; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: 9px; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 14px;
  background: var(--green); color: #fff;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:hover { background: #38a05a; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--green-dark); border: 1.5px solid var(--border); }
.btn.ghost:hover { background: var(--cream); }
.btn.danger { background: var(--danger); } .btn.danger:hover { background: #b91c1c; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); font-weight: 700; }
tr:last-child td { border-bottom: none; }
.table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: 14px; overflow-x: auto; }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 100px; }
.badge.green { background: var(--green-light); color: var(--green-dark); }
.badge.gray { background: #eef0ef; color: var(--gray); }
.badge.gold { background: #fbf2d8; color: #8a6d1e; }

.msg { padding: 10px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; }
.msg.error { background: #fdecec; color: var(--danger); }
.msg.ok { background: var(--green-light); color: var(--green-dark); }
.muted { color: var(--gray); }
.empty { padding: 40px; text-align: center; color: var(--gray); }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(12,9,3,0.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; overflow-x: hidden; box-shadow: 0 24px 64px rgba(0,0,0,0.25); scrollbar-width: thin; scrollbar-color: rgba(12,9,3,0.18) transparent; }
/* Тонкий ненав'язливий скролбар замість товстого системного (з'являється лише на низьких вікнах). */
.modal::-webkit-scrollbar { width: 7px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: rgba(12,9,3,0.16); border-radius: 7px; }
.modal::-webkit-scrollbar-thumb:hover { background: rgba(12,9,3,0.28); }
.modal.wide { max-width: 640px; }
.modal h3 { font-size: 17px; font-weight: 800; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.input-reveal { display: flex; gap: 8px; }
.input-reveal .input { flex: 1; }

@media (max-width: 720px) {
  .sidebar { width: 64px; padding: 16px 8px; }
  .sidebar .brand, .nav-item span, .sidebar .user { display: none; }
  .nav-item { justify-content: center; }
  .content { padding: 16px; }
}
