:root {
  --tw-bg: #050a14;
  --tw-panel: #0b1422;
  --tw-panel-strong: #091426;
  --tw-lapis: #14284c;
  --tw-ink: #eef0ed;
  --tw-muted: #a49acb;
  --tw-mint: #78e6ba;
  --tw-gold: #d4b66f;
  --tw-line: #35465e;
  --tw-danger: #ef8fa5;
  --tw-display: "STSong", "Songti SC", "SimSun", Georgia, serif;
  --tw-ui: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --tw-jp: "Yu Gothic", Meiryo, "Noto Sans JP", var(--tw-ui);
}

.app-shell[data-active-view="translation"],
.app-shell[data-active-view="access"] {
  min-height: 100dvh;
  background: var(--tw-bg);
}

.app-shell[data-active-view="translation"] .app-header,
.app-shell[data-active-view="translation"] .app-status-bar,
.app-shell[data-active-view="access"] .app-header,
.app-shell[data-active-view="access"] .app-status-bar {
  display: none;
}

.app-shell[data-active-view="translation"] .app-frame,
.app-shell[data-active-view="access"] .app-frame,
.app-shell[data-active-view="translation"] .app-frame > main,
.app-shell[data-active-view="access"] .app-frame > main {
  min-width: 0;
  margin: 0;
  padding: 0;
}

.app-shell[data-active-view="translation"] ~ .site-footer,
.app-shell[data-active-view="access"] ~ .site-footer {
  display: none;
}

.translation-workspace,
.access-workspace {
  min-height: 100dvh;
  color: var(--tw-ink);
  font-family: var(--tw-ui);
  background:
    linear-gradient(90deg, rgba(5, 10, 20, .96), rgba(5, 10, 20, .82) 70%, rgba(5, 10, 20, .9)),
    url("/static/assets/avalon/moonlit-main-v2.png") center top / cover fixed;
}

.tw-shell,
.access-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.tw-header,
.access-header {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 32px 20px;
  border-bottom: 1px solid rgba(212, 182, 111, .45);
  background: rgba(5, 10, 20, .78);
}

.tw-heading,
.access-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.tw-heading-icon,
.access-heading-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  color: var(--tw-gold);
}

.tw-heading-icon svg,
.access-heading-icon svg,
.tw-icon-button svg,
.tw-command svg,
.access-command svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tw-heading h2,
.access-heading h2 {
  margin: 0;
  color: var(--tw-ink);
  font-family: var(--tw-display);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0;
}

.tw-project-meta,
.access-heading p {
  margin: 5px 0 0;
  color: var(--tw-muted);
  font-size: 13px;
}

.tw-save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tw-mint);
  font-size: 13px;
  white-space: nowrap;
}

.tw-save-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.tw-header-actions,
.access-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.tw-command,
.tw-icon-button,
.access-command {
  min-height: 38px;
  box-sizing: border-box;
  border: 1px solid var(--tw-line);
  border-radius: 2px;
  background: rgba(9, 20, 38, .92);
  color: var(--tw-ink);
  font: 13px/1 var(--tw-ui);
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.tw-command,
.access-command {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
}

.tw-command svg,
.access-command svg {
  width: 18px;
  height: 18px;
}

.tw-icon-button {
  width: 38px;
  padding: 8px;
}

.tw-command:hover,
.tw-icon-button:hover,
.access-command:hover,
.tw-command:focus-visible,
.tw-icon-button:focus-visible,
.access-command:focus-visible {
  border-color: var(--tw-mint);
  color: var(--tw-mint);
  outline: none;
}

.tw-command.primary,
.access-command.primary {
  border-color: var(--tw-mint);
  color: var(--tw-mint);
  background: rgba(12, 42, 43, .45);
}

.tw-command.danger,
.access-command.danger {
  border-color: rgba(239, 143, 165, .55);
  color: var(--tw-danger);
}

.tw-command:disabled,
.tw-icon-button:disabled,
.access-command:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.tw-search {
  width: clamp(160px, 17vw, 260px);
  height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--tw-line);
  border-radius: 2px;
  background: rgba(9, 20, 38, .9)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a49acb' stroke-width='1.6'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") 10px center / 17px no-repeat;
  color: var(--tw-ink);
  font: 13px var(--tw-ui);
}

.tw-search:focus,
.tw-field input:focus,
.tw-field select:focus,
.tw-field textarea:focus,
.tw-translation-input:focus,
.tw-preview-text:focus,
.access-field input:focus {
  border-color: var(--tw-mint);
  outline: 1px solid rgba(120, 230, 186, .25);
  outline-offset: 0;
}

.tw-export-select,
.tw-status-select,
.tw-filter-select {
  height: 38px;
  border: 1px solid var(--tw-line);
  border-radius: 2px;
  background: #091426;
  color: var(--tw-ink);
  padding: 0 30px 0 10px;
  font: 13px var(--tw-ui);
}

.tw-progress-band {
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(160px, .7fr) minmax(420px, 1.8fr);
  align-items: stretch;
  border-bottom: 1px solid rgba(212, 182, 111, .38);
  background: rgba(5, 12, 24, .88);
}

.tw-progress-count {
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-right: 1px solid var(--tw-line);
  color: var(--tw-muted);
  font-size: 13px;
}

.tw-progress-count strong {
  margin-left: 9px;
  color: var(--tw-mint);
  font-weight: 500;
}

.tw-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
}

.tw-filter {
  position: relative;
  border: 0;
  border-right: 1px solid rgba(53, 70, 94, .5);
  background: transparent;
  color: var(--tw-muted);
  font: 13px var(--tw-ui);
  cursor: pointer;
}

.tw-filter span {
  margin-left: 5px;
  color: var(--tw-ink);
  font-size: 11px;
}

.tw-filter.active {
  color: var(--tw-ink);
}

.tw-filter.active::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0;
  height: 2px;
  background: var(--tw-mint);
}

.tw-editor-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(460px, 1fr) minmax(310px, 360px);
  background: rgba(5, 10, 20, .78);
}

.tw-project-rail,
.tw-inspector {
  min-width: 0;
  background: rgba(6, 14, 26, .94);
}

.tw-project-rail {
  border-right: 1px solid rgba(212, 182, 111, .4);
}

.tw-inspector {
  border-left: 1px solid rgba(212, 182, 111, .4);
}

.tw-rail-head,
.tw-inspector-tabs {
  min-height: 46px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--tw-line);
}

.tw-rail-head {
  justify-content: space-between;
  padding: 0 15px;
  color: var(--tw-ink);
  font-size: 13px;
}

.tw-project-list,
.tw-segment-index,
.tw-inspector-body {
  min-height: 0;
  overflow: auto;
  scrollbar-color: var(--tw-line) transparent;
}

.tw-project-list {
  max-height: 176px;
  border-bottom: 1px solid var(--tw-line);
}

.tw-project-item,
.tw-index-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(53, 70, 94, .56);
  background: transparent;
  color: var(--tw-muted);
  text-align: left;
  cursor: pointer;
}

.tw-project-item {
  padding: 12px 15px;
}

.tw-project-item strong,
.tw-project-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tw-project-item strong {
  color: var(--tw-ink);
  font-size: 13px;
  font-weight: 500;
}

.tw-project-item span {
  margin-top: 4px;
  font-size: 11px;
}

.tw-project-item.active,
.tw-index-item.active {
  background: linear-gradient(90deg, rgba(20, 40, 76, .96), rgba(13, 30, 55, .92));
  box-shadow: inset 2px 0 var(--tw-mint);
}

.tw-index-title {
  padding: 14px 15px 8px;
  color: var(--tw-gold);
  font: 14px var(--tw-display);
}

.tw-segment-index {
  max-height: calc(100dvh - 405px);
}

.tw-index-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 12px;
}

.tw-index-number {
  color: var(--tw-gold);
  font: 12px Georgia, serif;
}

.tw-index-copy {
  min-width: 0;
}

.tw-index-copy strong,
.tw-index-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tw-index-copy strong {
  color: var(--tw-ink);
  font: 12px var(--tw-jp);
  font-weight: 400;
}

.tw-index-copy span {
  margin-top: 4px;
  font-size: 10px;
}

.tw-status-untranslated { color: var(--tw-muted) !important; }
.tw-status-draft { color: var(--tw-gold) !important; }
.tw-status-review { color: #e8b286 !important; }
.tw-status-confirmed { color: var(--tw-mint) !important; }

.tw-canvas {
  min-width: 0;
  min-height: 0;
  width: auto;
  max-width: none;
  margin: 0;
  overflow: auto;
  padding: 14px;
  background: rgba(4, 10, 19, .75);
  scrollbar-color: var(--tw-line) transparent;
}

.tw-segment-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  margin-bottom: 12px;
  border: 1px solid rgba(53, 70, 94, .8);
  border-radius: 2px;
  background: rgba(11, 20, 34, .94);
}

.tw-segment-row.active {
  border-color: rgba(120, 230, 186, .72);
  box-shadow: inset 2px 0 var(--tw-mint);
}

.tw-segment-no {
  padding: 16px 7px;
  border-right: 1px solid var(--tw-line);
  color: var(--tw-gold);
  font: 12px Georgia, serif;
  text-align: center;
}

.tw-segment-content {
  min-width: 0;
}

.tw-source-block,
.tw-translation-block {
  padding: 13px 15px;
}

.tw-source-block {
  border-bottom: 1px solid var(--tw-line);
}

.tw-segment-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--tw-muted);
  font-size: 11px;
}

.tw-source-text {
  margin: 0;
  color: var(--tw-ink);
  font: 17px/1.75 var(--tw-jp);
  overflow-wrap: anywhere;
}

.tw-translation-input {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid var(--tw-line);
  border-radius: 2px;
  background: #07111f;
  color: var(--tw-ink);
  font: 15px/1.65 var(--tw-ui);
}

.tw-segment-footer {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-top: 1px solid var(--tw-line);
}

.tw-segment-footer label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--tw-muted);
  font-size: 11px;
}

.tw-status-select {
  width: auto;
  height: 30px;
  border-color: transparent;
  background: transparent;
  padding-left: 0;
}

.tw-analysis {
  border-top: 1px solid rgba(53, 70, 94, .66);
}

.tw-analysis summary {
  padding: 10px 14px;
  color: var(--tw-muted);
  font-size: 11px;
  cursor: pointer;
  list-style: none;
}

.tw-analysis summary::before {
  content: "›";
  display: inline-block;
  margin-right: 8px;
  color: var(--tw-gold);
  transition: transform .15s ease;
}

.tw-analysis[open] summary::before { transform: rotate(90deg); }

.tw-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 14px 13px;
}

.tw-token {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--tw-line);
  border-radius: 2px;
  background: rgba(8, 19, 34, .9);
  color: var(--tw-ink);
  font: 12px var(--tw-jp);
  cursor: pointer;
}

.tw-token:hover,
.tw-token.selected {
  border-color: var(--tw-mint);
  color: var(--tw-mint);
}

.tw-token small {
  display: block;
  margin-top: 3px;
  color: var(--tw-muted);
  font: 9px var(--tw-ui);
}

.tw-inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.tw-inspector-tab {
  align-self: stretch;
  border: 0;
  border-right: 1px solid rgba(53, 70, 94, .6);
  background: transparent;
  color: var(--tw-muted);
  font: 12px var(--tw-ui);
  cursor: pointer;
}

.tw-inspector-tab.active {
  color: var(--tw-ink);
  box-shadow: inset 0 -2px var(--tw-mint);
}

.tw-inspector-body {
  max-height: calc(100dvh - 212px);
  padding: 18px;
}

.tw-inspector-empty,
.tw-empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  min-height: 260px;
  padding: 28px;
  color: var(--tw-muted);
  text-align: center;
}

.tw-empty-state {
  flex: 1;
  min-height: calc(100dvh - 112px);
}

.tw-empty-state h3,
.tw-inspector-empty h3 {
  margin: 0;
  color: var(--tw-ink);
  font: 24px var(--tw-display);
}

.tw-empty-state p,
.tw-inspector-empty p {
  max-width: 480px;
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.tw-word-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--tw-line);
}

.tw-word-head h3 {
  margin: 0;
  color: var(--tw-ink);
  font: 25px var(--tw-jp);
  font-weight: 500;
}

.tw-word-head p {
  margin: 5px 0 0;
  color: var(--tw-muted);
  font-size: 12px;
}

.tw-star-button {
  border: 0;
  background: transparent;
  color: var(--tw-gold);
  font-size: 24px;
  cursor: pointer;
}

.tw-inspector-section {
  padding: 15px 0;
  border-bottom: 1px solid var(--tw-line);
}

.tw-inspector-section h4 {
  margin: 0 0 10px;
  color: var(--tw-gold);
  font: 14px var(--tw-display);
  font-weight: 500;
}

.tw-definition {
  margin-bottom: 12px;
}

.tw-definition:last-child { margin-bottom: 0; }

.tw-definition strong {
  display: block;
  margin-bottom: 5px;
  color: var(--tw-ink);
  font: 13px var(--tw-jp);
  font-weight: 500;
}

.tw-definition p,
.tw-example p,
.tw-glossary-item p,
.tw-vocab-item p {
  margin: 0;
  color: var(--tw-ink);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.tw-definition small,
.tw-example small,
.tw-glossary-item small,
.tw-vocab-item small {
  display: block;
  margin-top: 5px;
  color: var(--tw-muted);
  font-size: 10px;
}

.tw-source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--tw-mint);
  font-size: 12px;
  text-decoration: none;
}

.tw-source-link:hover { text-decoration: underline; }

.tw-example {
  margin-bottom: 13px;
  padding-left: 11px;
  border-left: 1px solid rgba(212, 182, 111, .6);
}

.tw-example .translation {
  margin-top: 4px;
  color: var(--tw-muted);
}

.tw-lookup-warning,
.tw-form-message,
.access-message {
  padding: 9px 10px;
  border: 1px solid rgba(212, 182, 111, .45);
  color: var(--tw-gold);
  font-size: 11px;
  line-height: 1.5;
}

.tw-glossary-list,
.tw-vocab-list {
  display: grid;
  gap: 8px;
}

.tw-glossary-item,
.tw-vocab-item {
  padding: 10px;
  border: 1px solid var(--tw-line);
  background: rgba(9, 20, 38, .72);
}

.tw-glossary-item-head,
.tw-vocab-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tw-glossary-item-head strong,
.tw-vocab-item-head strong {
  color: var(--tw-ink);
  font-size: 12px;
}

.tw-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.tw-mini-action {
  min-height: 27px;
  padding: 0 8px;
  border: 1px solid var(--tw-line);
  border-radius: 2px;
  background: transparent;
  color: var(--tw-muted);
  font: 10px var(--tw-ui);
  cursor: pointer;
}

.tw-mini-action:hover { border-color: var(--tw-mint); color: var(--tw-mint); }
.tw-mini-action.danger:hover { border-color: var(--tw-danger); color: var(--tw-danger); }

.tw-form {
  display: grid;
  gap: 12px;
}

.tw-field,
.access-field {
  display: grid;
  gap: 6px;
}

.tw-field > span,
.access-field > span {
  color: var(--tw-muted);
  font-size: 11px;
}

.tw-field input,
.tw-field select,
.tw-field textarea,
.access-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--tw-line);
  border-radius: 2px;
  background: #07111f;
  color: var(--tw-ink);
  font: 13px/1.5 var(--tw-ui);
}

.tw-field input,
.tw-field select,
.access-field input { height: 38px; padding: 0 10px; }
.tw-field textarea { min-height: 76px; padding: 9px 10px; resize: vertical; }

.tw-import {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 22px 32px 28px;
  background: rgba(5, 10, 20, .82);
}

.tw-import-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 760px;
  margin: 0 auto 22px;
}

.tw-import-step {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  color: var(--tw-muted);
  font-size: 13px;
}

.tw-import-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 68%;
  right: -32%;
  top: 50%;
  height: 1px;
  background: rgba(212, 182, 111, .48);
}

.tw-import-step b {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font: 12px Georgia, serif;
  font-weight: 400;
}

.tw-import-step.active { color: var(--tw-mint); }
.tw-import-step.active b { background: var(--tw-mint); color: var(--tw-bg); border-color: var(--tw-mint); }
.tw-import-step.complete { color: var(--tw-ink); }

.tw-import-settings {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(2, minmax(140px, .7fr)) minmax(240px, 1.4fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(212, 182, 111, .42);
  background: rgba(7, 16, 29, .9);
}

.tw-file-source {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.tw-file-source .tw-field { flex: 1; }

.tw-source-tabs,
.tw-segment-modes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  border: 1px solid var(--tw-line);
}

.tw-source-tab,
.tw-segment-mode {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-right: 1px solid var(--tw-line);
  background: transparent;
  color: var(--tw-muted);
  font: 12px var(--tw-ui);
  cursor: pointer;
}

.tw-source-tab:last-child,
.tw-segment-mode:last-child { border-right: 0; }
.tw-source-tab.active,
.tw-segment-mode.active { color: var(--tw-mint); box-shadow: inset 0 0 0 1px var(--tw-mint); }

.tw-import-source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 14px;
}

.tw-paste-input {
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--tw-line);
  border-radius: 2px;
  background: rgba(7, 17, 31, .94);
  color: var(--tw-ink);
  font: 14px/1.7 var(--tw-jp);
  resize: vertical;
}

.tw-import-options {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0;
}

.tw-check,
.access-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--tw-muted);
  font-size: 12px;
}

.tw-check input,
.access-toggle-row input,
.access-permission input,
.tw-preview-check {
  width: 17px;
  height: 17px;
  accent-color: var(--tw-mint);
}

.tw-preview-wrap {
  border: 1px solid rgba(212, 182, 111, .42);
  background: rgba(6, 14, 26, .94);
}

.tw-preview-head,
.tw-preview-row {
  display: grid;
  grid-template-columns: 34px 48px minmax(0, 1fr) 160px;
  align-items: center;
  gap: 10px;
}

.tw-preview-head {
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--tw-line);
  color: var(--tw-muted);
  font-size: 11px;
}

.tw-preview-list {
  max-height: 430px;
  overflow: auto;
}

.tw-preview-row {
  min-height: 58px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(53, 70, 94, .62);
}

.tw-preview-row.selected { background: rgba(20, 40, 76, .66); box-shadow: inset 2px 0 var(--tw-mint); }
.tw-preview-row:last-child { border-bottom: 0; }
.tw-preview-number { color: var(--tw-gold); font: 12px Georgia, serif; }
.tw-preview-text {
  width: 100%;
  min-height: 38px;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--tw-ink);
  font: 14px/1.55 var(--tw-jp);
  resize: vertical;
}
.tw-preview-ref { color: var(--tw-muted); font-size: 10px; text-align: right; }
.tw-preview-warning { margin-left: 7px; color: var(--tw-gold); }

.tw-import-summary,
.tw-import-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tw-import-summary {
  justify-content: space-between;
  padding: 14px 0;
  color: var(--tw-muted);
  font-size: 12px;
}

.tw-import-actions {
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid rgba(212, 182, 111, .42);
}

.access-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(310px, 390px);
  gap: 12px;
  padding: 0 32px 28px;
}

.access-users,
.access-inspector {
  min-width: 0;
  border: 1px solid rgba(212, 182, 111, .42);
  background: rgba(6, 14, 26, .94);
}

.access-search-row {
  padding: 16px;
  border-bottom: 1px solid var(--tw-line);
}

.access-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.access-table th,
.access-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(53, 70, 94, .65);
  color: var(--tw-muted);
  font-size: 12px;
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-table th {
  color: var(--tw-ink);
  font-weight: 500;
}

.access-table tbody tr { cursor: pointer; }
.access-table tbody tr:hover,
.access-table tbody tr.active { background: rgba(20, 40, 76, .72); }
.access-table td:first-child { color: var(--tw-ink); }

.access-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.access-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.access-state.active { color: var(--tw-mint); }
.access-state.disabled { color: var(--tw-muted); }

.access-module-list {
  display: flex;
  gap: 7px;
}

.access-module-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--tw-line);
  color: var(--tw-gold);
  font-size: 10px;
}

.access-inspector {
  padding: 20px;
}

.access-inspector h3,
.access-inspector h4 {
  margin: 0;
  color: var(--tw-ink);
  font-family: var(--tw-display);
  font-weight: 500;
}

.access-inspector h3 { font-size: 21px; }
.access-inspector h4 { margin-bottom: 12px; font-size: 16px; }

.access-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--tw-line);
}

.access-permissions {
  display: grid;
  gap: 11px;
}

.access-permission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--tw-ink);
  font-size: 12px;
}

.access-permission small {
  display: block;
  margin-top: 3px;
  color: var(--tw-muted);
  font-size: 10px;
}

.access-inspector-actions {
  display: grid;
  gap: 9px;
  padding-top: 18px;
}

.tw-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(212, 182, 111, .6);
  border-radius: 3px;
  background: #081321;
  color: var(--tw-ink);
}

.tw-dialog::backdrop { background: rgba(2, 6, 13, .82); }
.tw-dialog form { padding: 22px; }
.tw-dialog h3 { margin: 0 0 18px; font: 23px var(--tw-display); }
.tw-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

.tw-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--tw-muted);
  font-size: 12px;
}

.tw-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 1px solid var(--tw-line);
  border-top-color: var(--tw-mint);
  border-radius: 50%;
  animation: tw-spin .7s linear infinite;
}

@keyframes tw-spin { to { transform: rotate(360deg); } }

@media (min-width: 901px) {
  body:has(.app-shell:not(.hidden)[data-active-view="home"]) {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell[data-active-view="home"] {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .app-shell[data-active-view="home"] .app-frame,
  .app-shell[data-active-view="home"] .app-frame > main,
  .app-shell[data-active-view="home"] .platform-home {
    height: auto;
    min-height: 100dvh;
  }

  .app-shell[data-active-view="home"] .platform-home {
    overflow: visible;
  }

  .app-shell[data-active-view="home"] .platform-sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    grid-template-rows: max-content max-content max-content max-content;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .platform-home:has(#translationHomeRow:not([hidden])) .avalon-tool-row {
    height: clamp(92px, 10.5vh, 108px);
    grid-template-columns: clamp(90px, 10.8vh, 112px) minmax(0, 1fr) auto;
    padding-top: clamp(9px, 1.2vh, 13px);
    padding-bottom: clamp(9px, 1.2vh, 13px);
  }

  .platform-home:has(#translationHomeRow:not([hidden])) .avalon-tool-icon {
    width: clamp(66px, 7.8vh, 82px);
    height: clamp(66px, 7.8vh, 82px);
  }

  .platform-home:has(#translationHomeRow:not([hidden])) .avalon-tool-icon::before {
    width: clamp(94px, 11.2vh, 118px);
    height: clamp(94px, 11.2vh, 118px);
  }

  body:has(.app-shell:not(.hidden)[data-active-view="translation"]),
  body:has(.app-shell:not(.hidden)[data-active-view="access"]) {
    overflow: hidden;
  }

  .app-shell[data-active-view="translation"],
  .app-shell[data-active-view="access"] {
    height: 100dvh;
    grid-template-columns: clamp(250px, 19vw, 292px) minmax(0, 1fr);
    overflow: hidden;
  }

  .app-shell[data-active-view="translation"] .side-nav button,
  .app-shell[data-active-view="access"] .side-nav button {
    min-height: 78px;
    height: 78px;
    grid-template-columns: 34px 38px minmax(0, 1fr);
    gap: 5px;
    padding-left: 20px;
    padding-right: 12px;
  }

  .app-shell[data-active-view="translation"] .side-nav button:not(.active) .nav-label,
  .app-shell[data-active-view="access"] .side-nav button:not(.active) .nav-label {
    margin-left: 4px;
  }

  .app-shell[data-active-view="translation"] .side-nav button.active,
  .app-shell[data-active-view="access"] .side-nav button.active {
    min-height: 84px;
    height: 84px;
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 8px;
  }

  .app-shell[data-active-view="translation"] .sidebar-brand,
  .app-shell[data-active-view="access"] .sidebar-brand {
    padding: 32px 30px 18px;
  }

  .app-shell[data-active-view="translation"] .overview-link,
  .app-shell[data-active-view="access"] .overview-link {
    width: calc(100% - 60px);
    margin: 0 30px 12px;
    padding: 8px 0 16px;
  }

  .app-shell[data-active-view="translation"] .sidebar-footer,
  .app-shell[data-active-view="access"] .sidebar-footer {
    margin: 18px 30px 0;
  }

  .app-shell[data-active-view="translation"] .nav-index,
  .app-shell[data-active-view="access"] .nav-index {
    font-size: 36px;
  }

  .app-shell[data-active-view="translation"] .nav-icon,
  .app-shell[data-active-view="access"] .nav-icon {
    width: 31px;
    height: 31px;
  }

  .app-shell[data-active-view="translation"] .nav-label,
  .app-shell[data-active-view="access"] .nav-label {
    font-size: 17px;
  }

  .app-shell[data-active-view="translation"] .platform-sidebar,
  .app-shell[data-active-view="access"] .platform-sidebar,
  .app-shell[data-active-view="translation"] .app-frame,
  .app-shell[data-active-view="access"] .app-frame,
  .translation-workspace,
  .access-workspace,
  .tw-shell,
  .access-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell[data-active-view="translation"] .platform-sidebar,
  .app-shell[data-active-view="access"] .platform-sidebar {
    grid-template-rows: max-content max-content max-content max-content;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .access-users,
  .access-inspector {
    min-height: 0;
    overflow-y: auto;
  }

  .app-shell[data-active-view="home"] .sidebar-brand,
  .app-shell[data-active-view="translation"] .sidebar-brand,
  .app-shell[data-active-view="access"] .sidebar-brand {
    min-height: 136px;
    box-sizing: border-box;
  }
}

@media (min-width: 901px) and (max-height: 700px) {
  .app-shell[data-active-view="translation"] .side-nav button,
  .app-shell[data-active-view="access"] .side-nav button {
    min-height: 58px;
    height: 58px;
  }

  .app-shell[data-active-view="translation"] .side-nav button.active,
  .app-shell[data-active-view="access"] .side-nav button.active {
    min-height: 64px;
    height: 64px;
  }

  .app-shell[data-active-view="translation"] .sidebar-footer,
  .app-shell[data-active-view="access"] .sidebar-footer {
    margin-top: 10px;
  }
}

@media (max-width: 1320px) {
  .tw-editor-layout { grid-template-columns: 190px minmax(420px, 1fr) 310px; }
  .tw-header, .access-header { padding-left: 24px; padding-right: 24px; }
  .tw-header-actions { gap: 7px; }
  .tw-command { padding: 0 10px; }
  .tw-search { width: 150px; }
  .access-body { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 1080px) {
  .tw-header { align-items: flex-start; flex-wrap: wrap; }
  .tw-header-actions { width: 100%; margin-left: 60px; justify-content: flex-start; }
  .tw-editor-layout { grid-template-columns: 170px minmax(390px, 1fr) 285px; }
  .tw-inspector-body { padding: 14px; }
  .tw-import-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .access-body { grid-template-columns: minmax(430px, 1fr) 310px; }
}

@media (max-width: 900px) {
  .translation-workspace,
  .access-workspace { min-height: auto; }
  .tw-header,
  .access-header { min-height: auto; padding: 20px; }
  .tw-heading h2,
  .access-heading h2 { font-size: 28px; }
  .tw-header-actions { margin-left: 0; }
  .tw-progress-band { grid-template-columns: 1fr; }
  .tw-progress-count { min-height: 42px; border-right: 0; border-bottom: 1px solid var(--tw-line); }
  .tw-editor-layout { display: block; }
  .tw-project-rail { border-right: 0; border-bottom: 1px solid rgba(212, 182, 111, .4); }
  .tw-project-list { display: flex; max-height: none; overflow-x: auto; }
  .tw-project-item { min-width: 180px; border-right: 1px solid var(--tw-line); }
  .tw-index-title { display: none; }
  .tw-segment-index { display: flex; max-height: none; overflow-x: auto; }
  .tw-index-item { min-width: 210px; border-right: 1px solid var(--tw-line); }
  .tw-canvas { max-height: none; overflow: visible; }
  .tw-inspector { border-left: 0; border-top: 1px solid rgba(212, 182, 111, .4); }
  .tw-inspector-body { max-height: none; }
  .tw-import { padding: 20px; }
  .tw-preview-head,
  .tw-preview-row { grid-template-columns: 30px 40px minmax(0, 1fr); }
  .tw-preview-ref { display: none; }
  .access-body { display: block; padding: 0 20px 24px; }
  .access-users { margin-bottom: 12px; }
}

@media (max-width: 680px) {
  .app-shell[data-active-view="translation"] .side-nav,
  .app-shell[data-active-view="access"] .side-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(132px, 1fr);
    grid-template-columns: none;
    grid-template-rows: 1fr;
  }
  .tw-header,
  .access-header { gap: 12px; padding: 16px; }
  .tw-heading-icon,
  .access-heading-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .tw-heading h2,
  .access-heading h2 { font-size: 24px; }
  .tw-header-actions,
  .access-header-actions { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .tw-search { order: 10; width: 100%; }
  .tw-command { min-height: 36px; }
  .tw-filters { grid-template-columns: repeat(2, 1fr); }
  .tw-filter { min-height: 40px; border-bottom: 1px solid rgba(53, 70, 94, .5); }
  .tw-segment-row { grid-template-columns: 30px minmax(0, 1fr); }
  .tw-segment-no { padding-left: 4px; padding-right: 4px; }
  .tw-source-block,
  .tw-translation-block { padding: 11px; }
  .tw-source-text { font-size: 16px; }
  .tw-translation-input { min-height: 120px; }
  .tw-import { padding: 16px; }
  .tw-import-steps { grid-template-columns: 1fr; }
  .tw-import-step { justify-content: flex-start; }
  .tw-import-step::after { display: none; }
  .tw-import-settings { grid-template-columns: 1fr; }
  .tw-import-source { grid-template-columns: 1fr; }
  .tw-import-options { align-items: flex-start; flex-direction: column; }
  .tw-preview-row { align-items: start; }
  .tw-import-summary,
  .tw-import-actions { align-items: stretch; flex-direction: column; }
  .tw-import-actions .tw-command { width: 100%; }
  .access-header { align-items: flex-start; flex-direction: column; }
  .access-table th:nth-child(3),
  .access-table td:nth-child(3),
  .access-table th:nth-child(4),
  .access-table td:nth-child(4) { display: none; }
  .access-table th,
  .access-table td { padding: 12px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tw-loading::before { animation: none; }
  .tw-command,
  .tw-icon-button,
  .access-command,
  .tw-analysis summary::before { transition: none; }
}
