/* ==== Material Design 3 (экспериментальная тема). Откат: public/style.classic.css ==== */
:root {
  --primary: #1976d2;
  --primary-dark: #115fa8;
  --on-primary: #ffffff;
  --primary-container: #d6e6f8;
  --on-primary-container: #0c3d6b;
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --text: #1b1c1e;
  --muted: #5d6069;
  --outline: #c7c9d0;
  --border: #e4e6ec;
  --danger: #ba1a1a;
  --success: #2e7d32;
  --warn: #b26a00;
  --e1: 0 1px 2px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06);
  --e2: 0 2px 4px rgba(0,0,0,.10), 0 3px 8px rgba(0,0,0,.08);
  --e3: 0 4px 10px rgba(0,0,0,.12), 0 8px 20px rgba(0,0,0,.10);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Roboto, "Segoe UI", -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: .1px;
}

/* App bar */
header.topbar {
  background: var(--surface);
  border: none;
  box-shadow: var(--e1);
  padding: 0 20px;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.topbar .brand { font-weight: 600; font-size: 20px; }
header.topbar .nav { display: flex; gap: 4px; flex: 1; margin: 0 20px; flex-wrap: wrap; }
header.topbar .nav a {
  font-size: 14px; text-decoration: none; color: var(--muted); font-weight: 500;
  padding: 8px 14px; border-radius: 20px; transition: background .15s, color .15s;
}
header.topbar .nav a:hover { background: var(--primary-container); color: var(--on-primary-container); }
header.topbar .user { font-size: 14px; color: var(--muted); display: flex; gap: 12px; align-items: center; }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px; }

/* Cards / surfaces */
.card {
  background: var(--surface);
  border: none;
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--e1);
}
h1 { font-size: 22px; font-weight: 600; margin: 0 0 18px; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 14px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 16px 0 6px; }

/* Text fields (outlined) */
input, select, textarea {
  font-size: 15px; font-family: inherit;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: var(--surface);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25,118,210,.15);
}
input[type="file"] { padding: 9px 12px; background: var(--surface-2); cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
textarea { resize: vertical; }

/* Buttons (filled, pill) */
button {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: .2px;
  margin-top: 10px;
  width: auto;
  padding: 9px 22px;
  border-radius: 20px;
  box-shadow: var(--e1);
  transition: box-shadow .15s, background .15s, filter .15s;
}
button:hover { background: var(--primary); filter: brightness(1.06); box-shadow: var(--e2); }
button:active { box-shadow: var(--e1); }
button.secondary { background: transparent; color: var(--primary); border: 1px solid var(--outline); box-shadow: none; }
button.secondary:hover { background: var(--primary-container); filter: none; box-shadow: none; }
button.small { padding: 6px 14px; font-size: 13px; }
button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger); filter: brightness(1.08); }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; width: auto; box-shadow: none; font-weight: 500; }
.link-btn:hover { background: none; box-shadow: none; text-decoration: underline; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.material-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.error { color: var(--danger); font-size: 14px; margin-top: 10px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }

/* Chips / badges */
.badge { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .2px; }
.badge.new { background: #e3f0fd; color: #0c3d6b; }
.badge.in_progress { background: #fff2d6; color: var(--warn); }
.badge.pending_approval { background: #ece6fb; color: #5b3fb0; }
.badge.approved { background: #d3f1ea; color: #0f6b58; }
.badge.partial { background: #ffe2cc; color: #b3450f; }
.badge.done { background: #d6f2d8; color: var(--success); }
.badge.rejected { background: #fbdcda; color: var(--danger); }

/* Filters / inline forms */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.filters select { width: auto; min-width: 170px; }
.filters button { width: auto; margin-top: 0; }
.status-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status-form select { width: auto; }
.status-form button { margin-top: 0; }

/* Notices */
.notice { font-size: 14px; padding: 14px 18px; border-radius: 12px; box-shadow: none; }
.notice.ok { background: #e3f5e6; color: var(--success); }
.notice.bad { background: #fbe4e2; color: var(--danger); }

/* Hint box, download */
.hint-box { background: var(--primary-container); border: none; border-radius: 12px; padding: 14px 16px; font-size: 14px; margin-bottom: 18px; color: var(--on-primary-container); }
.download-link { display: inline-block; margin-top: 10px; font-weight: 600; }

/* Управление */
.add-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; margin-bottom: 18px; }
.add-form input, .add-form button { flex: 1 1 0; min-width: 150px; width: auto; margin-top: 0; }
td input[type="text"] { width: 100%; padding: 8px 10px; font-size: 14px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
tr.inactive { opacity: .5; }
th.check-col, td.check-col { text-align: center; width: 44px; }
th.check-col input, td.check-col input { margin: 0; }

/* Карточка «ключ-значение» */
table.kv td { border: none; padding: 7px 8px; vertical-align: top; }
table.kv td:first-child { color: var(--muted); font-weight: 500; width: 210px; }
.muted-note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.qty-input { max-width: 140px; }

@media (max-width: 640px) {
  main { padding: 14px 10px; }
  .material-row { flex-wrap: wrap; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tr { margin-bottom: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
  tbody tr:hover { background: var(--surface); }
  td { border: none; padding: 5px 4px; }
  td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
  th.check-col, td.check-col { width: auto; text-align: left; }
  header.topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  header.topbar .nav { order: 3; width: 100%; margin: 8px 0 0; }
}
