:root {
  color-scheme: light;

  --bg:
    #f3f7fb;

  --surface:
    rgba(255, 255, 255, 0.96);

  --surface-soft:
    #f8fafc;

  --surface-blue:
    #eff6ff;

  --text:
    #132033;

  --muted:
    #66758a;

  --line:
    #dbe4ef;

  --accent:
    #2563eb;

  --accent-dark:
    #1d4ed8;

  --success:
    #15803d;

  --danger:
    #b91c1c;

  --warning:
    #92400e;

  --radius-lg:
    24px;

  --radius-md:
    16px;

  --shadow:
    0 18px 48px
    rgba(15, 23, 42, 0.09);
}


* {
  box-sizing:
    border-box;
}


html {
  min-height:
    100%;
}


body {
  margin:
    0;

  min-height:
    100vh;

  background:
    radial-gradient(
      circle at top left,
      #e8f2ff 0,
      transparent 38%
    ),
    linear-gradient(
      180deg,
      #f8fbff 0%,
      var(--bg) 100%
    );

  color:
    var(--text);

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans JP",
    sans-serif;
}


body.excel-template-auth-pending {
  visibility:
    hidden;
}


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


button,
a,
select,
input,
textarea {
  -webkit-tap-highlight-color:
    transparent;
}


.registry-app {
  width:
    min(1600px, 100%);

  margin:
    0 auto;

  padding:
    28px;
}


.registry-header {
  display:
    flex;

  align-items:
    flex-start;

  justify-content:
    space-between;

  gap:
    24px;

  padding:
    28px 30px;

  border:
    1px solid rgba(148, 163, 184, 0.22);

  border-radius:
    var(--radius-lg);

  background:
    linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.98),
      rgba(30, 64, 175, 0.95)
    );

  color:
    #fff;

  box-shadow:
    var(--shadow);
}


.registry-eyebrow,
.section-kicker {
  margin:
    0 0 7px;

  font-size:
    12px;

  font-weight:
    800;

  letter-spacing:
    0.14em;

  color:
    #60a5fa;
}


.registry-header h1 {
  margin:
    0;

  font-size:
    clamp(28px, 3vw, 42px);

  line-height:
    1.15;
}


.registry-header-description {
  max-width:
    740px;

  margin:
    12px 0 0;

  color:
    #dbeafe;

  line-height:
    1.75;
}


.registry-header-actions,
.version-action-group,
.form-actions {
  display:
    flex;

  flex-wrap:
    wrap;

  gap:
    10px;
}


.button {
  appearance:
    none;

  display:
    inline-flex;

  min-height:
    42px;

  align-items:
    center;

  justify-content:
    center;

  gap:
    8px;

  padding:
    9px 16px;

  border:
    1px solid transparent;

  border-radius:
    12px;

  font-weight:
    750;

  text-decoration:
    none;

  cursor:
    pointer;

  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease,
    border-color 0.16s ease;
}


.button:hover:not(:disabled) {
  transform:
    translateY(-1px);
}


.button:disabled {
  opacity:
    0.45;

  cursor:
    not-allowed;
}


.button-primary {
  background:
    var(--accent);

  color:
    #fff;

  box-shadow:
    0 8px 22px
    rgba(37, 99, 235, 0.22);
}


.button-primary:hover:not(:disabled) {
  background:
    var(--accent-dark);
}


.button-secondary {
  border-color:
    #cbd5e1;

  background:
    #fff;

  color:
    #25334a;
}


.registry-header .button-secondary {
  border-color:
    rgba(255, 255, 255, 0.30);

  background:
    rgba(255, 255, 255, 0.10);

  color:
    #fff;
}


.button-success {
  background:
    #dcfce7;

  border-color:
    #86efac;

  color:
    #166534;
}


.button-danger {
  background:
    #fef2f2;

  border-color:
    #fecaca;

  color:
    #991b1b;
}


.registry-main {
  display:
    grid;

  gap:
    20px;

  margin-top:
    20px;
}


.registry-message {
  display:
    none;

  padding:
    13px 16px;

  border-radius:
    12px;

  font-weight:
    650;
}


.registry-message.is-visible {
  display:
    block;
}


.registry-message.is-info {
  background:
    #eff6ff;

  color:
    #1d4ed8;
}


.registry-message.is-success {
  background:
    #ecfdf5;

  color:
    #166534;
}


.registry-message.is-error {
  background:
    #fef2f2;

  color:
    #991b1b;
}


.registry-hero {
  display:
    grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap:
    14px;
}


.hero-card {
  display:
    flex;

  gap:
    14px;

  padding:
    18px;

  border:
    1px solid var(--line);

  border-radius:
    var(--radius-md);

  background:
    var(--surface);

  box-shadow:
    0 10px 28px
    rgba(15, 23, 42, 0.05);
}


.hero-number {
  display:
    grid;

  width:
    42px;

  height:
    42px;

  flex:
    0 0 42px;

  place-items:
    center;

  border-radius:
    13px;

  background:
    #dbeafe;

  color:
    #1d4ed8;

  font-weight:
    900;
}


.hero-card strong {
  display:
    block;

  margin-bottom:
    5px;

  font-size:
    16px;
}


.hero-card p {
  margin:
    0;

  color:
    var(--muted);

  font-size:
    13px;

  line-height:
    1.65;
}


.registry-toolbar,
.registry-panel,
.template-list-panel,
.template-detail-panel {
  border:
    1px solid var(--line);

  border-radius:
    var(--radius-lg);

  background:
    var(--surface);

  box-shadow:
    0 14px 38px
    rgba(15, 23, 42, 0.055);
}


.registry-toolbar {
  display:
    flex;

  align-items:
    end;

  justify-content:
    space-between;

  gap:
    20px;

  padding:
    20px;
}


.toolbar-heading h2,
.panel-heading h2,
.mapping-heading h3 {
  margin:
    0;
}


.toolbar-filters {
  display:
    flex;

  align-items:
    end;

  flex-wrap:
    wrap;

  gap:
    10px;
}


.toolbar-filters label,
.form-grid label {
  display:
    grid;

  gap:
    6px;

  color:
    var(--muted);

  font-size:
    12px;

  font-weight:
    700;
}


.filter-search {
  min-width:
    220px;
}


input,
select,
textarea {
  width:
    100%;

  border:
    1px solid #cbd5e1;

  border-radius:
    11px;

  background:
    #fff;

  color:
    var(--text);

  outline:
    none;
}


input,
select {
  min-height:
    42px;

  padding:
    8px 11px;
}


textarea {
  padding:
    10px 11px;

  resize:
    vertical;

  line-height:
    1.6;
}


input:focus,
select:focus,
textarea:focus {
  border-color:
    #60a5fa;

  box-shadow:
    0 0 0 3px
    rgba(59, 130, 246, 0.12);
}


.registry-panel {
  padding:
    22px;
}


.panel-heading,
.mapping-heading {
  display:
    flex;

  align-items:
    flex-start;

  justify-content:
    space-between;

  gap:
    16px;

  margin-bottom:
    18px;
}


.panel-heading.compact {
  margin-bottom:
    14px;
}


.permission-chip,
.count-chip,
.status-chip {
  display:
    inline-flex;

  align-items:
    center;

  justify-content:
    center;

  padding:
    5px 9px;

  border-radius:
    999px;

  background:
    #eff6ff;

  color:
    #1d4ed8;

  font-size:
    11px;

  font-weight:
    800;
}


.form-grid {
  display:
    grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap:
    16px;
}


.form-span-2 {
  grid-column:
    1 / -1;
}


.definition-note,
.upload-warning {
  padding:
    12px 14px;

  border-radius:
    12px;

  font-size:
    13px;

  line-height:
    1.65;
}


.definition-note {
  border:
    1px solid #fde68a;

  background:
    #fffbeb;

  color:
    var(--warning);
}


.upload-warning {
  border:
    1px solid #bfdbfe;

  background:
    #eff6ff;

  color:
    #1e40af;
}


.registry-workspace {
  display:
    grid;

  grid-template-columns:
    minmax(300px, 0.8fr)
    minmax(0, 2fr);

  gap:
    18px;
}


.template-list-panel,
.template-detail-panel {
  min-width:
    0;

  padding:
    20px;
}


.excel-template-list {
  display:
    grid;

  gap:
    9px;

  max-height:
    680px;

  overflow:
    auto;

  padding-right:
    3px;
}


.template-card {
  appearance:
    none;

  width:
    100%;

  padding:
    14px;

  border:
    1px solid var(--line);

  border-radius:
    14px;

  background:
    #fff;

  color:
    inherit;

  text-align:
    left;

  cursor:
    pointer;
}


.template-card:hover {
  border-color:
    #93c5fd;

  background:
    #f8fbff;
}


.template-card.is-selected {
  border-color:
    var(--accent);

  background:
    #eff6ff;

  box-shadow:
    inset 3px 0 0
    var(--accent);
}


.template-card-title {
  display:
    block;

  margin-bottom:
    7px;

  font-weight:
    800;
}


.template-card-meta {
  display:
    flex;

  flex-wrap:
    wrap;

  gap:
    6px;

  color:
    var(--muted);

  font-size:
    11px;
}


.empty-state,
.detail-empty {
  padding:
    38px 18px;

  color:
    var(--muted);

  text-align:
    center;
}


.detail-empty-icon {
  display:
    grid;

  width:
    66px;

  height:
    66px;

  margin:
    0 auto 14px;

  place-items:
    center;

  border-radius:
    20px;

  background:
    linear-gradient(
      135deg,
      #dcfce7,
      #dbeafe
    );

  color:
    #166534;

  font-weight:
    900;
}


.detail-summary-grid {
  display:
    grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap:
    11px;
}


.detail-field {
  padding:
    13px;

  border:
    1px solid var(--line);

  border-radius:
    13px;

  background:
    var(--surface-soft);
}


.detail-field span {
  display:
    block;

  margin-bottom:
    5px;

  color:
    var(--muted);

  font-size:
    11px;

  font-weight:
    750;
}


.detail-field strong {
  overflow-wrap:
    anywhere;
}


.version-detail-grid {
  display:
    grid;

  grid-template-columns:
    minmax(280px, 0.8fr)
    minmax(0, 1.2fr);

  gap:
    16px;
}


.version-history-card,
.workbook-card {
  padding:
    17px;

  border:
    1px solid var(--line);

  border-radius:
    var(--radius-md);

  background:
    var(--surface-soft);
}


.version-history-card h3,
.workbook-card h3 {
  margin:
    0 0 12px;
}


.version-history-list {
  display:
    grid;

  gap:
    8px;
}


.version-item {
  appearance:
    none;

  width:
    100%;

  padding:
    11px 12px;

  border:
    1px solid var(--line);

  border-radius:
    12px;

  background:
    #fff;

  color:
    inherit;

  text-align:
    left;

  cursor:
    pointer;
}


.version-item.is-selected {
  border-color:
    var(--accent);

  box-shadow:
    inset 3px 0 0
    var(--accent);
}


.version-item-top {
  display:
    flex;

  align-items:
    center;

  justify-content:
    space-between;

  gap:
    8px;
}


.version-item-meta {
  margin-top:
    5px;

  color:
    var(--muted);

  font-size:
    11px;
}


.status-chip.status-active {
  background:
    #dcfce7;

  color:
    #166534;
}


.status-chip.status-retired {
  background:
    #f1f5f9;

  color:
    #475569;
}


.status-chip.status-draft {
  background:
    #fef3c7;

  color:
    #92400e;
}


.workbook-summary {
  display:
    grid;

  gap:
    12px;
}


.sheet-list {
  display:
    flex;

  flex-wrap:
    wrap;

  gap:
    7px;
}


.sheet-chip {
  padding:
    6px 9px;

  border:
    1px solid #bfdbfe;

  border-radius:
    9px;

  background:
    #eff6ff;

  color:
    #1e40af;

  font-size:
    12px;

  font-weight:
    700;
}


.mapping-editor {
  margin-top:
    18px;

  padding-top:
    18px;

  border-top:
    1px solid var(--line);
}


.mapping-heading p:not(.section-kicker) {
  margin:
    7px 0 0;

  color:
    var(--muted);

  font-size:
    13px;

  line-height:
    1.6;
}


.mapping-list {
  display:
    grid;

  gap:
    10px;

  margin-top:
    14px;
}


.mapping-row {
  display:
    grid;

  grid-template-columns:
    minmax(150px, 1.3fr)
    minmax(120px, 0.8fr)
    minmax(130px, 1fr)
    minmax(115px, 0.7fr)
    auto
    auto;

  gap:
    9px;

  align-items:
    end;

  padding:
    12px;

  border:
    1px solid var(--line);

  border-radius:
    13px;

  background:
    var(--surface-soft);
}


.mapping-row label {
  display:
    grid;

  gap:
    5px;

  color:
    var(--muted);

  font-size:
    11px;

  font-weight:
    700;
}


.mapping-required {
  display:
    flex;

  align-items:
    center;

  gap:
    7px;

  min-height:
    42px;

  color:
    var(--text);

  font-size:
    12px;
}


.mapping-required input {
  width:
    auto;

  min-height:
    auto;
}


.mapping-remove {
  min-width:
    42px;

  min-height:
    42px;

  border:
    1px solid #fecaca;

  border-radius:
    10px;

  background:
    #fff;

  color:
    #b91c1c;

  cursor:
    pointer;
}


.mapping-save-actions {
  margin-top:
    14px;

  align-items:
    center;

  justify-content:
    flex-end;

  gap:
    10px;

  flex-wrap:
    wrap;
}


.mapping-save-status {
  display:
    inline-flex;

  align-items:
    center;

  min-height:
    36px;

  padding:
    7px 11px;

  border:
    1px solid transparent;

  border-radius:
    999px;

  font-size:
    12px;

  font-weight:
    700;

  line-height:
    1.3;
}


.mapping-save-status.is-saved {
  border-color:
    #bbf7d0;

  background:
    #ecfdf5;

  color:
    #166534;
}


.mapping-save-status.is-dirty {
  border-color:
    #fde68a;

  background:
    #fffbeb;

  color:
    #92400e;
}


.mapping-save-status.is-saving {
  border-color:
    #bfdbfe;

  background:
    #eff6ff;

  color:
    #1d4ed8;
}


.mapping-save-status.is-error {
  border-color:
    #fecaca;

  background:
    #fef2f2;

  color:
    #991b1b;
}


@media (max-width: 1100px) {

  .registry-header,
  .registry-toolbar {
    align-items:
      stretch;

    flex-direction:
      column;
  }


  .registry-hero {
    grid-template-columns:
      1fr;
  }


  .registry-workspace,
  .version-detail-grid {
    grid-template-columns:
      1fr;
  }


  .excel-template-list {
    max-height:
      none;
  }


  .mapping-row {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

}


@media (max-width: 700px) {

  .registry-app {
    padding:
      12px;
  }


  .registry-header {
    padding:
      20px;
  }


  .registry-header-actions,
  .toolbar-filters,
  .version-action-group {
    width:
      100%;
  }


  .registry-header-actions .button,
  .toolbar-filters > *,
  .version-action-group .button {
    width:
      100%;
  }


  .form-grid,
  .detail-summary-grid,
  .mapping-row {
    grid-template-columns:
      1fr;
  }


  .form-span-2 {
    grid-column:
      auto;
  }


  .registry-panel,
  .template-list-panel,
  .template-detail-panel {
    padding:
      15px;
  }


  .panel-heading,
  .mapping-heading {
    flex-direction:
      column;
  }

}
/*
 * Native hidden state must override component display rules.
 */
[hidden] {
  display: none !important;
}
