/* Salon CRM — общий стиль
   Палитра:
   --bg          #F6F5F3  фон
   --surface     #FFFFFF  карточки/панели
   --ink         #232323  основной текст
   --muted       #6B6B6B  вторичный текст
   --line        #E4E1DC  границы
   --accent      #0F7A6E  тизна (акцент бренда — доходы, кнопки)
   --accent-dark #0B5C53
   --danger      #B4483A  расходы / удаление
   --warn        #B8862E  план / предупреждения
*/

:root {
  --bg: #f6f5f3;
  --surface: #ffffff;
  --ink: #232323;
  --muted: #6b6b6b;
  --line: #e4e1dc;
  --accent: #0f7a6e;
  --accent-dark: #0b5c53;
  --danger: #b4483a;
  --warn: #b8862e;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--accent-dark);
}

/* ---------- Layout ---------- */

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

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--ink);
  color: #f2f2f0;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 18px;
  padding: 0 24px 24px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #3a3a3a;
  margin-bottom: 12px;
}

.sidebar .brand span {
  color: #5fc9bb;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar nav a {
  color: #d8d6d2;
  text-decoration: none;
  padding: 11px 24px;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover {
  background: #2d2d2d;
}

.sidebar nav a.active {
  background: #2d2d2d;
  border-left-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.sidebar .logout {
  margin-top: auto;
  padding: 11px 24px;
  font-size: 13px;
}

.sidebar .logout a {
  color: #a9a9a9;
}

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1180px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 22px;
  margin: 0;
}

.page-header .user-badge {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 16px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 26px;
  font-weight: 700;
}

.stat-card .value.positive { color: var(--accent-dark); }
.stat-card .value.negative { color: var(--danger); }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Forms ---------- */

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}

input, select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-width: 140px;
}

textarea {
  min-width: 220px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}

button:hover {
  background: var(--accent-dark);
}

button.btn-danger {
  background: transparent;
  color: var(--danger);
  padding: 4px 8px;
  font-weight: 500;
  font-size: 13px;
}

button.btn-danger:hover {
  background: #fbeae7;
}

button.btn-secondary {
  background: #eceae6;
  color: var(--ink);
}

button.btn-secondary:hover {
  background: #ddd9d3;
}

a.btn-secondary {
  display: inline-block;
  background: #eceae6;
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 18px;
  font-weight: 600;
  text-decoration: none;
}

a.btn-secondary:hover {
  background: #ddd9d3;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

td.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

td.amount.income { color: var(--accent-dark); }
td.amount.expense { color: var(--danger); }

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 24px 0;
  text-align: center;
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef0ee;
  color: var(--muted);
}

.pill.inactive {
  background: #f4e6e4;
  color: var(--danger);
}

/* ---------- Category chips (expenses page) ---------- */

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef0ee;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 6px 5px 14px;
  font-size: 13px;
}

.category-chip form {
  display: inline-flex;
  margin: 0;
}

.category-chip button {
  background: transparent;
  border: none;
  color: var(--muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.category-chip button:hover {
  background: #fbeae7;
  color: var(--danger);
}

.category-add-form {
  margin-bottom: 0;
}

/* progress bar for plan page */
.progress-track {
  background: #eceae6;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: 100%;
  max-width: 200px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
}

.progress-fill.over {
  background: var(--warn);
}

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}

.login-card {
  background: var(--surface);
  padding: 40px 36px;
  border-radius: var(--radius);
  width: 320px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.login-card .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-card .field {
  margin-bottom: 14px;
}

.login-card input {
  width: 100%;
}

.login-card button {
  width: 100%;
  margin-top: 6px;
}

.error-msg {
  background: #fbeae7;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; padding: 12px 0; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .main { padding: 20px; }
}
