:root {
  --bg-deep: #082341;
  --bg-mid: #103a66;
  --bg-soft: #dfe7f4;
  --panel: #f8fbff;
  --panel-2: #f1f6fd;
  --text: #132f52;
  --muted: #4f6788;
  --line: #b6c9e6;
  --line-strong: #93b0d8;
  --primary: #0e4f95;
  --primary-2: #0b3f78;
  --accent: #c9a44c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 520px at -10% -20%, #2b588d33 0%, transparent 70%),
    radial-gradient(950px 420px at 108% -8%, #4670a133 0%, transparent 65%),
    linear-gradient(160deg, var(--bg-soft), #c6cfdd);
  padding: 14px;
}

.layout {
  width: min(1880px, 99vw);
  margin: 0 auto;
}

.page-header {
  padding: 4px 6px 10px;
}

#page-title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.45rem, 3.6vw, 2.7rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #0f2f56;
  text-shadow: 0 2px 0 #ffffff90;
}

.top-actions {
  display: none;
  justify-content: flex-start;
  margin: 0 0 10px;
}

.top-actions.visible {
  display: flex;
}

.panel {
  width: 100%;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 22px 48px #0d2f581f;
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.panel.home-mode {
  min-height: auto;
  display: flex;
  flex-direction: column;
}

.panel.home-mode::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(560px 170px at -6% -7%, #e6effc 0%, transparent 70%),
    radial-gradient(620px 190px at 105% 0%, #e6effc 0%, transparent 68%);
}

.panel > * {
  position: relative;
  z-index: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  align-content: start;
}

.option {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 14px 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 10px 22px #0e4f9517;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.option:hover {
  transform: translateY(-5px);
  border-color: #8fb1dd;
  box-shadow: 0 18px 30px #0e4f9524;
  background: linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
}

.option:active { transform: translateY(0); }

.file {
  display: block;
  line-height: 1.2;
}

.option-icon {
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  color: #0e4f95;
  background: #f2f7ff;
  border: 1px solid #d3e1f5;
  border-radius: 16px;
}

.option-icon svg {
  width: 58px;
  height: 58px;
  stroke: #123f73;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.option-title {
  font-size: 1.06rem;
  font-weight: 800;
  color: #163a66;
  margin-bottom: 8px;
}

.option-desc {
  font-size: 0.84rem;
  font-weight: 500;
  color: #5a7090;
  line-height: 1.35;
  min-height: 48px;
  margin-bottom: 0;
}

.detail {
  display: none;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #f4f8ff;
}

.detail.visible { display: block; }

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 8px;
}

.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.94rem;
  outline: none;
  color: var(--text);
  background: #fff;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #0e4f9520;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.btn-secondary {
  color: var(--text);
  background: #e7eef9;
  border-color: var(--line);
}

.suggestions {
  display: none;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.suggestions.visible { display: block; }

.suggestion-btn {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf2fb;
  background: #fff;
  color: #1c2f4d;
  text-align: left;
  font-size: 0.95rem;
  padding: 10px 12px;
  cursor: pointer;
}

.suggestion-btn:last-child { border-bottom: 0; }
.suggestion-btn:hover { background: #eff5ff; }

.results {
  display: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f7fbff 0%, #f0f6ff 100%);
  padding: 14px;
}

.results.visible { display: block; }

.result-item {
  padding: 14px;
  border: 1px solid #cfdef4;
  border-left: 6px solid #0e4f95;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 16px #0f3c6e12;
  margin-bottom: 14px;
}

.result-item:last-child { margin-bottom: 0; }

.result-main {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0e4f95, #0b3f78);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.full-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.field-item {
  display: grid;
  gap: 6px;
  align-content: start;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #3a5f8f;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding-left: 4px;
}

.field-value-box {
  border: 1px solid #d7e5fb;
  border-radius: 10px;
  background: #f7faff;
  padding: 10px 12px;
  min-height: 48px;
  display: flex;
  align-items: center;
}

.field-value {
  font-size: 0.98rem;
  font-weight: 600;
  color: #244267;
  overflow-wrap: anywhere;
}

.hint {
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #38557c;
}

.hint:empty { display: none; }

@media (max-width: 1500px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  #page-title { font-size: clamp(1.35rem, 7.6vw, 2rem); }
  .panel { padding: 18px; border-radius: 18px; }
  .panel.home-mode { min-height: auto; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .option { min-height: 220px; padding: 12px 10px; }
  .option-icon { width: 76px; height: 76px; }
  .option-icon svg { width: 50px; height: 50px; }
  .option-title { font-size: 0.98rem; }
  .option-desc { min-height: 38px; font-size: 0.78rem; }
  .search-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .option { min-height: 190px; }
}
