[hidden] { display: none !important; }

:root {
  --bg-base: #faf8f5;
  --bg-panel: #fffefb;
  --bg-soft: #f0f4ed;
  --bg-hero: linear-gradient(125deg, #f5faf2 0%, #fdfbf7 45%, #fff8ee 100%);

  --border: #d8ddd4;
  --border-strong: #b4c3bc;

  --text-main: #252e28;
  --text-sub: #5a6b5e;
  --text-muted: #7a8b82;
  --text-inverse: #f5fbf9;

  --accent: #1a8a6e;
  --accent-strong: #147a5e;
  --accent-soft: #e2f0e8;

  --ok: #2e7d32;
  --warn: #c77700;
  --err: #c0392b;
  --info: #0b66c3;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow: 0 8px 24px rgba(22, 40, 31, 0.08);
  --shadow-pop: 0 12px 30px rgba(15, 118, 110, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-base);
  color: var(--text-main);
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  top: -42px;
  left: 14px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  background: #1a2320;
}

.skip-link:focus {
  top: 10px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  background: var(--bg-hero);
  border-bottom: 1px solid var(--border);
  padding: 12px 22px;
}

.topbar-inner {
  max-width: 1460px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.topline-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.logout-btn:hover {
  border-color: var(--err);
  color: var(--err);
}

.brand {
  display: grid;
  gap: 5px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  height: 48px;
  width: auto;
  display: block;
}

.brand h1 {
  margin: 0;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.08;
  letter-spacing: 0.2px;
}

.brand p {
  margin: 0;
  color: var(--text-sub);
  font-size: 14px;
  display: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  background: #fff;
  min-height: 44px;
}

.nav-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.nav-link.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(26, 138, 110, 0.08);
  font-weight: 700;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 20px 24px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.portal {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid.main {
  grid-template-columns: 290px 1fr;
  gap: 14px;
}

.card-pad {
  padding: 14px;
}

h2 {
  margin: 0;
  font-size: 22px;
}

h3 {
  margin: 0;
  font-size: 18px;
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-sub);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--text-main);
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 0 3px rgba(26, 138, 110, 0.15);
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-size: 15px;
  line-height: 1.7;
  font-family: "IBM Plex Sans", "Segoe UI", "Hiragino Sans", sans-serif;
}

label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-row {
  display: grid;
  gap: 4px;
}

.form-row.required label::after {
  content: ' 必須';
  color: var(--err);
  font-weight: 700;
  font-size: 11px;
}

.form-row .meta {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
  min-height: 48px;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button.sub {
  background: #5d6f66;
}

button.warn {
  background: var(--warn);
}

button.err {
  background: var(--err);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--info);
  outline-offset: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  width: fit-content;
}

.badge.ok {
  background: #e6f4e7;
  color: #205f26;
}

.badge.warn {
  background: #fff4e1;
  color: #915900;
}

.badge.err {
  background: #fdeceb;
  color: #7f2218;
}

.badge.info {
  background: #e7f1fd;
  color: #114f97;
}

.status-line {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 13px;
  line-height: 1.4;
  background: var(--bg-soft);
}

.status-line.ok {
  border-color: #b6d9bb;
  color: #1f5a27;
  background: #eef9f0;
}

.status-line.err {
  border-color: #e0b5ae;
  color: #7c2a20;
  background: #fff3f1;
}

.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 8px;
}

.step {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px;
  display: grid;
  gap: 5px;
  min-height: 74px;
  background: #fff;
}

.step .num {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
}

.step .title {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.step .state {
  font-size: 11px;
  font-weight: 700;
}

.step.idle {
  background: #fff;
}

.step.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: var(--shadow-pop);
}

.step.done {
  background: #eff9f0;
  border-color: #b8d7bd;
}

.step.error {
  background: #fff2f1;
  border-color: #e4b0a8;
}

.meta-list {
  display: grid;
  gap: 8px;
}

.meta-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 7px;
  font-size: 13px;
}

.meta-item .label {
  color: var(--text-muted);
}

.meta-item .value {
  font-weight: 700;
  word-break: break-all;
}

.section {
  display: grid;
  gap: 12px;
}

.section + .section {
  margin-top: 8px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
}

.section-body {
  display: grid;
  gap: 10px;
}

.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cols-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.box-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f9fbfa;
  min-height: 180px;
  max-height: 340px;
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.box-item {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px;
  background: #fff;
  cursor: pointer;
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.box-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.box-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.16) inset;
}

.code-block {
  margin: 0;
  border: 1px solid #0f2f2c;
  border-radius: var(--radius-md);
  background: #081815;
  color: #dcfffb;
  padding: 12px;
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  font-size: 12px;
  font-family: "IBM Plex Sans", "Segoe UI", "Hiragino Sans", sans-serif;
}

.portal-card {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.portal-card h3 {
  font-size: 18px;
}

.portal-card .desc {
  margin: 0;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.5;
}

.portal-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.footer-note {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

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

  .steps {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

@media (max-width: 980px) {
  .cols-2,
  .cols-3 {
    grid-template-columns: 1fr;
  }

  .steps {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .container {
    padding: 14px;
  }

  .steps {
    grid-template-columns: 1fr;
  }
}

.user-shell {
  font-size: 17px;
  line-height: 1.6;
}

.user-shell label {
  font-size: 16px;
  color: var(--text-main);
}

.user-shell .hint {
  font-size: 15px;
}

.user-shell input,
.user-shell textarea,
.user-shell select {
  font-size: 16px;
}

.user-shell .nav-link {
  font-size: 14px;
}

.user-shell .badge {
  font-size: 13px;
}
