:root {
  --ink: #172326;
  --muted: #667579;
  --line: #dce3e3;
  --surface: #fff;
  --soft: #f2f5f4;
  --primary: #157565;
  --primary-dark: #0d5a4d;
  --primary-soft: #e8f4f1;
  --danger: #b42318;
  --warning: #946200;
  --blue: #2869b2;
  --sidebar-width: 248px;
  --topbar-height: 64px;
}

.ui-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.app-body {
  min-width: 320px;
  background: #f4f6f6;
  color: var(--ink);
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 20px 14px 14px;
  border-right: 1px solid #dfe5e5;
  background: #fff;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 8px;
  color: var(--ink);
}

.sidebar-brand:hover {
  color: var(--ink);
}

.sidebar-brand > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.sidebar-brand strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand small {
  color: #7a888b;
  font-size: 11px;
}

.sidebar-brand-mark {
  display: grid;
  width: 42px;
  height: 34px;
  flex: 0 0 42px;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid #a8c8c1;
  border-radius: 5px;
  background: #f4faf8;
  color: var(--primary);
  font-size: 10px;
}

.sidebar-brand-mark b {
  display: grid;
  place-items: center;
}

.sidebar-brand-mark b:first-child {
  background: #f2c94c;
  color: #263638;
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 25px 0 18px;
}

.side-nav-group + .side-nav-group {
  margin-top: 22px;
}

.side-nav-label {
  display: block;
  margin: 0 11px 7px;
  color: #8a9698;
  font-size: 11px;
  font-weight: 700;
}

.side-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  margin-top: 3px;
  padding: 0 12px;
  border-radius: 6px;
  color: #435356;
  font-weight: 600;
}

.side-nav-link:hover {
  background: #f3f6f5;
  color: #233235;
}

.side-nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.side-nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  border-radius: 0 2px 2px 0;
  background: var(--primary);
}

.sidebar-account {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 8px 0;
  border-top: 1px solid #e4e9e9;
}

.sidebar-account form {
  margin: 0;
}

.account-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #203f44;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.account-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.account-copy strong,
.account-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 13px;
}

.account-copy small {
  color: #7b898b;
  font-size: 11px;
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #667579;
}

.icon-button:hover {
  border-color: #dbe2e2;
  background: #f4f6f6;
  color: var(--ink);
}

.icon-button:focus-visible,
.side-nav-link:focus-visible {
  outline: 3px solid rgb(21 117 101 / 18%);
  outline-offset: 2px;
}

.app-workspace {
  min-width: 0;
}

.app-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 30px;
  border-bottom: 1px solid #dfe5e5;
  background: #fff;
}

.mobile-menu-button {
  display: none;
}

.topbar-context {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.topbar-context small {
  color: #7e8c8e;
  font-size: 10px;
  font-weight: 700;
}

.topbar-context strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #526164;
  font-size: 12px;
}

.service-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1b9b75;
  box-shadow: 0 0 0 3px #dff3eb;
}

.topbar-account {
  padding-left: 16px;
  border-left: 1px solid #e2e7e7;
  color: #36474a;
  font-size: 12px;
  font-weight: 600;
}

.sidebar-backdrop {
  display: none;
}

body.app-body .page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

body.app-body .page-heading {
  align-items: center;
  margin-bottom: 24px;
}

body.app-body .page-heading h1 {
  margin: 0 0 7px;
  color: #172326;
  font-size: 26px;
  line-height: 1.25;
}

body.app-body .page-heading p {
  max-width: 760px;
  color: #6c7a7d;
  line-height: 1.65;
}

.api-state-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #d8e1e0;
  border-radius: 5px;
  background: #fff;
  color: #556467;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.api-state-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c68a15;
}

.api-state-chip.ready i {
  background: #1b9b75;
}

body.app-body .alert {
  border-radius: 6px;
  box-shadow: 0 1px 2px rgb(23 35 38 / 3%);
}

body.app-body .alert.alert-toast {
  position: fixed;
  z-index: 80;
  top: 76px;
  right: 24px;
  width: min(420px, calc(100vw - 48px));
  margin: 0;
  padding: 13px 46px 13px 15px;
  box-shadow: 0 12px 30px rgb(23 35 38 / 18%);
  animation: alert-toast-in .18s ease-out;
}

body.app-body .alert-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  min-height: 30px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: currentColor;
}

body.app-body .alert-toast-close:hover {
  background: rgb(23 35 38 / 7%);
}

body.app-body .alert-toast-close .ui-icon {
  width: 16px;
  height: 16px;
}

@keyframes alert-toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

body.app-body .button,
body.app-body button {
  min-height: 38px;
  border-radius: 5px;
  font-weight: 600;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

body.app-body .button:focus-visible,
body.app-body button:focus-visible {
  outline: 3px solid rgb(21 117 101 / 17%);
  outline-offset: 2px;
}

body.app-body .primary {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgb(21 117 101 / 12%);
}

body.app-body .primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

body.app-body .secondary {
  border-color: #c4cecf;
  background: #fff;
}

body.app-body .secondary:hover {
  border-color: #95a5a7;
  background: #f7f9f8;
}

body.app-body .danger:hover {
  background: #fff5f4;
}

body.app-body input,
body.app-body select,
body.app-body textarea {
  min-height: 40px;
  border-color: #bec9ca;
  border-radius: 5px;
  background: #fff;
}

body.app-body input:hover,
body.app-body select:hover,
body.app-body textarea:hover {
  border-color: #92a2a4;
}

body.app-body input:focus,
body.app-body select:focus,
body.app-body textarea:focus {
  outline: 3px solid rgb(21 117 101 / 13%);
  border-color: var(--primary);
}

body.app-body .upload-band,
body.app-body .form-section,
body.app-body .job-progress,
body.app-body .inline-form {
  border-color: #dce3e3;
  border-radius: 7px;
  box-shadow: 0 1px 2px rgb(23 35 38 / 3%);
}

body.app-body .table-wrap,
body.app-body .file-rows {
  border-color: #dce3e3;
  border-radius: 7px;
  box-shadow: 0 1px 2px rgb(23 35 38 / 3%);
}

body.app-body table {
  font-size: 13px;
}

body.app-body th {
  height: 44px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom-color: #dce3e3;
  background: #f5f7f7;
  color: #536164;
  font-size: 12px;
}

body.app-body td {
  height: 52px;
  border-bottom-color: #e7ebeb;
}

body.app-body tbody tr:hover td {
  background: #fafcfc;
}

body.app-body .status {
  min-width: 58px;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
}

body.app-body .status.completed {
  border-color: #c8eadf;
  background: #eaf7f2;
  color: #0b6a53;
}

body.app-body .status.running {
  border-color: #cfe0f5;
  background: #edf4fc;
  color: #225e9d;
}

body.app-body .status.failed {
  border-color: #f2d1cd;
  background: #fff0ee;
  color: #9e261c;
}

body.app-body .status.disabled,
body.app-body .status.stopped {
  border-color: #dfe4e4;
  background: #f1f3f3;
  color: #637073;
}

body.app-body .section-block {
  margin-top: 28px;
}

body.app-body .section-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

body.app-body .section-title h2,
body.app-body .form-section h2 {
  color: #233235;
  font-size: 17px;
}

body.app-body .section-title > span {
  padding: 4px 8px;
  border: 1px solid #dce3e3;
  border-radius: 4px;
  background: #fff;
  font-size: 11px;
}

body.app-body .search-form {
  padding: 14px;
  border: 1px solid #dce3e3;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(23 35 38 / 3%);
}

body.app-body .glossary-toolbar,
body.app-body .log-toolbar {
  border-color: #dce3e3;
  box-shadow: 0 1px 2px rgb(23 35 38 / 3%);
}

body.app-body .pagination {
  min-height: 42px;
  color: #5d6b6e;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 16px;
  border: 1px solid #dce3e3;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(23 35 38 / 3%);
}

.metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 6px;
  background: #edf5f3;
  color: var(--primary);
}

.metric-card:nth-child(2) .metric-icon {
  background: #edf3fb;
  color: #2869b2;
}

.metric-card:nth-child(3) .metric-icon {
  background: #eaf7f2;
  color: #13805f;
}

.metric-card:nth-child(4) .metric-icon {
  background: #fff1ef;
  color: #b13a2e;
}

.metric-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.metric-copy span {
  overflow: hidden;
  color: #6c7a7d;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-copy strong {
  font-size: 23px;
  line-height: 1;
}

.upload-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e4e9e9;
}

.upload-panel-header h2 {
  margin: 0;
  font-size: 17px;
}

.upload-panel-header span {
  color: #718083;
  font-size: 12px;
}

.upload-file-symbol {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid #afd0c8;
  border-radius: 6px;
  background: #eef7f5;
  color: var(--primary);
}

.upload-file-symbol .ui-icon {
  width: 24px;
  height: 24px;
}

.file-format-list {
  display: flex;
  gap: 5px;
  margin-top: 4px;
}

.file-format-list b {
  padding: 2px 5px;
  border: 1px solid #d7dfdf;
  border-radius: 3px;
  background: #f7f9f9;
  color: #657477;
  font-size: 9px;
}

.dashboard-upload .upload-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.dashboard-upload .file-picker {
  align-self: stretch;
  padding: 8px 10px;
  border: 1px dashed #c6d4d2;
  border-radius: 6px;
  background: #fbfdfc;
}

.dashboard-upload .file-picker:hover,
.dashboard-upload .file-picker:focus-within {
  border-color: #8eb9b0;
  background: #f4faf8;
}

.dashboard-upload .file-picker:hover strong,
.dashboard-upload .file-picker:focus-within strong {
  color: var(--primary-dark);
}

.start-translation-button {
  gap: 8px;
}

.start-translation-button .ui-icon {
  width: 17px;
  height: 17px;
}

.job-id {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-upload .upload-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 900px) {
  body.app-body.sidebar-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width) - 12px);
    width: var(--sidebar-width);
    box-shadow: 14px 0 36px rgb(22 39 42 / 18%);
    transition: left .2s ease;
  }

  .app-shell.is-sidebar-open .app-sidebar {
    left: 0;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    visibility: hidden;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgb(17 32 35 / 38%);
    opacity: 0;
    transition: opacity .2s ease, visibility .2s ease;
  }

  .app-shell.is-sidebar-open .sidebar-backdrop {
    visibility: visible;
    opacity: 1;
  }

  .app-topbar {
    height: 60px;
    padding: 0 20px;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  body.app-body .page {
    padding: 24px 20px 50px;
  }
}

@media (max-width: 640px) {
  body.app-body .alert.alert-toast {
    top: 72px;
    right: 14px;
    left: 14px;
    width: auto;
  }

  .app-topbar {
    padding: 0 14px;
  }

  .service-state,
  .topbar-account {
    display: none;
  }

  body.app-body .page {
    padding: 20px 14px 44px;
  }

  body.app-body .page-heading {
    margin-bottom: 18px;
  }

  body.app-body .page-heading h1 {
    font-size: 23px;
  }

  .api-state-chip {
    align-self: flex-start;
  }

  .dashboard-stats {
    gap: 10px;
  }

  .metric-card {
    grid-template-columns: 36px minmax(0, 1fr);
    min-height: 76px;
    gap: 9px;
    padding: 12px;
  }

  .metric-icon {
    width: 36px;
    height: 36px;
  }

  .metric-copy strong {
    font-size: 20px;
  }

  .upload-panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .dashboard-upload .upload-form {
    grid-template-columns: 1fr;
  }

  body.app-body .search-form {
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar,
  .sidebar-backdrop,
  body.app-body .button,
  body.app-body button {
    transition: none;
  }

  body.app-body .alert.alert-toast {
    animation: none;
  }
}
