:root {
  --ink: #11262d;
  --muted: #48626d;
  --surface: #ffffff;
  --panel: rgba(255, 255, 255, 0.88);
  --line: #d4e0e6;
  --accent: #005f73;
  --accent-alt: #ee9b00;
  --success: #0a9396;
  --danger: #bb3e03;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f0f5f8;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 14% 18%, rgba(10, 147, 150, 0.26), transparent 36%),
    radial-gradient(circle at 86% 10%, rgba(238, 155, 0, 0.22), transparent 34%),
    radial-gradient(circle at 78% 78%, rgba(0, 95, 115, 0.18), transparent 42%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.site-header {
  padding: 28px 0 10px;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: 0.3px;
}

.site-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 18px 38px rgba(18, 38, 45, 0.1);
  margin-bottom: 24px;
  animation: panel-in 260ms ease-out;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header h2 {
  margin: 0;
  font-size: 24px;
}

.panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.form-grid .full {
  grid-column: 1 / -1;
}

input, select, button {
  font: inherit;
}

input, select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

button:not(.tool-btn):not(.company-option):not(.chip-remove), .btn-link {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--accent), #0a9396);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.btn-link {
  display: inline-block;
  background: linear-gradient(135deg, #35515c, #48626d);
}

.notice {
  margin-top: 12px;
  border: 1px solid #c7e0d8;
  background: #f1faf7;
  color: #113529;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 14px;
}

.notice a {
  color: #005f73;
}

.notice-link {
  background: #fff8e8;
  border-color: #f1cf8f;
  color: #704b00;
}

.notice-error {
  background: #fff3ee;
  border-color: #f6c3b0;
  color: #7d2301;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 8px 0 14px;
  font-size: 14px;
  color: var(--muted);
}

.company-picker {
  position: relative;
  display: grid;
  gap: 10px;
}

.company-dropdown {
  position: relative;
  z-index: 10;
  background: #fff;
  border: 1px solid #bed4dd;
  border-radius: 12px;
  box-shadow: 0 20px 42px rgba(9, 32, 46, 0.18);
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}

.company-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 10px;
}

.company-option {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  color: #15303a;
  text-align: left;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.company-option:hover {
  background: #f2f8fb;
  border-color: #d2e4eb;
}

.company-option.is-selected {
  background: #e7f4f3;
  border-color: #b8d9d6;
}

.company-option-main {
  font-size: 12px;
  line-height: 1.35;
}

.company-option-meta {
  font-size: 11px;
  color: #35515c;
  white-space: nowrap;
}

.picker-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  border: 1px solid #d7e7ee;
  background: #fbfeff;
  border-radius: 12px;
  padding: 8px;
}

.chip-empty {
  font-size: 12px;
  color: var(--muted);
}

.tool-btn {
  border: 1px solid #bfd3db;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8fbfc;
  color: #17303a;
  cursor: pointer;
  font-weight: 600;
}

.select-status {
  font-size: 13px;
  color: var(--muted);
}

.help-text {
  font-size: 13px;
  color: #35515c;
  background: #f4fafc;
  border: 1px solid #d6e8ef;
  border-radius: 10px;
  padding: 8px 10px;
}

.live-search-status {
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
}

.live-search-status.is-error {
  color: #8f2906;
}

.chip {
  background: #e9f4f8;
  border: 1px solid #c8dde7;
  color: #0f3b4b;
  border-radius: 999px;
  padding: 3px 6px 3px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-text {
  line-height: 1.2;
}

.chip-remove {
  border: 0;
  border-radius: 999px;
  width: 18px;
  height: 18px;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  color: #1f5264;
  background: #d0e7f0;
  cursor: pointer;
  padding: 0;
}

.digest-preview-frame {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
  overflow: auto;
}

@media (max-width: 760px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    padding-top: 20px;
  }
}
