/* ==== БАЗОВЫЕ СТИЛИ ==== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #dbe4ee;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --radius: 10px;
}
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 900px; margin: 0 auto; padding: 24px 16px; }

/* ==== ТОПБАР ==== */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.topbar-inner { max-width: 900px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.topnav { display: flex; align-items: center; gap: 8px; }
.topnav a { padding: 8px 12px; border-radius: 6px; font-size: 0.9rem; color: var(--text-muted); }
.topnav a:hover { background: var(--bg); color: var(--primary); text-decoration: none; }
.topnav a.active { background: var(--primary); color: white; }
.topnav a.active:hover { background: var(--primary-hover); }

/* ==== КНОПКИ ==== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: background 0.15s, transform 0.05s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ==== ФОРМЫ ==== */
.login-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; max-width: 400px; margin: 60px auto; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 4px; text-align: center; }
.subtitle { color: var(--text-muted); text-align: center; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text); }
.form-group input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; transition: border-color 0.15s, box-shadow 0.15s; }
.form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.error-message { color: var(--danger); font-size: 0.85rem; margin-top: 12px; text-align: center; padding: 8px; background: #fef2f2; border-radius: 6px; }

/* ==== ПРОФИЛЬ ==== */
.profile-header { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }
.profile-header h2 { margin-bottom: 16px; }
.profile-meta { display: grid; grid-template-columns: 1fr; gap: 12px; }
.profile-meta dt { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.profile-meta dd { font-weight: 500; }

/* ==== ТАБЛИЦЫ ==== */
.weigh-section, .rating-section, .chart-section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }
.weigh-section h3, .rating-section h2, .chart-section h2 { margin-bottom: 16px; }
.hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; background: var(--bg); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
tr.today td { background: #eff6ff; }
tr.future td { color: var(--text-muted); }
tr.current-user { background: #fff7ed; }
tr.current-user:hover td { background: #ffedd5; }
td input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
td input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
td input:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
.diff { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; color: var(--text-muted); }
.empty { text-align: center; color: var(--text-muted); padding: 32px !important; }

/* ==== ГРАФИКИ ==== */
.chart-wrapper { position: relative; height: 400px; }
.chart-wrapper.large { height: 500px; }
.chart-controls { display: flex; gap: 16px; margin-bottom: 16px; font-size: 0.9rem; }
.chart-controls label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ==== ВИДЖЕТ ЖИВОТНОГО ==== */
.animal-widget { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 24px; margin-top: 24px; text-align: center; }
.animal-widget h3 { margin-bottom: 8px; font-size: 1.1rem; }
.animal-widget p { color: var(--text-muted); margin-bottom: 12px; }
.animal-widget img { border-radius: 8px; box-shadow: var(--shadow); }

/* ==== АДАПТИВ ==== */
@media (max-width: 600px) {
  .topbar-inner { flex-direction: column; align-items: stretch; }
  .topnav { justify-content: center; }
  .topnav a { padding: 10px 16px; }
  .container { padding: 16px 12px; }
  .login-card { margin: 24px 12px; padding: 24px; }
  .profile-meta { grid-template-columns: 1fr; }
  .chart-wrapper { height: 300px; }
  .chart-wrapper.large { height: 350px; }
}