* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #172033;
  font-family: Arial, sans-serif;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d9e1ef;
  display: flex;
  justify-content: space-between;
  padding: 14px 24px;
}

.brand {
  color: #172033;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 16px;
}

nav a,
.button-link {
  color: #1f5fbf;
  text-decoration: none;
}

.page {
  padding: 24px;
}

.panel-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1,
h2 {
  margin: 0 0 8px;
}

p {
  margin: 0;
}

.layout {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(760px, 1fr) minmax(360px, 420px);
  margin-bottom: 20px;
}

.card {
  background: #ffffff;
  border: 1px solid #d9e1ef;
  border-radius: 8px;
  min-width: 0;
  padding: 18px;
}

.form-card {
  max-width: 420px;
  min-width: 0;
  width: 100%;
}

.page > .card {
  margin-top: 20px;
}

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

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

.search-form {
  align-items: center;
  display: flex;
  gap: 8px;
  width: min(520px, 100%);
}

.logs-filter-form {
  align-items: end;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.logs-filter-form input[type="hidden"] {
  display: none;
}

.logs-filter-form label {
  min-width: 160px;
}

.search-form input[type="hidden"] {
  display: none;
}

.search-form input[name="feed_q"] {
  min-width: 220px;
}

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

th {
  color: #556276;
  font-size: 13px;
}

.url {
  max-width: 320px;
  overflow-wrap: anywhere;
}

.actions,
.inline,
.feed-actions-main {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feeds-table {
  width: 100%;
}

.tabs {
  border-bottom: 1px solid #d9e1ef;
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
}

.tab {
  border-bottom: 3px solid transparent;
  color: #556276;
  padding: 8px 10px;
  text-decoration: none;
}

.tab.active {
  border-bottom-color: #1f5fbf;
  color: #172033;
  font-weight: 700;
}

.feeds-header,
.feed-row {
  display: grid;
  gap: 20px;
  grid-template-columns: 48px minmax(110px, 0.8fr) minmax(120px, 0.8fr) minmax(240px, 1.8fr) minmax(120px, 0.7fr) minmax(130px, 0.8fr);
}

.feeds-header > *,
.feed-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.feeds-header {
  color: #556276;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 10px 12px;
}

.feeds-list {
  display: grid;
  gap: 12px;
}

.feed-card {
  background: #ffffff;
  border: 1px solid #dfe7f3;
  border-radius: 8px;
  overflow: hidden;
}

.feed-row {
  padding: 18px 14px 16px;
}

.feeds-empty {
  border: 1px solid #dfe7f3;
  border-radius: 8px;
  padding: 18px 14px;
}

.feed-actions {
  align-items: center;
  background: #fbfdff;
  border-top: 1px solid #edf2f8;
  display: grid;
  gap: 20px;
  grid-template-columns: 48px minmax(110px, 0.8fr) minmax(120px, 0.8fr) minmax(240px, 1.8fr) minmax(120px, 0.7fr) minmax(130px, 0.8fr);
  padding: 12px 14px 18px;
  width: 100%;
}

.feed-actions-main {
  grid-column: 1 / 5;
  justify-content: flex-start;
}

.feed-actions-edit {
  grid-column: 6;
  justify-self: end;
  white-space: nowrap;
}

.feed-number {
  color: #6a778b;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.feed-number {
  width: 56px;
}

.source-link {
  color: #1f5fbf;
  overflow-wrap: anywhere;
  text-decoration: none;
  word-break: break-word;
}

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

.pagination {
  align-items: center;
  border-top: 1px solid #e7edf6;
  display: flex;
  gap: 10px;
  margin-top: 26px;
  padding-top: 18px;
}

.pagination-link {
  align-items: center;
  background: #ffffff;
  border: 1px solid #c7d2e3;
  border-radius: 6px;
  color: #1f5fbf;
  display: inline-flex;
  font-size: 16px;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  line-height: 1;
  min-width: 34px;
  text-decoration: none;
}

.pagination a.pagination-link {
  cursor: pointer;
}

.pagination a.pagination-link:hover,
.pagination a.pagination-link:focus {
  background: #e8f0ff;
  border-color: #1f5fbf;
  outline: none;
}

.pagination-link.disabled {
  background: #f5f7fb;
  color: #9aa6b8;
  cursor: default;
}

.pagination-label {
  color: #6a778b;
  font-size: 13px;
  padding: 0 4px;
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  color: #46546a;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

input,
select,
textarea {
  border: 1px solid #c7d2e3;
  border-radius: 6px;
  color: #172033;
  font: inherit;
  min-width: 0;
  padding: 9px 10px;
  width: 100%;
}

select.readonly-select:disabled {
  appearance: none;
  background: #eef2f7;
  color: #556276;
  cursor: default;
}

textarea {
  max-width: 100%;
  min-height: 76px;
  resize: vertical;
}

button {
  background: #1f5fbf;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  padding: 9px 12px;
}

button.danger {
  background: #c5393a;
}

button.success {
  background: #1d8f45;
}

.error {
  background: #fff1f1;
  border: 1px solid #f0b8b8;
  border-radius: 6px;
  color: #9c2424;
  margin-bottom: 16px;
  padding: 10px 12px;
}

.error.compact {
  display: inline-block;
  font-size: 12px;
  margin: 6px 0 0;
  padding: 5px 7px;
}

.muted {
  color: #6a778b;
  font-size: 12px;
}

label.checkbox {
  align-items: center;
  display: flex;
  gap: 8px;
}

label.checkbox input {
  width: auto;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
}

.status.queued,
.status.running {
  background: #fff5d8;
  color: #7a5400;
}

.status.success {
  background: #e4f7ea;
  color: #1d6b36;
}

.status.failed {
  background: #ffe6e6;
  color: #9c2424;
}

.status.info {
  background: #e8f0ff;
  color: #1f5fbf;
}

.status.warning {
  background: #fff5d8;
  color: #7a5400;
}

.status.error,
.status.critical {
  background: #ffe6e6;
  color: #9c2424;
}

.login-body {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
}

.login-form {
  background: #ffffff;
  border: 1px solid #d9e1ef;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 28px;
  width: min(380px, calc(100vw - 32px));
}

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

  .panel-header {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .section-header,
  .search-form {
    align-items: stretch;
    flex-direction: column;
  }

  .search-form {
    width: 100%;
  }

  .card.wide {
    overflow-x: auto;
  }
}
