:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f4f6f8;
  color: #172033;
}

body {
  margin: 0;
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}

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

.topbar p {
  margin-bottom: 0;
  color: #5f6b7a;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
}

h2 {
  font-size: 20px;
}

h3 {
  margin-bottom: 8px;
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  background: #fff;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-heading h2 {
  margin: 0;
}

.primary-panel {
  border-color: #9fca8c;
}

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

.inline-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr)) auto auto;
  gap: 12px;
  align-items: center;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.check input {
  width: auto;
}

.check-line {
  align-self: end;
  min-height: 37px;
}

.compact-check {
  margin: 0;
  white-space: nowrap;
}

.muted {
  color: #6b7480;
  font-size: 14px;
}

.log-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}

.log-mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid #cad3df;
  border-radius: 999px;
  background: #f6f8fb;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.technical-log-active {
  border-color: #8a6d3b;
  background: #fffdf7;
}

.technical-log-active .log-mode-badge {
  border-color: #b98b28;
  background: #fff3cd;
  color: #5c4200;
}

.technical-log-active #daily-log {
  background: #1f2933;
  color: #f7fafc;
  padding: 10px;
  border-radius: 6px;
}

.login {
  max-width: 420px;
  margin: 10vh auto;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

input {
  box-sizing: border-box;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #bac3d3;
  border-radius: 6px;
}

button {
  border: 0;
  border-radius: 6px;
  background: #1f6feb;
  color: white;
  padding: 9px 14px;
  cursor: pointer;
}

button.secondary {
  background: #526070;
}

button.danger {
  background: #b42318;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.notice-panel {
  border-color: #98c379;
  background: #f5fbf2;
  margin-bottom: 16px;
}

.notice-panel p {
  margin: 0;
}

.maintenance-panel {
  margin-top: 16px;
}

.maintenance-panel summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style-position: inside;
}

.maintenance-panel summary strong {
  font-size: 18px;
}

.maintenance-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.maintenance-action {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #e3e7ef;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fbfcfe;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e3e7ef;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

pre {
  box-sizing: border-box;
  width: 100%;
  white-space: pre-wrap;
  overflow: auto;
  overflow-y: auto;
  max-height: 360px;
  margin: 0;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.4;
}

#daily-log {
  box-sizing: border-box;
  height: 420px;
  max-height: 420px;
  min-height: 260px;
  overscroll-behavior: contain;
}

#last-telegram-message {
  height: 360px;
  max-height: 360px;
  min-height: 220px;
  overscroll-behavior: contain;
}

.history-scroll {
  box-sizing: border-box;
  width: 100%;
  max-height: 420px;
  overflow: auto;
  overflow-y: auto;
  border: 1px solid #e3e7ef;
  border-radius: 6px;
  overscroll-behavior: contain;
}

.history-scroll table {
  min-width: 760px;
}

.history-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

.history-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.ok {
  color: #0b7a35;
}

.warn,
.error {
  color: #b42318;
}

@media (max-width: 860px) {
  .grid.two,
  .topbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .form-row,
  .inline-form,
  .maintenance-action {
    grid-template-columns: 1fr;
  }

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

  .compact-check {
    white-space: normal;
  }

  .log-status-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
