:root {
  --gmx-blue: #4d7fff;
  --gmx-blue-hover: #6c96ff;
  --gmx-bg: #0b111b;
  --gmx-surface: #121a28;
  --gmx-surface-2: #1a2435;
  --gmx-border: #2a3b56;
  --gmx-text: #e8eef9;
  --gmx-muted: #a5b4ce;
  --gmx-success-bg: #183357;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Roboto", Arial, sans-serif;
  color: var(--gmx-text);
  background:
    radial-gradient(circle at top right, #14213a 0%, #0e1726 35%, #0b111b 70%),
    var(--gmx-bg);
  min-height: 100vh;
}

.entry-body {
  background: linear-gradient(180deg, #f3f6fb 0%, #e9eef9 100%);
  color: #111827;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-page {
  place-items: start center;
}

.admin-page input,
.admin-page select,
.admin-page textarea {
  background: #0f1828;
  color: #e8eef9;
  border-color: #344a6d;
}

.admin-page input::placeholder,
.admin-page textarea::placeholder {
  color: #9cb0d1;
}

.admin-page select option {
  background: #0f1828;
  color: #e8eef9;
}

.entry-page .panel {
  background: #ffffff;
  border-color: #d6deef;
  box-shadow: 0 10px 24px rgba(13, 30, 68, 0.12);
}

.entry-page .brand-text,
.entry-page h1 {
  color: #1f2b46;
}

.entry-page .subtitle {
  color: #475569;
}

.entry-page input {
  background: #ffffff;
  color: #111827;
  border-color: #c7d2e8;
}

.entry-page input::placeholder {
  color: #6b7280;
}

.panel {
  width: 100%;
  max-width: 460px;
  background: var(--gmx-surface);
  border: 1px solid var(--gmx-border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  padding: 28px;
}

.panel-wide {
  max-width: 960px;
  min-height: 760px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gmx-blue);
  display: inline-block;
}

.brand-text {
  margin: 0;
  color: var(--gmx-blue);
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.subtitle {
  margin: 10px 0 20px;
  color: var(--gmx-muted);
  font-size: 15px;
  line-height: 1.4;
}

.form-grid {
  display: grid;
  gap: 10px;
}

label {
  font-size: 14px;
  font-weight: 500;
}

input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--gmx-border);
  border-radius: 6px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--gmx-text);
  transition: border-color 0.15s ease;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--gmx-border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--gmx-text);
  font-family: inherit;
}

.input-mode-block {
  display: grid;
  gap: 10px;
}

.is-hidden {
  display: none;
}

textarea {
  max-width: 100%;
  resize: vertical;
  overflow: auto;
}

textarea[name="htmlContent"] {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1.35;
}

.file-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gmx-border);
  border-radius: 6px;
  background: #0f1828;
  color: #d8e6ff;
}

.file-input::file-selector-button {
  border: 0;
  border-radius: 6px;
  margin-right: 10px;
  padding: 8px 12px;
  background: var(--gmx-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.file-input::file-selector-button:hover {
  background: var(--gmx-blue-hover);
}

select {
  height: 44px;
}

select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gmx-blue);
  box-shadow: 0 0 0 3px rgba(28, 68, 155, 0.14);
}

input:focus {
  outline: none;
  border-color: var(--gmx-blue);
  box-shadow: 0 0 0 3px rgba(28, 68, 155, 0.14);
}

button {
  margin-top: 8px;
  height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--gmx-blue);
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

button:hover {
  background: var(--gmx-blue-hover);
}

.alert-success {
  margin: 10px 0 18px;
  background: var(--gmx-success-bg);
  border: 1px solid #2c5ea6;
  color: #dceaff;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

.alert-error {
  margin: 10px 0 18px;
  background: #4a1f2a;
  border: 1px solid #7e3344;
  color: #ffd9df;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

.inline-form {
  margin-bottom: 18px;
}

.secondary-button {
  margin-top: 0;
  height: 40px;
  background: var(--gmx-surface-2);
  color: var(--gmx-blue);
  border: 1px solid var(--gmx-blue);
}

.secondary-button:hover {
  background: #1f2e47;
}

.admin-sections {
  display: grid;
  gap: 12px;
  margin: 8px 0 18px;
}

.top-nav {
  display: flex;
  gap: 10px;
  margin: 10px 0 16px;
}

.sub-nav {
  display: flex;
  gap: 8px;
  margin: 8px 0 16px;
}

.top-nav a {
  text-decoration: none;
  border: 1px solid var(--gmx-border);
  color: var(--gmx-text);
  background: var(--gmx-surface-2);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
}

.sub-nav a {
  text-decoration: none;
  border: 1px solid var(--gmx-border);
  color: var(--gmx-text);
  background: var(--gmx-surface-2);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

.top-nav a.active {
  background: var(--gmx-blue);
  border-color: var(--gmx-blue);
  color: #fff;
}

.sub-nav a.active {
  background: #20385f;
  border-color: var(--gmx-blue);
  color: #d9e7ff;
}

.admin-section {
  border: 1px solid var(--gmx-border);
  border-radius: 8px;
  padding: 14px;
  background: var(--gmx-surface-2);
  min-height: 540px;
}

.admin-section h3 {
  margin: 18px 0 10px;
  font-size: 18px;
}

.admin-section h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--gmx-blue);
}

.admin-section p {
  margin: 0;
  color: var(--gmx-muted);
  font-size: 14px;
  line-height: 1.4;
}

.table-action-form {
  margin: 0;
  display: inline-flex;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 0;
  height: 34px;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--gmx-border);
  background: #1c2940;
  color: #d8e6ff;
}

.link-button:hover {
  background: #243652;
}

.table-action-form button {
  margin: 0;
  height: 36px;
  font-size: 13px;
  padding: 0 12px;
}

.table-actions .link-button {
  height: 36px;
}

.danger-button {
  background: #7e3344;
}

.danger-button:hover {
  background: #9b3d52;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--gmx-border);
  border-radius: 8px;
  background: #111a29;
}

.hint-text {
  margin: 0;
  font-size: 13px;
  color: var(--gmx-muted);
}

.requests-grid {
  display: grid;
  gap: 12px;
}

.requests-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid #314766;
  border-radius: 8px;
  background: #111c2f;
}

.toolbar-item {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.toolbar-item label {
  font-size: 12px;
  color: #9fb4d8;
}

.toolbar-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d8e6ff;
  font-size: 13px;
  line-height: 1.2;
  margin: 0;
  min-height: 40px;
}

.toolbar-checkbox input {
  appearance: auto;
  -webkit-appearance: checkbox;
  display: inline-block;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0 !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  vertical-align: middle;
  flex: 0 0 16px;
}

.requests-toolbar .toolbar-item select {
  height: 40px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid #4a6696;
  background-color: #0f1828;
  background-image:
    linear-gradient(45deg, transparent 50%, #9fb4d8 50%),
    linear-gradient(135deg, #9fb4d8 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.requests-toolbar .secondary-button {
  height: 40px;
  min-width: 120px;
  margin: 0;
}

.request-card {
  border: 1px solid #3a4f70;
  border-radius: 10px;
  background: #162136;
  padding: 14px;
}

.request-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.request-card-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  color: #eef4ff;
}

.request-campaign {
  margin: 4px 0 0;
  font-size: 13px;
  color: #9eb2d4;
}

.request-badge {
  background: #243a5d;
  color: #d6e5ff;
  border: 1px solid #4a6696;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.request-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.metric {
  background: #1d2b44;
  border: 1px solid #304866;
  border-radius: 8px;
  padding: 8px 10px;
}

.metric span {
  display: block;
  color: #9eb2d4;
  font-size: 12px;
  margin-bottom: 4px;
}

.metric strong {
  font-size: 14px;
  color: #ecf2ff;
}

.metric-wide {
  grid-column: span 1;
}

.request-history {
  border: 1px solid #304866;
  border-radius: 8px;
  background: #121d30;
  overflow: hidden;
}

.request-history summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #d8e7ff;
  list-style: none;
}

.request-history summary::-webkit-details-marker {
  display: none;
}

.request-history summary::after {
  content: "▾";
  float: right;
  color: #8fa8d0;
}

.request-history[open] summary::after {
  content: "▴";
}

.history-list {
  border-top: 1px solid #2a3f5d;
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.history-item {
  border: 1px solid #324b70;
  border-radius: 8px;
  background: #1a2940;
  color: #e8f0ff;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.history-top {
  font-size: 12px;
  font-weight: 700;
  color: #b8ceef;
  margin-bottom: 4px;
}

.stacked-time {
  margin-top: 6px;
  color: #9cb0d1;
  font-size: 11px;
}

.empty-history {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed #365071;
  border-radius: 8px;
  color: #a8bcdd;
  font-size: 13px;
}

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

.pager-info {
  font-size: 13px;
  color: #b3c3df;
}

.link-button.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 2px;
}

.form-actions > button,
.form-actions > .link-button,
.form-actions > .table-action-form button {
  height: 42px;
  margin: 0;
  padding: 0 16px;
  font-size: 14px;
}

.form-actions > .secondary-button {
  border-width: 1px;
}

.preview-shell {
  max-width: 1120px;
}

.preview-section {
  padding: 18px;
}

.preview-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.preview-meta-item {
  border: 1px solid #334b6f;
  border-radius: 8px;
  background: #152237;
  padding: 10px 12px;
}

.preview-meta-item span {
  display: block;
  color: #9cb0d1;
  font-size: 12px;
  margin-bottom: 4px;
}

.preview-meta-item strong {
  display: block;
  color: #eef4ff;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mail-preview {
  border: 1px solid #334b6f;
  border-radius: 10px;
  overflow: hidden;
  background: #0f1828;
}

.mail-preview-header {
  background: #1b2a42;
  color: #d8e6ff;
  font-size: 13px;
  letter-spacing: 0.01em;
  padding: 10px 12px;
  border-bottom: 1px solid #334b6f;
}

.mail-preview-body {
  background: #ffffff;
  color: #111827;
  max-height: 560px;
  overflow: auto;
  padding: 16px;
}

.mail-preview-body > * {
  max-width: 100%;
}

.mail-preview-frame {
  max-width: 900px;
  margin: 0 auto;
}

.mail-preview-frame > * {
  max-width: 100%;
}

.preview-actions {
  justify-content: flex-end;
  border-top: 1px solid #2d4262;
  padding-top: 12px;
  margin-top: 14px;
}

.preview-standalone {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 22px;
}

.preview-standalone .preview-meta-grid {
  margin-bottom: 12px;
}

.preview-standalone .mail-preview {
  border-color: #3b547d;
}

.preview-standalone .mail-preview-body {
  max-height: none;
  min-height: 380px;
}


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

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #22324d;
  font-size: 14px;
}

thead th {
  color: #d9e7ff;
  background: #1d2e4a;
}

@media (max-width: 520px) {
  .page {
    padding: 14px;
  }

  .panel {
    padding: 20px;
  }

  h1 {
    font-size: 24px;
  }

  .top-nav {
    flex-wrap: wrap;
  }

  .request-card-head {
    flex-direction: column;
  }

  .request-metrics {
    grid-template-columns: 1fr;
  }

  .requests-toolbar {
    align-items: stretch;
  }

  .preview-meta-grid {
    grid-template-columns: 1fr;
  }
}
