:root {
  color-scheme: light;
  --bg: #f7f9ff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: rgba(70, 91, 135, 0.16);
  --line-strong: rgba(32, 93, 214, 0.34);
  --blue: #1f5eff;
  --cyan: #00b8d9;
  --violet: #7c3aed;
  --gold: #b88a2d;
  --red: #d92d20;
  --green: #067647;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --soft-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% 4%, rgba(31, 94, 255, 0.12), transparent 30%),
    radial-gradient(circle at 84% 12%, rgba(184, 138, 45, 0.14), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 52%, #eef4ff 100%);
  color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(31, 94, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 94, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 80%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid rgba(70, 91, 135, 0.12);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 14px 44px rgba(15, 23, 42, 0.06);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px 12px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(31, 94, 255, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(231, 238, 255, 0.92)),
    #ffffff;
  color: var(--blue);
  border-radius: 18px;
  font-size: 22px;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 18px 36px rgba(31, 94, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.brand-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 900;
}

.brand-title > span:first-child {
  background: linear-gradient(90deg, #0f172a, var(--blue) 50%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.credit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 760;
  color: var(--muted);
}

.credit a {
  color: var(--blue);
  text-decoration: none;
}

.credit a:hover {
  text-decoration: underline;
}

.japan-flag {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 16px;
  border: 1px solid rgba(16, 24, 40, 0.18);
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
  vertical-align: -3px;
}

.japan-flag::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bc002d;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.brand-wrap p {
  margin: 5px 0 0;
  color: var(--muted);
  font-weight: 620;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 24px 10px;
}

.tab {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #475467;
  font-weight: 850;
  white-space: nowrap;
  box-shadow: var(--soft-shadow);
}

.tab:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.tab.active {
  border-color: rgba(31, 94, 255, 0.35);
  background: linear-gradient(135deg, #ffffff, #eef4ff);
  color: var(--blue);
  box-shadow: 0 18px 36px rgba(31, 94, 255, 0.14);
}

.auth-console {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 240px) minmax(150px, 190px) repeat(4, auto);
  gap: 8px;
  align-items: center;
  padding: 0 24px 14px;
}

.auth-console span {
  color: var(--muted);
  font-weight: 800;
}

.auth-console input {
  min-height: 36px;
  padding-block: 7px;
}

.workspace {
  position: relative;
  width: min(1480px, calc(100vw - 28px));
  margin: 18px auto 56px;
}

.notice-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid rgba(184, 138, 45, 0.26);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 231, 0.78));
  box-shadow: var(--soft-shadow);
}

.notice-strip strong {
  flex: 0 0 auto;
  color: var(--gold);
}

.notice-strip span {
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat,
.panel,
.record,
.connector-card,
.empty {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.78)),
    var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
}

.stat {
  min-height: 112px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
  position: relative;
}

.stat::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(31, 94, 255, 0.08);
}

.stat small {
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
}

.stat strong {
  font-size: 38px;
  line-height: 1;
  color: #0f172a;
}

.split,
.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

.accent-panel {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.86));
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.1;
}

h2 {
  font-size: 17px;
}

.panel p,
.record p,
.plain-list,
.meta-row,
.connector-card p {
  color: var(--muted);
}

.controls,
.actions,
.review-actions,
.import-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.controls input,
.controls select {
  min-width: 190px;
}

.dense-list {
  display: grid;
  gap: 10px;
}

.record {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.record:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow), 0 0 0 4px rgba(31, 94, 255, 0.05);
}

.record-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.status,
.score {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgba(31, 94, 255, 0.24);
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-weight: 900;
  white-space: nowrap;
}

.score {
  min-width: 48px;
  border-color: rgba(124, 58, 237, 0.24);
  background: #f4f0ff;
  color: var(--violet);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 750;
}

.meta-row span {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2f5fa;
  color: #667085;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label,
.wide-label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(70, 91, 135, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(31, 94, 255, 0.11);
}

textarea {
  resize: vertical;
}

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

.primary,
.secondary,
.danger {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 900;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary {
  border-color: rgba(31, 94, 255, 0.34);
  background: linear-gradient(135deg, #1f5eff, #5c7cff);
  color: #ffffff;
  box-shadow: 0 16px 32px rgba(31, 94, 255, 0.18);
}

.secondary {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

.danger {
  border-color: rgba(217, 45, 32, 0.22);
  background: #fff3f1;
  color: var(--red);
}

.primary:hover,
.secondary:hover,
.danger:hover {
  transform: translateY(-1px);
}

.small {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 12px;
}

.connector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.connector-card {
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.connector-card h2 {
  color: var(--ink);
}

.import-bar {
  margin-bottom: 12px;
}

.import-bar input {
  flex: 1 1 220px;
}

.plain-list {
  margin: 12px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.empty {
  padding: 16px;
  color: var(--muted);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  max-width: min(460px, calc(100vw - 36px));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
  font-weight: 850;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .stat-row,
  .connector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split,
  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .brand-wrap,
  .notice-strip,
  .panel-head,
  .record-top {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-title {
    font-size: 24px;
  }

  .tabs {
    padding-inline: 12px;
  }

  .auth-console {
    grid-template-columns: 1fr;
    padding-inline: 12px;
  }

  .workspace {
    width: min(100% - 18px, 1480px);
  }

  .stat-row,
  .connector-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .controls > *,
  .actions > *,
  .review-actions > *,
  .import-bar > * {
    flex: 1 1 auto;
  }
}
