/* Файл: C:\!Oleksii\projects\bm-sto\app\static\css\app.css
   Призначення: стилі обліку — світла тема, великі торкальні цілі, mobile-first. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: #1c1c1e;
  background: #f2f2f5;
}
a { color: #8a6a1f; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Шапка --- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  padding: .5rem .9rem;
  background: #14141a;
  color: #eee;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar a { color: #ddd; }
.brand {
  font-weight: 800;
  letter-spacing: .06em;
  color: #d4a94e !important;
  font-size: 1.05rem;
}
.mainnav { display: flex; flex-wrap: wrap; gap: .15rem; }
.mainnav a {
  padding: .45rem .6rem;
  border-radius: 8px;
  white-space: nowrap;
}
.mainnav a:hover { background: #2a2a33; text-decoration: none; }
.whoami { margin-left: auto; font-size: .85rem; color: #aaa; }
.whoami a { color: #d4a94e; }

main { max-width: 1080px; margin: 0 auto; padding: 1rem .8rem 3rem; }

/* --- Картки й сітки --- */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card h1, .card h2 { margin-top: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem 1rem; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* --- Форми --- */
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .6rem; }
.field label { font-size: .82rem; color: #555; }
input, select, textarea {
  font: inherit;
  padding: .55rem .6rem;
  border: 1px solid #c9c9d0;
  border-radius: 8px;
  background: #fff;
  min-width: 0;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #d4a94e;
  border-color: #d4a94e;
}
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: flex-end;
  margin-bottom: .8rem;
}
.filters .field { margin-bottom: 0; flex: 1 1 130px; }

/* --- Кнопки --- */
.btn, button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: .55rem 1rem;
  background: #14141a;
  color: #f5d78a;
  font-weight: 600;
}
.btn:hover, button:hover { filter: brightness(1.2); text-decoration: none; }
.btn-secondary { background: #e4e4ea; color: #1c1c1e; }
.btn-danger { background: #a92222; color: #fff; }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; font-weight: 500; }
a.btn { display: inline-block; }

/* --- Таблиці --- */
.table-wrap { overflow-x: auto; }
table.list { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.list th, table.list td {
  text-align: left;
  padding: .5rem .55rem;
  border-bottom: 1px solid #e7e7ec;
  vertical-align: top;
}
table.list th { font-size: .78rem; text-transform: uppercase; color: #777; }
table.list tr:hover td { background: #fafaf2; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.total-row td { font-weight: 700; border-top: 2px solid #ccc; }

/* --- Статуси --- */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-new { background: #e3ecff; color: #1d4fa1; }
.badge-in_progress { background: #fff3d6; color: #8a6a1f; }
.badge-ready { background: #def7e0; color: #1e7d32; }
.badge-done { background: #e4e4ea; color: #555; }

/* --- Дашборд --- */
.statgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .6rem;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .8rem;
  border-radius: 10px;
  background: #f7f7fa;
  border: 1px solid #e4e4ea;
  text-decoration: none !important;
}
.stat:hover { border-color: #d4a94e; }
.stat-num { font-size: 1.35rem; font-weight: 800; color: #1c1c1e; }
.stat-label { font-size: .8rem; color: #777; }

/* --- Дрібне --- */
.muted { color: #888; font-size: .9rem; }
.error {
  background: #fde8e8;
  color: #a92222;
  padding: .6rem .8rem;
  border-radius: 8px;
}
.success {
  background: #def7e0;
  color: #1e7d32;
  padding: .6rem .8rem;
  border-radius: 8px;
}
/* Підказка, а не помилка: пояснює цифру, яка сама по собі вводить в оману. */
.notice {
  background: #fdf4e0;
  color: #7a5a12;
  padding: .7rem .9rem;
  border-left: 4px solid #d4a94e;
  border-radius: 8px;
  line-height: 1.5;
  margin-bottom: .8rem;
}
.notice a { color: #7a5a12; }
.pagehead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .8rem;
}
.pagehead h1 { margin: 0; }

/* --- Логін --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #14141a;
}
.login-card { width: min(360px, 92vw); text-align: center; }
.login-card h1 { color: #8a6a1f; letter-spacing: .08em; }
.login-card form { text-align: left; }
