:root {
  --ink: #44372B;
  --ink-strong: #2F261D;
  --muted: #7C7061;
  --cream: #F4EFE7;
  --card: #FFFFFF;
  --border: #E3DACD;
  --border-strong: #CFC2AE;
  --danger: #A33A2D;
  --danger-bg: #FBEEEB;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 32px 20px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: 0 2px 6px rgba(44, 32, 22, 0.10), 0 18px 48px rgba(44, 32, 22, 0.18);
}

.logo {
  display: block;
  width: 176px;
  height: auto;
  margin: 0 auto 24px;
}

.title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 6px 0 28px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.label {
  font-size: 14px;
  font-weight: 500;
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder { color: #A99C8B; }

.input:hover { border-color: #B9A992; }

.input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(68, 55, 43, 0.12);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(163, 58, 45, 0.14);
}

.input--password { padding-right: 92px; }

.input-wrap { position: relative; }

.reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 34px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.reveal:hover { color: var(--ink); background: #F6F2EB; }

.reveal:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -2px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
  cursor: pointer;
}

.link {
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.link:hover { border-bottom-color: var(--ink); }

.button {
  height: 48px;
  margin-top: 6px;
  font: inherit;
  font-weight: 500;
  color: #FFFFFF;
  background: var(--ink);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.button:hover { background: var(--ink-strong); }

.button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.button[disabled] {
  background: #9C9184;
  cursor: default;
}

.button.is-loading .button__label::after {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 9px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  margin-bottom: 20px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid #EFD5CF;
  border-radius: var(--radius);
}

.error {
  margin: 0;
  font-size: 13px;
  color: var(--danger);
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.help {
  margin: 24px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.footer {
  font-size: 13px;
  color: var(--ink);
}

/* ── кабинет: шапка, разделы ─────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar__brand img {
  display: block;
  width: 108px;
  height: auto;
}

.ghost {
  height: 38px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ghost:hover { background: #F6F2EB; border-color: var(--ink); }

.ghost:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Кабинет шире формы входа и прижат к верху — карточек много.
   Высоту тянет не сама страница, а колонка body, иначе шапка с подвалом
   добавляют лишний экран прокрутки. */
.page--wide {
  min-height: 0;
  flex: 1;
  justify-content: flex-start;
  padding: 32px 24px 48px;
}

body:has(.topbar) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shell {
  width: 100%;
  max-width: 1040px;
}

.title--left,
.subtitle--left { text-align: left; }

.subtitle--left { margin-bottom: 24px; }

/* min(...) не даёт колонке стать шире экрана, когда места меньше 260px. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 16px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 132px;
  padding: 18px 20px 20px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(44, 32, 22, 0.07), 0 8px 24px rgba(44, 32, 22, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 2px 6px rgba(44, 32, 22, 0.10), 0 14px 34px rgba(44, 32, 22, 0.16);
}

.tile:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.tile__num {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--border-strong);
}

.tile__title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.tile__summary {
  font-size: 13px;
  color: var(--muted);
}

/* Три верхних блока — крупнее разделов: с них начинается любой путь. */
.grid--groups {
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 20px;
}

.tile--group {
  min-height: 210px;
  padding: 24px 24px 26px;
}

.tile--group .tile__title { font-size: 22px; }

.tile--group .tile__summary { font-size: 14px; }

.tile__note {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* Список разделов внутри блока прижат к низу плитки. */
.tile__list {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}


.back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.back:hover { color: var(--ink); }

.panel {
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(44, 32, 22, 0.07), 0 8px 24px rgba(44, 32, 22, 0.08);
}

.panel__text {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.siblings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.chip {
  padding: 7px 13px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chip:hover { background: #FFFFFF; border-color: var(--border-strong); }

.footer--page {
  padding: 0 24px 28px;
  text-align: center;
}

@media (max-width: 420px) {
  .card { padding: 32px 22px 26px; border-radius: 14px; }
  .logo { width: 148px; }
  .topbar { padding: 10px 16px; }
  .page--wide { padding: 24px 16px 40px; }
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── сводка по производству ──────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  background: #FBF8F3;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.stat__value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat__title { font-size: 14px; }

.stat__unit { font-size: 13px; color: var(--muted); }

.panel__heading {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 500;
}

.kilns {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.kiln {
  display: grid;
  grid-template-columns: 110px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}

.kiln:last-child { border-bottom: 0; }

.kiln--stale { background: #FDF6EE; }

.kiln__name { font-weight: 500; }

/* В списках платежей первая колонка — название заявки, ей нужна вся ширина. */
.kiln--payment { grid-template-columns: 1fr auto auto; }

.kiln__name--wide {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kiln__stage { color: var(--ink); }

.kiln__time { font-size: 13px; color: var(--muted); white-space: nowrap; }

.kiln__loads { font-size: 13px; color: var(--muted); white-space: nowrap; }

.panel__heading--spaced { margin-top: 26px; }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.weeks {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.weeks th,
.weeks td {
  padding: 11px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.weeks th {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: #FBF8F3;
}

.weeks th:first-child,
.weeks td:first-child { text-align: left; }

.weeks tr:last-child td { border-bottom: 0; }

.panel__note {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 520px) {
  .kiln { grid-template-columns: 1fr; gap: 2px; }
  .kiln__time { white-space: normal; }
}

