:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --line: #d9dee5;
  --line-strong: #c8d0d9;
  --text: #18202a;
  --muted: #5e6b78;
  --accent: #0f4c81;
  --accent-soft: #eaf2f9;
  --ok: #2d6a4f;
  --ok-soft: #e9f5ef;
  --shadow: 0 10px 24px rgba(25, 35, 45, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, sans-serif;
}

a {
  color: inherit;
}

.shell {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.site-header,
.panel,
.stats article,
.group-card,
.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.lead,
.panel-head p,
.group-description,
.detail-note,
.hint,
.detail-list,
.source-list,
.file-list,
.cell small {
  color: var(--muted);
  line-height: 1.55;
}

.main-nav a,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.auth-form,
.auth-bar {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-left: auto;
}

.auth-form label {
  min-width: 240px;
  margin: 0;
}

.auth-state {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #b9dfc9;
  border-radius: 10px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 700;
}

.auth-error {
  margin: 0;
  color: #9b1c1c;
  font-size: 0.88rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stats article,
.panel,
.group-card,
.detail-card {
  padding: 18px;
  border-radius: 14px;
}

.stats strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.55rem;
}

.group-list,
.item-grid,
.detail-grid {
  display: grid;
  gap: 14px;
}

.group-list {
  margin-top: 16px;
}

.group-head {
  margin-bottom: 10px;
}

.simple-group-head h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.item-grid {
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
}

.item-row:hover {
  background: #f8fbfe;
}

.cell {
  min-width: 0;
}

.cell strong,
.cell small {
  display: block;
}

.cell-code,
.folder-chip,
.flash,
.detail-title {
  font-size: 0.88rem;
  font-weight: 700;
}

.cell-code,
.folder-chip {
  color: var(--accent);
}

.simple-item-row .cell-title strong {
  font-size: 1rem;
  line-height: 1.4;
}

.simple-item-row .cell-title {
  display: grid;
  gap: 4px;
}

.simple-item-row .cell-title small,
.item-note {
  color: var(--muted);
  line-height: 1.45;
}

.item-note {
  font-style: italic;
}

.detail-panel {
  margin-top: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.plain-meta p {
  margin-bottom: 10px;
  line-height: 1.5;
}

.detail-list,
.source-list,
.file-list {
  padding-left: 18px;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.source-list a,
.file-list a {
  color: var(--accent);
}

.inline-form,
.upload-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}

input[type="file"] {
  padding: 10px;
}

.flash {
  margin-top: 14px;
  margin-bottom: 0;
  padding: 12px 14px;
  border: 1px solid #b9dfc9;
  border-radius: 10px;
  background: var(--ok-soft);
  color: var(--ok);
}

@media (max-width: 980px) {
  .site-header,
  .detail-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-form,
  .auth-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
  }

  .auth-form label {
    min-width: 0;
  }

  .stats,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .item-grid {
    gap: 8px;
  }

  .item-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
