:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242a;
  --muted: #657080;
  --border: #d9dee7;
  --primary: #1867c0;
  --primary-dark: #0f4f96;
  --danger: #b42318;
  --ok: #137333;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  height: 56px;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.nav {
  align-items: center;
  display: flex;
  gap: 12px;
}

.container {
  margin: 0 auto;
  max-width: 1280px;
  padding: 24px;
}

.layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(360px, 480px) 1fr;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}

.panel h1,
.panel h2 {
  margin: 0 0 16px;
}

.panel h1 {
  font-size: 22px;
}

.panel h2 {
  font-size: 17px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #394150;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

button {
  align-items: center;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 650;
  gap: 6px;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
}

button.secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

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

.status {
  border-radius: 6px;
  margin-top: 12px;
  padding: 10px 12px;
}

.status.ok {
  background: #e8f5e9;
  color: var(--ok);
}

.status.error {
  background: #fef3f2;
  color: var(--danger);
}

.toast {
  background: #101828;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.22);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  max-width: 360px;
  padding: 10px 12px;
  position: fixed;
  right: 20px;
  top: 70px;
  z-index: 20;
}

.toast.error {
  background: #7f1d1d;
}

.admin-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(620px, 1.2fr) minmax(480px, 0.8fr);
  max-width: 1480px;
}

.admin-panel {
  padding: 16px;
}

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

.panel-title h1,
.panel-title h2 {
  font-size: 16px;
  margin: 0;
}

.split-title {
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 14px;
}

.toolbar-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 160px) auto;
  margin-bottom: 12px;
}

.option-toolbar {
  grid-template-columns: minmax(140px, 170px) minmax(120px, 1fr) minmax(120px, 1fr) auto;
}

.toolbar-form input,
.toolbar-form select,
.admin-table input,
.admin-table select {
  font-size: 13px;
  min-height: 32px;
  padding: 5px 8px;
}

.soft-button {
  background: #eef4ff;
  border-color: #c7d7fe;
  color: #1849a9;
  font-size: 13px;
  min-height: 32px;
  padding: 5px 10px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  font-size: 12px;
}

.admin-table th,
.admin-table td {
  padding: 6px 7px;
}

.admin-table th {
  top: 56px;
}

.admin-table input[type="checkbox"] {
  min-height: 0;
  width: auto;
}

.icon-actions {
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}

.icon-button {
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  color: #344054;
  font-size: 13px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  width: 28px;
}

.icon-button:hover {
  background: #f9fafb;
}

.icon-button.danger {
  background: #fff;
  border-color: #fecaca;
  color: #991b1b;
}

.icon-button.success {
  border-color: #bbf7d0;
  color: #166534;
}

.archive-box {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 10px;
}

.archive-box summary {
  color: #344054;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 8px;
}

.status.compact {
  font-size: 12px;
  margin: 8px 0;
  padding: 7px 9px;
}

.filters {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-bottom: 14px;
}

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

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f9fafb;
  color: #344054;
  font-weight: 700;
  position: sticky;
  top: 56px;
  z-index: 1;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login .panel {
  width: min(420px, calc(100vw - 32px));
}

.plugin-body {
  background: #fff;
}

.plugin-body .container {
  padding: 14px;
}

.plugin-body .panel {
  border: 0;
  padding: 0;
}

@media (max-width: 960px) {
  .layout,
  .admin-layout,
  .grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    height: auto;
    padding: 14px 16px;
  }
}
