* { box-sizing: border-box; }
:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #e3e8ef;
  --text: #18212f;
  --muted: #667085;
  --primary: #2557d6;
  --primary-2: #1d4ed8;
  --danger: #d92d20;
  --danger-bg: #fef3f2;
  --light: #f8fafc;
  --success-bg: #ecfdf3;
  --success-border: #b7ebc6;
  --success-text: #146c43;
  --error-bg: #fef3f2;
  --error-border: #f3b3ad;
  --error-text: #b42318;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
  --radius: 22px;
}
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Tahoma, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, #e8f0ff 0%, transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}
.site-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 24px auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.topbar.compact { margin-bottom: 22px; }
.topbar h1 {
  margin: 8px 0 10px;
  font-size: clamp(26px, 4vw, 38px);
}
.topbar p { margin: 0; color: var(--muted); line-height: 1.9; max-width: 780px; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.version-badge,
.soft-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary-2);
  font-size: 13px;
  font-weight: 700;
}
.content-grid.single-col { display: block; }
.panel {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(227,232,239,0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.section-head h2 { margin: 0; font-size: 22px; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field-full { grid-column: 1 / -1; }
.field label {
  font-weight: 700;
  font-size: 14px;
}
.field label span { color: var(--muted); font-weight: 400; }
input[type="text"], input[type="password"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  font: inherit;
  background: #fff;
  color: var(--text);
  transition: .2s ease;
}
input:focus, textarea:focus {
  outline: none;
  border-color: #98b4ff;
  box-shadow: 0 0 0 4px rgba(37,87,214,.10);
}
textarea { resize: vertical; min-height: 120px; }
.drop-zone {
  border: 2px dashed #b8c7e0;
  border-radius: 20px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9ff 100%);
  padding: 20px;
  text-align: center;
  transition: .2s ease;
}
.drop-zone.dragover {
  border-color: var(--primary);
  background: #eef4ff;
  transform: translateY(-1px);
}
.drop-zone-inner h3 { margin: 6px 0 8px; font-size: 24px; }
.drop-zone-inner p { margin: 0 0 16px; color: var(--muted); }
.upload-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 8px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #e8f0ff;
  color: var(--primary);
  font-size: 28px;
  font-weight: bold;
}
.drop-actions,
.submit-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.selected-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--light);
  overflow: hidden;
}
.selected-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.selected-head h3 { margin: 0; font-size: 18px; }
.selected-files.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 22px 14px;
}
.file-list { display: grid; gap: 10px; padding: 14px; }
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.file-meta { min-width: 0; }
.file-name {
  font-weight: 700;
  word-break: break-word;
}
.file-size { color: var(--muted); font-size: 13px; margin-top: 4px; }
.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: .18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-light { background: #edf2f7; color: #243247; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-remove { background: #fff1f2; color: #be123c; padding: 10px 12px; border: 1px solid #ffd5dd; }
.btn-wide { min-width: 220px; }
.admin-link {
  text-decoration: none;
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
}
.message-box {
  margin-top: 16px;
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid transparent;
  line-height: 1.8;
}
.message-box.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.message-box.error { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
.hidden { display: none; }
.auth-shell { min-height: calc(100vh - 48px); display: grid; place-items: center; }
.auth-panel { width: min(480px, 100%); }
.auth-brand h1 { margin: 8px 0 10px; }
.auth-brand p { color: var(--muted); margin: 0 0 18px; }
.auth-form { display: grid; gap: 14px; }
.auth-note {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px dashed var(--line);
  line-height: 1.9;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(227,232,239,0.95);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.stat-card span { display: block; color: var(--muted); margin-bottom: 8px; }
.stat-card strong { font-size: 28px; }
.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}
.admin-table th,
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}
.admin-table th {
  background: #f8fbff;
  color: #344054;
  white-space: nowrap;
  font-size: 14px;
}
.admin-table tr:hover td { background: #fbfdff; }
.desc-cell { min-width: 220px; line-height: 1.9; }
.table-link { color: var(--primary); font-weight: 700; text-decoration: none; }
.empty-box {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 16px;
}
@media (max-width: 900px) {
  .topbar,
  .section-head,
  .selected-head { flex-direction: column; align-items: stretch; }
  .stats-grid,
  .form-grid { grid-template-columns: 1fr; }
  .site-shell { width: min(100% - 16px, 1120px); }
  .panel, .stat-card { padding: 18px; }
  .drop-zone-inner h3 { font-size: 21px; }
}
