:root {
  --bg: #f6f7f9;
  --text: #172033;
  --muted: #657086;
  --card: #fff;
  --accent: #2457ff;
  --border: #d9dee8;
  --danger: #c62828;
  --success: #1b7f45;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 900;
  text-decoration: none;
  color: var(--text);
}

.site-header nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

.site-header a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.inline-form { display: inline; }
.inline-form button {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  font-weight: 700;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px;
}

.narrow { max-width: 680px; }
.hero { padding-top: 90px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
  margin-bottom: 20px;
}

h1 { font-size: 38px; margin: 0 0 16px; }
h2 { margin-top: 0; }
p { line-height: 1.55; }

.hint, small {
  color: var(--muted);
  font-size: 0.95rem;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: white !important;
  padding: 11px 16px;
  border-radius: 12px;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  margin: 4px;
}

.button.secondary { background: #e8ecf7; color: #1d2a44 !important; }
.button.danger { background: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

label {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  gap: 6px;
  margin-bottom: 12px;
}

input, select, textarea {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.check {
  font-weight: 500;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  margin: 6px 12px 6px 0;
}

.wide { grid-column: 1 / -1; }

.actions, .inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.list {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 16px;
  overflow: hidden;
}

.list th, .list td {
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.upload-section {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  background: #fafbff;
}

.upload-row {
  display: grid;
  grid-template-columns: 42px 1.2fr 1fr 1.4fr;
  gap: 14px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
  margin-bottom: 12px;
}

.upload-number {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #e8ecf7;
  color: #1d2a44;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-bottom: 4px;
}

.license-select-wrap {
  display: grid;
  grid-template-columns: 1fr 28px;
  gap: 8px;
  align-items: center;
}

.license-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #e8ecf7;
  color: #1d2a44;
  font-weight: 800;
  cursor: help;
  border: 1px solid var(--border);
  user-select: none;
}

.license-tooltip {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: 280px;
  background: #172033;
  color: white;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
  z-index: 20;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.license-tooltip::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 100%;
  border-width: 7px;
  border-style: solid;
  border-color: #172033 transparent transparent transparent;
}

.license-info:hover .license-tooltip,
.license-info:focus .license-tooltip {
  display: block;
}

.license-editor-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 12px;
  background: #fafbff;
}

.file-card, .match-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafbff;
}

.flash {
  margin: 16px auto;
  max-width: 1120px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
}

.flash.error { background: #fde8e8; color: #8d1b1b; }
.flash.success { background: #e9f8ef; color: var(--success); }

.prebox {
  background: #0f172a;
  color: white;
  padding: 18px;
  border-radius: 14px;
  overflow: auto;
}

.status {
  background: #e8ecf7;
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 800;
}

.suggestion-box {
  margin-top: 10px;
  color: var(--muted);
}

.imported-file {
  background: #e9f8ef;
  color: var(--success);
  padding: 8px;
  border-radius: 10px;
  font-size: .9rem;
}

@media (max-width: 860px) {
  .form-grid, .upload-row, .license-editor-row {
    grid-template-columns: 1fr;
  }
  .container { padding: 18px; }
  h1 { font-size: 30px; }
  .topbar, .site-header { align-items: flex-start; flex-direction: column; }
  .license-tooltip { right: auto; left: 0; width: 240px; }
}


.log-entry {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #fafbff;
  margin-bottom: 10px;
}
