* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

.auth-pending .app {
  visibility: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #eef1f5;
}

.auth-panel {
  width: min(400px, 100%);
  padding: 26px;
  border: 1px solid #d5dbe5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(31, 42, 55, 0.14);
}

.auth-brand {
  color: #1677ff;
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 14px;
}

.auth-panel h1,
.admin-modal h2 {
  margin: 0;
  color: #202124;
  font-size: 20px;
  line-height: 1.25;
}

.auth-panel > p,
.modal-heading p {
  margin: 7px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 13px;
  margin-top: 20px;
}

.auth-form button {
  width: 100%;
  margin-top: 3px;
}

.auth-message {
  min-height: 18px;
  margin: 12px 0 0;
  color: #c5221f;
  font-size: 12px;
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(26, 32, 44, 0.4);
}

.admin-modal {
  width: min(820px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid #d5dbe5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(31, 42, 55, 0.2);
}

.modal-heading,
.status-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-heading > button {
  width: 30px;
  padding: 0;
  font-size: 20px;
}

.admin-create-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.2fr) 120px auto;
  align-items: end;
  gap: 10px;
  margin-top: 18px;
}

.admin-create-row select {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.admin-user-table {
  min-height: 240px;
  margin-top: 4px;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.user-controls > span {
  max-width: 90px;
  overflow: hidden;
  color: #5f6672;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.compact-button {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
}

body {
  margin: 0;
  background: #eef1f5;
  color: #202124;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", sans-serif;
  letter-spacing: 0;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app {
  height: 100vh;
  padding: 12px;
  display: grid;
  grid-template-columns: 218px minmax(580px, 1fr) 292px;
  gap: 12px;
  overflow: hidden;
}

.rail,
.workspace,
.status {
  background: #fff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(31, 42, 55, 0.05);
  min-height: 0;
  height: 100%;
}

.rail {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 2px 4px 15px;
  border-bottom: 1px solid #e8ebf0;
  margin-bottom: 12px;
}

.brand h1,
.workspace h2,
.status h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 750;
}

.brand p,
.top p,
.safe-note,
.template-line,
.inline-hint {
  margin: 5px 0 0;
  color: #6e6e73;
  font-size: 11px;
  line-height: 1.45;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.platform {
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  column-gap: 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.platform:hover {
  background: #f5f7fa;
  border-color: #e4e8ee;
}

.platform:disabled {
  cursor: default;
  opacity: 0.55;
}

.platform.active {
  background: #edf5ff;
  border-color: #a9cdfd;
  color: #0b57a3;
}

.platform.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #1677ff;
}

.platform > span:last-child {
  min-width: 0;
}

.platform b {
  display: block;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 720;
}

.platform small {
  display: block;
  color: #737a86;
  font-size: 11px;
  line-height: 1.25;
  margin-top: 2px;
}

.icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}

.green {
  background: #30d158;
}

.blue {
  background: #007aff;
}

.indigo {
  background: #5856d6;
}

.teal {
  background: #00a78e;
}

.rose {
  background: #d6336c;
}

.safe-note {
  margin-top: auto;
  padding: 14px 4px 0;
  border-top: 1px solid #e8ebf0;
}

.workspace {
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8ebf0;
  margin-bottom: 14px;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented {
  height: 30px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid #d8d8dd;
  background: #f4f4f6;
  display: inline-flex;
  align-items: center;
}

.segmented label {
  height: 24px;
  min-width: 64px;
  padding: 0 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6e6e73;
  font-size: 12px;
  cursor: pointer;
}

.segmented label:last-child {
  min-width: 72px;
}

.segmented label.selected {
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-weight: 650;
}

.segmented input {
  display: none;
}

.pill {
  height: 30px;
  border: 1px solid #d8d8dd;
  border-radius: 8px;
  padding: 0 10px;
  color: #424245;
  background: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 230px;
  overflow: auto;
  padding-right: 2px;
}

.hidden {
  display: none !important;
}

.form-section {
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #f9fafc;
  padding: 14px;
}

.section-title {
  font-size: 12px;
  font-weight: 750;
  color: #1d1d1f;
  margin-bottom: 9px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.form-grid.compact {
  grid-template-columns: 180px minmax(220px, 1fr);
}

.form-grid.reset-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

label {
  color: #424245;
  font-size: 11px;
}

input {
  display: block;
  width: 100%;
  height: 30px;
  margin-top: 4px;
  border: 1px solid #c8ced8;
  border-radius: 7px;
  background: #fff;
  padding: 0 9px;
  color: #1d1d1f;
  outline: none;
}

input:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.12);
}

.actions,
.batch-toolbar,
.daily-toolbar {
  padding-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.daily-toolbar {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.daily-toolbar label:not(.check):not(.file-button) {
  min-width: 90px;
}

.daily-toolbar input[type="time"] {
  width: 112px;
}

.daily-toolbar select {
  display: block;
  margin-top: 4px;
  min-width: 78px;
}

.daily-table-wrap {
  min-height: 210px;
}

.daily-table-wrap td:last-child {
  white-space: normal;
  min-width: 220px;
}

.reset-table-wrap {
  min-height: 220px;
}

.reset-table-wrap td:last-child {
  min-width: 240px;
  white-space: normal;
}

button,
.file-button,
select {
  height: 31px;
  border: 1px solid #ccd2dc;
  border-radius: 7px;
  background: #fff;
  color: #1d1d1f;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
}

.speed-select {
  height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #424245;
  font-size: 12px;
  white-space: nowrap;
}

.speed-select select {
  width: 68px;
  padding: 0 6px;
}

button:hover,
.file-button:hover {
  background: #f4f6f9;
}

button.primary {
  background: #007aff;
  color: white;
  border-color: #007aff;
  font-weight: 700;
}

button.primary:hover {
  background: #087eff;
}

button.danger {
  background: #d70015;
  color: white;
  border-color: #d70015;
  font-weight: 700;
}

button.danger:hover {
  background: #e3162a;
}

.check {
  height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #424245;
  font-size: 12px;
}

.check input {
  width: 15px;
  height: 15px;
  margin: 0;
}

.file-button input {
  display: none;
}

.template-line {
  padding: 8px 10px;
  background: #fbfbfd;
  border: 1px solid #e3e3e8;
  border-radius: 8px;
}

.feedback-section {
  margin-top: 10px;
  border-top: 1px solid #ececf0;
  padding-top: 10px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
}

.feedback-wrap {
  min-height: 120px;
  flex: 1 1 auto;
}

.feedback-wrap td:last-child {
  white-space: normal;
  min-width: 240px;
}

.table-wrap {
  border: 1px solid #d9dee7;
  border-radius: 8px;
  overflow: auto;
  min-height: 260px;
  flex: 1;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  border-bottom: 1px solid #eeeeef;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #5e6673;
  background: #f3f5f8;
  font-size: 11px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.status {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-card {
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #f9fafc;
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.status-card span {
  color: #007aff;
}

pre {
  margin: 0;
  flex: 1;
  min-height: 0;
  border: 1px solid #e3e3e8;
  border-radius: 8px;
  background: #fff;
  padding: 11px;
  color: #424245;
  font-size: 12px;
  line-height: 1.55;
  overflow: auto;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .rail,
  .workspace,
  .status {
    min-height: auto;
  }

  .form-grid,
  .form-grid.compact,
  .form-grid.reset-grid {
    grid-template-columns: 1fr;
  }

  .top,
  .top-controls {
    flex-direction: column;
  }

  .admin-create-row {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: start;
    padding: 12px;
  }
}
