:root {
  --bg: #f6f6f4; --surface: #ffffff; --border: #e3e1da;
  --text: #1f1f1d; --muted: #6f6e69; --hint: #9a988f;
  --accent: #185fa5; --accent-bg: #e6f1fb;
  --danger: #a32d2d; --danger-bg: #fcebeb;
  --radius: 10px; --radius-lg: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
.hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.hdr strong { font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.hint { color: var(--hint); font-size: 12px; font-weight: 400; }
.page { max-width: 980px; margin: 0 auto; padding: 28px 28px 60px; }
h1 { font-size: 22px; font-weight: 500; margin: 0 0 18px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px;
}
.form { padding: 28px 28px 22px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.span2 { grid-column: 1 / span 2; }
.form label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.form input, .form select {
  width: 100%; height: 44px; padding: 0 12px; font-size: 15px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit;
}
.form input.big { height: 48px; font-size: 16px; }
.form input:focus, .form select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.actions .muted { margin-left: auto; }

button, .big-btn {
  height: 44px; padding: 0 18px; font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
}
button.primary, .big-btn {
  background: var(--text); color: #fff; border-color: var(--text); font-weight: 500;
}
button.primary[disabled] { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: transparent; }
button:hover:not([disabled]) { background: #ececea; }
button.primary:hover:not([disabled]) { background: #000; }
.big-btn { display: inline-flex; align-items: center; padding: 0 24px; height: 48px; text-decoration: none; }

/* login */
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth { width: 320px; padding: 28px 30px; }
.auth .sub { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.auth h1 { font-size: 18px; margin: 0 0 18px; }
.auth label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.auth input { width: 100%; height: 40px; padding: 0 12px; font-size: 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit;
}
.auth button { width: 100%; margin-top: 18px; }
.auth .err {
  background: var(--danger-bg); color: var(--danger);
  padding: 8px 12px; border-radius: var(--radius); font-size: 13px; margin: 8px 0 0;
}
.auth .hint { display: block; text-align: center; margin-top: 16px; }

/* results */
.hidden { display: none !important; }
.results { margin-top: 22px; padding: 18px 0 0; }
.results-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px 14px;
}
.rows { border-top: 1px solid var(--border); }
.row {
  display: grid; grid-template-columns: 28px 130px 90px 1fr 90px;
  gap: 12px; align-items: center; padding: 12px 22px;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.row .num { font-weight: 500; }
.row .date { color: var(--muted); font-size: 13px; }
.row a { color: var(--accent); text-align: right; text-decoration: none; }
.row a:hover { text-decoration: underline; }
.row.head { background: #faf9f5; font-size: 12px; color: var(--muted); padding: 10px 22px; }

/* progress + hammer */
.progress { margin-top: 18px; }
.progress-row { display: flex; align-items: center; gap: 12px; }
.bar {
  flex: 1; height: 6px; background: #e3e1da; border-radius: 4px; overflow: hidden;
}
.bar .fill {
  height: 100%; width: 0%; background: var(--accent);
  transition: width .3s ease;
}
.progress p, .job p { margin: 8px 0 0; font-size: 13px; }

/* hammer SVG */
.hammer { display: inline-flex; align-items: flex-end; width: 60px; height: 50px; flex-shrink: 0; }
.hammer .anvil { fill: #6f6e69; }
.hammer .paper { fill: #d3d1c7; }
.hammer .handle { fill: #8c5a2c; }
.hammer .head { fill: #2c2c2a; }
.hammer .hammer-arm {
  transform-origin: 35px 28px;
  transform: rotate(40deg);
  transition: transform .25s ease;
}
.hammer.running .hammer-arm {
  animation: hammer-strike 0.9s ease-in-out infinite;
}
@keyframes hammer-strike {
  0%   { transform: rotate(40deg); }
  35%  { transform: rotate(-15deg); }
  50%  { transform: rotate(-5deg); }
  60%  { transform: rotate(-15deg); }
  100% { transform: rotate(40deg); }
}
/* лёгкое колебание «бумаги» в момент удара */
.hammer.running .paper {
  animation: paper-shake 0.9s ease-in-out infinite;
}
@keyframes paper-shake {
  0%, 45%, 65%, 100% { transform: translate(0,0); }
  50% { transform: translate(0,1px); }
  55% { transform: translate(0,0); }
}

.job { margin-top: 22px; padding: 18px 22px;
  background: var(--accent-bg); border: 1px solid #cdd9eb; border-radius: var(--radius-lg); }
.job p { color: #0c447c; }
.job-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.job-actions .big-btn { margin-left: auto; }

/* storage page */
.hdr-right { display: flex; align-items: center; }
.ghost-link {
  font-size: 13px; color: var(--accent); text-decoration: none;
}
.ghost-link:hover { text-decoration: underline; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 12px;
}
.section-head h2 { font-size: 16px; font-weight: 500; margin: 0; }
.hint-block { margin: 0 0 12px; }
.stats { padding: 18px 24px; }
.stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.stat {
  display: flex; flex-direction: column;
  background: #faf9f5; padding: 14px 16px; border-radius: 10px;
}
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-val { font-size: 18px; font-weight: 500; }
.stat-sub { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }

.jobs-section, .pdfs-section { margin-top: 22px; }
.job-row, .pdf-row {
  display: grid; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); align-items: center; font-size: 13px;
}
.job-row { grid-template-columns: 130px 110px 90px 90px 1fr 160px; }
.pdf-row { grid-template-columns: 130px 1fr 90px 100px; }
.row.head { background: #faf9f5; font-size: 12px; color: var(--muted); padding: 8px 16px; }
.actions-inline { display: flex; gap: 8px; justify-content: flex-end; }
.actions-inline a { color: var(--accent); text-decoration: none; font-size: 13px; padding: 4px 8px; }
.msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.small { height: 28px; padding: 0 10px; font-size: 12px; }
button.danger { color: var(--danger); border-color: #f0c9c9; }
button.danger:hover:not([disabled]) { background: var(--danger-bg); }
.badge {
  display: inline-block; padding: 3px 8px; font-size: 12px;
  border-radius: 8px; background: var(--accent-bg); color: var(--accent);
}
.badge.st-ok { background: #e1f5ee; color: #085041; }
.badge.st-err { background: var(--danger-bg); color: var(--danger); }
.badge.st-run { background: #faeeda; color: #854f0b; }
.badge.st-cancel { background: #efeae0; color: #5f5e5a; }
.badge.st-queue { background: #f1f0eb; color: var(--muted); }

/* source tabs */
.source-tabs {
  display: flex; gap: 6px; padding: 4px;
  background: #faf9f5; border: 1px solid var(--border);
  border-radius: var(--radius); margin: 0 0 22px;
}
.source-tab {
  flex: 1; cursor: pointer; padding: 10px 14px; text-align: center;
  font-size: 14px; color: var(--muted); border-radius: 8px;
  transition: all .2s ease;
}
.source-tab input[type="radio"] { display: none; }
.source-tab:has(input:checked) {
  background: var(--surface); color: var(--text); font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.source-tab:hover { color: var(--text); }

/* checkboxes (для КС РФ) */
.checkboxes {
  display: flex; flex-wrap: wrap; gap: 16px; padding: 6px 0;
}
.cbx {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; cursor: pointer;
}
.cbx input { width: 16px; height: 16px; }

.mt-22 { margin-top: 22px; }

/* account page */
.page-narrow { max-width: 540px; }
.form-narrow label {
  display: block; font-size: 14px; color: var(--muted);
  margin: 14px 0 6px;
}
.form-narrow label:first-child { margin-top: 0; }
.form-narrow input {
  width: 100%; height: 42px; padding: 0 12px; font-size: 15px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit;
}
.form-narrow input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-narrow .actions { margin-top: 22px; }
#account-msg { margin: 14px 0 0; font-size: 13px; padding: 8px 12px; border-radius: 8px; }
#account-msg:empty { display: none; }
#account-msg.err { background: var(--danger-bg); color: var(--danger); }
#account-msg.ok  { background: #e1f5ee; color: #085041; }
.hint-card { background: #faf9f5; border: 1px solid var(--border); margin-top: 18px;
             color: var(--muted); font-size: 13px; padding: 14px 18px; }
.hint-card p { margin: 0 0 8px; }
.hint-card p:last-child { margin: 0; }
.hint-card code { background: #f1f0eb; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
