:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(35, 91, 166, 0.08), transparent 260px),
    #f5f7fb;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.appShell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px 16px;
  color: #e9eef8;
  background: #162238;
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brandMark,
.loginMark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #2a8f7a;
  color: #ffffff;
}

.brand h1,
.topbar h2,
.panel h3,
.loginPanel h1 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand span {
  display: block;
  overflow: hidden;
  color: #aab6ca;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.navItem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #d6dfef;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.navItem:hover,
.navItem.active {
  background: #253650;
  color: #ffffff;
}

.logout {
  margin-top: auto;
}

.workspace {
  width: 100%;
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar p,
.panelHeader p {
  margin: 0 0 4px;
  color: #64708a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: 24px;
}

.userPill {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #d9deea;
  border-radius: 8px;
  background: #ffffff;
  color: #43506a;
}

.userPill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewStack {
  display: grid;
  gap: 18px;
}

.metricsGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.panel,
.loginPanel {
  border: 1px solid #dde3ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(23, 32, 51, 0.06);
}

.metric {
  min-height: 112px;
  padding: 18px;
  border-left-width: 5px;
}

.metric span {
  display: block;
  margin-bottom: 12px;
  color: #64708a;
  font-size: 13px;
}

.metric strong {
  font-size: 30px;
}

.metric.green { border-left-color: #2a8f7a; }
.metric.blue { border-left-color: #2f6fb5; }
.metric.amber { border-left-color: #c9892b; }
.metric.violet { border-left-color: #7c5cc4; }

.splitGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.wideLeft {
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.15fr);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panelHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 19px;
}

.formGrid {
  display: grid;
  gap: 14px;
  max-width: 760px;
}

.field {
  display: grid;
  gap: 7px;
  color: #43506a;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.loginPanel input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd7e5;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: #172033;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.checkLine {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #43506a;
  font-weight: 700;
}

.toolbar,
.buttonRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.primaryButton,
.secondaryButton,
.dangerButton,
.iconButton,
.textButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.primaryButton,
.secondaryButton,
.dangerButton {
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primaryButton {
  color: #ffffff;
  background: #256f61;
}

.primaryButton:hover {
  background: #1f5f53;
}

.secondaryButton {
  color: #24304a;
  border-color: #cfd7e5;
  background: #ffffff;
}

.dangerButton {
  color: #9a3412;
  border-color: #ffd0bd;
  background: #fff4ef;
}

.fit {
  width: fit-content;
}

.primaryButton:disabled,
.secondaryButton:disabled,
.dangerButton:disabled,
.iconButton:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.rowsList,
.progressList {
  display: grid;
  gap: 8px;
}

.rowButton {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #dfe5f0;
  border-radius: 8px;
  background: #ffffff;
  color: #24304a;
  cursor: pointer;
  text-align: left;
}

.rowButton span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rowButton strong {
  color: #2f6fb5;
  text-align: right;
}

.rowButton.active {
  border-color: #2a8f7a;
  background: #eefaf7;
}

.uploadBox {
  display: grid;
  gap: 16px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  border: 2px dashed #b8c5d8;
  border-radius: 8px;
  background: #f9fbff;
  color: #43506a;
  cursor: pointer;
}

.dropzone input {
  display: none;
}

.dropzone strong {
  max-width: 90%;
  overflow-wrap: anywhere;
  color: #172033;
}

.tableWrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #64708a;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #25304a;
}

.iconButton {
  width: 38px;
  height: 38px;
  border: 1px solid #cfd7e5;
  background: #ffffff;
  color: #24304a;
}

.textButton {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2f6fb5;
  font-weight: 700;
}

.statusBadge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: #24304a;
  background: #edf1f7;
  font-size: 12px;
  font-weight: 700;
}

.statusBadge.done {
  color: #17614f;
  background: #e2f7f1;
}

.statusBadge.error {
  color: #9a3412;
  background: #fff1eb;
}

.statusBadge.processing {
  color: #7a5200;
  background: #fff4cc;
}

.progressRow {
  display: grid;
  gap: 8px;
}

.progressRow > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progressRow strong,
.progressRow span {
  overflow-wrap: anywhere;
}

.progressRow span {
  color: #64708a;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf6;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2a8f7a, #2f6fb5);
}

.notice,
.emptyState,
.loading {
  border-radius: 8px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #cfd7e5;
  background: #ffffff;
}

.notice.ok {
  color: #17614f;
  border-color: #bdebdc;
  background: #effbf7;
}

.notice.error {
  color: #9a3412;
  border-color: #ffc7b2;
  background: #fff4ef;
}

.emptyState {
  min-height: 90px;
  display: grid;
  place-items: center;
  color: #64708a;
  background: #f8faff;
}

.loginPage,
.loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.loginPanel {
  display: grid;
  gap: 16px;
  width: min(100%, 420px);
  padding: 24px;
}

.loginPanel label {
  display: grid;
  gap: 7px;
  color: #43506a;
  font-weight: 700;
}

.loginPanel .primaryButton {
  width: 100%;
}

.spin {
  animation: spin 0.9s linear infinite;
}

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

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

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .navItem {
    justify-content: center;
  }

  .navItem span {
    display: none;
  }

  .logout {
    margin-top: 0;
  }

  .metricsGrid,
  .splitGrid,
  .wideLeft {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .panel {
    padding: 14px;
  }

  .topbar h2 {
    font-size: 21px;
  }
}
