:root {
  --ink: #17231f;
  --muted: #5d6866;
  --paper: #f4f6f5;
  --surface: #fff;
  --line: #d9dfdc;
  --accent: #8a2f3d;
  --accent-dark: #69232e;
  --green: #1f6f68;
  --gold: #a77b2d;
  --danger: #a33131;
  --shadow: 0 14px 40px rgba(29, 39, 34, 0.09);
  font-family: Inter, "Noto Sans SC", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  letter-spacing: 0;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  line-height: 1.55;
}
a {
  color: inherit;
}
img {
  max-width: 100%;
  display: block;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.header-row {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
}
.brand-mark {
  width: 35px;
  height: 35px;
  border: 1px solid var(--ink);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 20px;
}
.brand-copy strong {
  display: block;
  font:
    600 17px Georgia,
    "Noto Serif SC",
    serif;
}
.brand-copy span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}
.main-nav a {
  padding: 8px 10px;
  text-decoration: none;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--accent);
  border-color: var(--accent);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.language-form {
  display: flex;
  border: 1px solid var(--line);
}
.language-form button {
  border: 0;
  background: transparent;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
}
.language-form button.active {
  background: var(--ink);
  color: #fff;
}
.user-chip {
  font-size: 12px;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-button,
.text-button {
  border: 1px solid var(--line);
  background: #fff;
  padding: 7px 10px;
  text-decoration: none;
  font-size: 13px;
  color: var(--ink);
}
.icon-button:hover,
.text-button:hover {
  border-color: var(--ink);
}
main {
  padding: 44px 0 72px;
}
.page-heading {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 34px;
}
.eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.page-heading h1 {
  font:
    500 48px/1.12 Georgia,
    "Noto Serif SC",
    serif;
  margin: 8px 0 12px;
}
.page-heading p {
  color: var(--muted);
  margin: 0;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 0 auto 28px;
}
.panel.narrow {
  max-width: 820px;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.panel h2,
.panel h3 {
  font:
    500 22px Georgia,
    "Noto Serif SC",
    serif;
  margin: 0;
}
.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
  align-items: end;
}
.toolbar.cols-3 {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field.span-2 {
  grid-column: span 2;
}
.field label,
.field-label {
  font-size: 12px;
  font-weight: 700;
  color: #44514c;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd0cb;
  background: #fff;
  padding: 9px 11px;
  color: var(--ink);
  border-radius: 0;
}
.field textarea {
  min-height: 112px;
  resize: vertical;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(36, 79, 67, 0.18);
  border-color: var(--green);
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  font-size: 13px;
}
.check input {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}
.btn {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  min-height: 42px;
  padding: 9px 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 650;
  font-size: 13px;
}
.btn:hover {
  background: #173a31;
}
.btn.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.actions {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.alert {
  max-width: 820px;
  margin: 0 auto 20px;
  border-left: 3px solid var(--accent);
  background: #fff4ed;
  padding: 12px 15px;
  color: #6a2b20;
}
.alert.success {
  border-color: var(--green);
  background: #edf7f2;
  color: #204c3e;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 3px 0 0;
}
.plot-wrap {
  overflow: auto;
  min-height: 420px;
}
.plot-wrap .plotly-graph-div {
  margin: auto;
}
.inspect {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 26px;
  align-items: start;
}
.inspect img {
  width: 300px;
  height: 300px;
  object-fit: contain;
  background: #eceee9;
  border: 1px solid var(--line);
}
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}
.image-card {
  background: #fff;
  border: 1px solid var(--line);
  min-width: 0;
}
.image-card > a {
  display: block;
  background: #e9ebe7;
  aspect-ratio: 4/3;
  overflow: hidden;
}
.image-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s;
}
.image-card:hover img {
  transform: scale(1.025);
}
.image-card-body {
  padding: 13px;
}
.image-card h3 {
  font:
    500 16px/1.35 Georgia,
    "Noto Serif SC",
    serif;
  margin: 0 0 7px;
  overflow-wrap: anywhere;
}
.meta {
  color: var(--muted);
  font-size: 12px;
  margin: 3px 0;
  overflow-wrap: anywhere;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 42px 20px;
}
.detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 30px;
  align-items: start;
}
.detail-image {
  width: 100%;
  max-height: 660px;
  object-fit: contain;
  background: #e8eae5;
  border: 1px solid var(--line);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.data-table th {
  width: 34%;
  color: var(--muted);
  font-weight: 600;
}
.section-title {
  font:
    500 23px Georgia,
    "Noto Serif SC",
    serif;
  margin: 32px 0 15px;
}
.form-section {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.form-section:first-of-type {
  border-top: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-grid .full {
  grid-column: 1/-1;
}
.cluster-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cluster-item {
  width: 150px;
}
.cluster-item img {
  width: 150px;
  height: 120px;
  object-fit: contain;
  background: #e8eae5;
}
.footer {
  border-top: 1px solid var(--line);
  padding: 25px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.mobile-menu {
  display: none;
}
.login-document {
  height: 100%;
  overflow: hidden;
}
.login-body {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.login-page {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(390px, 0.8fr);
  grid-template-rows: minmax(0, 1fr);
  background: #13251f;
}
.login-story {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 7vw;
  background: #13251f url("/static/login-archive.jpg") center/cover;
}
.login-story::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(16, 37, 31, 0.72);
}
.login-story-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  color: #fff;
}
.login-story h1 {
  font:
    500 72px/0.98 Georgia,
    "Noto Serif SC",
    serif;
  margin: 14px 0 20px;
}
.login-story p {
  max-width: 600px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
}
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 50px;
  background: #f7f8f7;
}
.login-box {
  width: min(420px, 100%);
}
.login-box h2 {
  font:
    500 34px Georgia,
    "Noto Serif SC",
    serif;
  margin: 25px 0 8px;
}
.login-box .field {
  margin-top: 16px;
}
.login-box .btn {
  width: 100%;
  margin-top: 20px;
}
.login-note {
  color: var(--muted);
  font-size: 12px;
  margin: 18px 0 12px;
}
.user-table select {
  min-width: 120px;
}
.permission-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.permission-grid label {
  font-size: 11px;
}
.admin-heading {
  margin-bottom: 24px;
}
.account-overview {
  max-width: 920px;
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #fff;
}
.account-overview > div {
  padding: 18px 22px;
  display: flex;
  align-items: baseline;
  gap: 9px;
  border-right: 1px solid var(--line);
}
.account-overview > div:last-child {
  border-right: 0;
}
.account-overview strong {
  color: var(--accent);
  font: 500 28px/1 Georgia, "Noto Serif SC", serif;
  font-variant-numeric: tabular-nums;
}
.account-overview span {
  color: var(--muted);
  font-size: 12px;
}
.account-create,
.account-section {
  max-width: 920px;
}
.account-create {
  padding: 0;
}
.account-create > summary {
  list-style: none;
  cursor: pointer;
  min-height: 76px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.account-create > summary::-webkit-details-marker {
  display: none;
}
.account-create > summary strong,
.account-create > summary small {
  display: block;
}
.account-create > summary strong {
  font: 500 21px Georgia, "Noto Serif SC", serif;
}
.account-create > summary small {
  color: var(--muted);
  margin-top: 3px;
}
.summary-action {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.account-create[open] > summary {
  border-bottom: 1px solid var(--line);
}
.account-create > .account-form {
  padding: 22px;
}
.section-heading {
  margin: 38px 0 15px;
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(280px, 1.2fr);
  gap: 24px;
  align-items: end;
}
.section-heading h2 {
  margin: 4px 0 0;
  font: 500 28px Georgia, "Noto Serif SC", serif;
}
.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.account-card {
  max-width: none;
  padding: 0;
  margin-bottom: 16px;
  box-shadow: none;
}
.account-card.inactive-account {
  background: #f8f9f8;
}
.account-form {
  min-width: 0;
}
.account-card .account-form {
  padding: 22px;
}
.account-card-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.account-identity {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.account-monogram {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  color: var(--accent);
  background: #fff;
  font: 500 20px Georgia, serif;
}
.account-card h3 {
  overflow-wrap: anywhere;
}
.account-badges {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.role-badge,
.status-badge {
  padding: 4px 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.status-active {
  border-color: #9fc0b4;
  color: #24574a;
  background: #edf7f2;
}
.status-inactive {
  color: #765e5e;
  background: #f3eeee;
}
.current-account {
  color: var(--accent);
  border-color: #d8adb4;
  background: #fbf1f3;
}
.account-primary-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.account-active-toggle {
  align-self: end;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: #fff;
}
.account-settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.account-form .permission-grid {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #f7f8f7;
}
.account-actions {
  justify-content: flex-end;
  margin-top: 18px;
}
.account-delete {
  margin-left: auto;
}
.flash-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
}
.flash {
  background: var(--ink);
  color: #fff;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
}
@media (max-width: 960px) {
  .header-row {
    height: auto;
    min-height: 68px;
    flex-wrap: wrap;
    padding: 9px 0;
  }
  .main-nav {
    display: flex;
    order: 3;
    width: 100%;
    margin: 0;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .main-nav a {
    flex: 0 0 auto;
  }
  .header-actions {
    margin-left: auto;
  }
  .toolbar,
  .toolbar.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-page {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 42fr) minmax(0, 58fr);
  }
  .login-story {
    padding: clamp(28px, 5vh, 50px) 7vw;
  }
  .login-panel {
    padding: clamp(24px, 4vh, 40px) 7vw;
  }
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .detail-image {
    max-width: 560px;
    margin: auto;
  }
  .account-create,
  .account-section,
  .account-overview {
    max-width: 100%;
  }
}
@media (max-width: 620px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }
  .header-row {
    height: 64px;
    gap: 10px;
  }
  .brand-copy span,
  .user-chip {
    display: none;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
  }
  .language-form button {
    padding: 5px;
  }
  .toolbar,
  .toolbar.cols-3,
  .form-grid,
  .account-primary-fields,
  .section-heading {
    grid-template-columns: 1fr;
  }
  .field.span-2,
  .form-grid .full {
    grid-column: auto;
  }
  .panel {
    padding: 17px;
  }
  .account-overview {
    grid-template-columns: 1fr;
  }
  .account-overview > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .account-overview > div:last-child {
    border-bottom: 0;
  }
  .account-card .account-form,
  .account-create > .account-form {
    padding: 17px;
  }
  .account-card-header {
    flex-direction: column;
  }
  .account-badges {
    justify-content: flex-start;
  }
  .account-settings-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }
  .account-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .account-actions .btn,
  .account-delete {
    width: 100%;
    margin-left: 0;
  }
  .page-heading h1 {
    font-size: 32px;
  }
  .inspect {
    grid-template-columns: 1fr;
  }
  .inspect img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
  .image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .image-card-body {
    padding: 10px;
  }
  .login-page {
    grid-template-rows: minmax(0, 34fr) minmax(0, 66fr);
  }
  .login-story {
    padding: 24px 7vw;
  }
  .login-story h1 {
    font-size: clamp(34px, 11vw, 42px);
    margin: 8px 0 10px;
  }
  .login-story p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
  }
  .login-panel {
    padding: 18px 22px;
  }
  .login-box h2 {
    font-size: 28px;
    margin: 12px 0 4px;
  }
  .login-box .field {
    margin-top: 10px;
  }
  .login-box .btn {
    margin-top: 14px;
  }
  .login-note {
    margin: 10px 0 8px;
  }
  .header-actions .text-button {
    font-size: 0;
  }
  .header-actions .text-button::after {
    content: "→";
    font-size: 16px;
  }
}

@media (max-width: 960px) and (orientation: landscape) {
  .login-page {
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .login-story {
    padding: clamp(24px, 5vw, 48px);
  }
  .login-story h1 {
    font-size: clamp(40px, 7vw, 60px);
  }
  .login-panel {
    padding: clamp(18px, 4vw, 36px);
  }
}

@media (max-height: 700px) {
  .login-box h2 {
    font-size: 26px;
    margin: 8px 0 3px;
  }
  .login-box .field {
    gap: 3px;
    margin-top: 7px;
  }
  .login-box .field input {
    min-height: 36px;
    padding: 6px 9px;
  }
  .login-box .btn {
    min-height: 36px;
    margin-top: 9px;
    padding: 6px 14px;
  }
  .login-note {
    margin: 7px 0 6px;
    font-size: 11px;
  }
  .login-box .text-button {
    padding: 5px 8px;
    font-size: 12px;
  }
  .login-box .alert {
    margin-bottom: 7px;
    padding: 7px 9px;
    font-size: 12px;
  }
}

@media (max-width: 620px) and (max-height: 700px) and (orientation: portrait) {
  .login-page {
    grid-template-rows: minmax(0, 28fr) minmax(0, 72fr);
  }
  .login-story {
    padding: 16px 6vw;
  }
  .login-story h1 {
    font-size: 32px;
    margin: 4px 0 6px;
  }
  .login-story p {
    font-size: 12px;
    line-height: 1.3;
  }
  .login-panel {
    padding: 12px 18px;
  }
  .login-box h2 {
    font-size: 24px;
    margin-top: 6px;
  }
}
