:root {
  --bg: #f4f7fb;
  --surface: #fff;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe3ed;
  --primary: #1261a6;
  --primary-dark: #0b4b84;
  --soft: #e9f3fb;
  --danger: #c63d4d;
  --radius: 14px;
  font-family: "Segoe UI", "Noto Sans JP", sans-serif;
  color: var(--text);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
button,
input,
textarea,
select {
  font: inherit;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}
.brand strong,
.brand small,
.user small {
  display: block;
}
.brand strong {
  font-size: 15px;
}
.brand small,
.user small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.environment {
  border: 1px solid #b8d7ee;
  background: #eef8ff;
  color: #0d5f9d;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
}
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #dcecf8;
  color: var(--primary);
  font-weight: 700;
}
.user {
  font-size: 13px;
  font-weight: 600;
}
.layout {
  max-width: 1440px;
  margin: auto;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}
.sidebar {
  min-height: calc(100vh - 64px);
  padding: 24px 15px;
  border-right: 1px solid var(--line);
  background: #f9fbfd;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar nav {
  display: grid;
  gap: 5px;
}
.sidebar a {
  display: flex;
  gap: 11px;
  align-items: center;
  height: 42px;
  padding: 0 13px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.sidebar a:hover {
  background: #eef3f8;
  color: var(--text);
}
.sidebar a.active {
  background: var(--primary);
  color: #fff;
}
.secure-note {
  margin-top: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 15px;
  font-size: 13px;
}
.secure-note p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.content {
  padding: 34px 38px 60px;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
.page-head {
  max-width: 1040px;
  margin: 0 auto 25px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.eyebrow {
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
}
.page-head h1,
.placeholder-view h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 6px 0;
}
.page-head p,
.placeholder-view p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.draft {
  color: var(--muted);
  font-size: 12px;
}
.workspace {
  max-width: 1040px;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 294px;
  gap: 20px;
}
.main-column,
.settings-column {
  display: grid;
  align-content: start;
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 23px;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.025);
}
.card > header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.card h2 {
  font-size: 15px;
  margin: 0;
}
.card header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.step {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full {
  grid-column: 1/-1;
}
label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
}
label b {
  color: var(--danger);
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid #cdd8e5;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 97, 166, 0.13);
}
textarea {
  min-height: 88px;
  resize: vertical;
}
.dropzone {
  min-height: 182px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px dashed #86b9de;
  border-radius: 12px;
  background: #f8fcff;
  cursor: pointer;
}
.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.dropzone span,
.dropzone strong,
.dropzone small,
.dropzone em {
  display: block;
}
.upload-icon {
  font-size: 28px;
  color: var(--primary);
}
.dropzone small {
  color: var(--muted);
  font-weight: 400;
}
.dropzone em {
  margin-top: 9px;
  border-radius: 999px;
  background: #eef3f8;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
}
.file-list {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}
.file-list div {
  display: flex;
  justify-content: space-between;
  border-radius: 8px;
  background: #f1f5f9;
  padding: 9px 11px;
  font-size: 12px;
}
.file-list small {
  color: var(--muted);
}
.compact {
  display: grid;
  gap: 16px;
}
.compact h2 {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}
.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  border-radius: 9px;
  background: #f1f5f9;
  padding: 12px;
}
.checkbox input {
  width: 16px;
  height: 16px;
}
.info {
  border: 1px solid #bcd7ea;
  border-radius: 12px;
  background: #eff8fe;
  color: #315a77;
  padding: 14px;
  font-size: 12px;
  line-height: 1.6;
}
.primary {
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.primary:hover {
  background: var(--primary-dark);
}
.audit {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}
.placeholder-view {
  max-width: 900px;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: #102235;
  color: #fff;
  border-radius: 11px;
  padding: 13px 17px;
  font-size: 13px;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.25);
  transition: 0.2s;
}
.toast.show {
  transform: none;
  opacity: 1;
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    min-height: auto;
    position: sticky;
    top: 64px;
    z-index: 8;
    display: block;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: auto;
  }
  .sidebar nav {
    display: flex;
  }
  .sidebar a {
    white-space: nowrap;
  }
  .sidebar .secure-note,
  .sidebar > a {
    display: none;
  }
  .content {
    padding: 25px 18px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .settings-column {
    grid-row: 3;
  }
  .page-head {
    align-items: start;
  }
  .draft {
    display: none;
  }
}
@media (max-width: 620px) {
  .topbar {
    padding: 0 15px;
  }
  .environment,
  .user {
    display: none;
  }
  .brand strong {
    font-size: 13px;
  }
  .sidebar a span {
    display: none;
  }
  .sidebar a {
    justify-content: center;
    width: 44px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .full {
    grid-column: auto;
  }
  .card {
    padding: 18px;
  }
  .page-head h1 {
    font-size: 24px;
  }
}

.icon-button,
.secondary { border: 1px solid var(--line); background: #fff; border-radius: 9px; color: var(--muted); cursor: pointer; }
.icon-button { width: 32px; height: 32px; }
.secondary { height: 38px; padding: 0 13px; font-weight: 650; }
.wide-card { max-width: 900px; margin: auto; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.form-actions .primary { padding: 0 20px; }
.table-card { max-width: 1040px; margin: auto; padding: 0; overflow: hidden; }
.table-card > header { padding: 20px 22px; margin: 0; border-bottom: 1px solid var(--line); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
td.subject { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.status { display: inline-flex; border-radius: 999px; padding: 4px 8px; background: #eef3f8; color: #486078; font-size: 11px; font-weight: 700; }
.status.ACTIVE, .status.AWAITING_UPLOAD { background: #e7f3fb; color: #0d609c; }
.status.DOWNLOADED, .status.UPLOADED { background: #e8f7f1; color: #137251; }
.status.REVOKED, .status.ERROR { background: #fcebed; color: #ad2e3e; }
.table-action { border: 0; background: transparent; color: var(--primary); cursor: pointer; font-weight: 650; }
.empty { text-align: center; color: var(--muted); padding: 45px; }
.metric-grid { max-width: 1040px; margin: 0 auto 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric { border: 1px solid var(--line); background: #fff; border-radius: 13px; padding: 18px; }
.metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin-top: 10px; font-size: 28px; }
.overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(9,24,42,.62); backdrop-filter: blur(8px); }
.overlay[hidden] { display: none; }
.login-card { width: min(420px, 100%); display: grid; gap: 17px; border-radius: 18px; background: #fff; padding: 34px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.login-card > .brand-mark { margin: auto; }
.login-card h1 { text-align: center; margin: 0; }
.login-card > p { text-align: center; color: var(--muted); margin: -8px 0 6px; }
.error { min-height: 18px; color: var(--danger); font-size: 12px; text-align: center; }
.result-dialog { width: min(560px, calc(100% - 30px)); border: 0; border-radius: 16px; padding: 0; box-shadow: 0 30px 90px rgba(15,23,42,.3); }
.result-dialog::backdrop { background: rgba(15,23,42,.58); }
.result-dialog form { position: relative; padding: 30px; }
.dialog-close { position: absolute; right: 12px; top: 12px; border: 0; background: #eef3f8; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; }
.result-dialog h2 { margin: 0 0 8px; }
.result-dialog p { color: var(--muted); line-height: 1.6; }
.result-box { border: 1px solid var(--line); background: #f8fafc; border-radius: 10px; padding: 12px; margin: 12px 0; word-break: break-all; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }
.copy-row button { padding: 0 12px; }
.progress-list { display: grid; gap: 8px; margin-top: 15px; }
.progress-item { border-radius: 9px; background: #f1f5f9; padding: 10px 12px; font-size: 12px; }
.progress-item.done { background: #e8f7f1; color: #137251; }
.public-app { min-height: 100vh; padding: 44px 18px; background: radial-gradient(circle at top,#eaf5fd,#f4f7fb 42%); }
.public-card { width: min(580px, 100%); margin: auto; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 20px 70px rgba(15,23,42,.12); overflow: hidden; }
.public-brand { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 24px; }
.public-card header, .public-card form, .public-card .public-body { padding: 24px; }
.public-card header { border-bottom: 1px solid var(--line); }
.public-files { display: grid; gap: 8px; margin: 14px 0; }
.public-file { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 10px; padding: 11px; }
.public-file input { width: auto; }
.success-panel { text-align: center; padding: 38px; }
.success-panel .check { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: #e8f7f1; color: #16835d; font-size: 26px; }
@media(max-width:900px) { .metric-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:620px) { .metric-grid { grid-template-columns: 1fr 1fr; } .login-card { padding: 25px; } .public-app { padding: 24px 12px; } }

/* TOEI_HIDDEN_FIX_V1 */
[hidden] {
  display: none !important;
}

/* TOEI_COPY_FEEDBACK_STYLE_V1 */
.copy-row button {
  min-width: 118px;
}
.secondary.copied {
  border-color: #9ed7c2;
  background: #e8f7f1;
  color: #137251;
}
