:root {
  --page-bg: #e9edf4;
  --page-line: #a8b8cb;
  --page-shadow: rgba(44, 67, 96, 0.15);
  --panel-bg: #ffffff;
  --panel-border: #aab8ca;
  --text: #2d3b4e;
  --muted: #6d7d91;
  --blue-1: #5f84b2;
  --blue-2: #42658f;
  --blue-3: #eff4fa;
  --orange-1: #f3b05d;
  --orange-2: #df8f2b;
  --orange-3: #fff2de;
  --green-1: #8db263;
  --red-1: #bb6d5e;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #dbe5f1 0, #edf2f8 140px, #e9edf4 140px, #e9edf4 100%);
  color: var(--text);
  font: 14px/1.45 Tahoma, Verdana, Arial, sans-serif;
}

a {
  color: #245e9b;
}

.page-shell {
  width: min(1000px, calc(100% - 18px));
  margin: 0 auto;
  padding: 10px 0 30px;
}

.portal-topbar {
  border: 1px solid #58789f;
  background: linear-gradient(180deg, #7ea0c6 0, #58789f 100%);
  box-shadow: 0 1px 0 #ffffff inset;
}

.portal-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 0 12px;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-topbar-title {
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05));
  color: #fff;
  text-decoration: none;
  font-size: 12px;
}

.masthead,
.panel-card,
.summary-card,
.status-card,
.table-panel,
.modal-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 1px 4px var(--page-shadow);
}

.masthead {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  margin-top: 10px;
  padding: 16px;
  background:
    linear-gradient(180deg, #ffffff 0, #f7f9fc 100%);
}

.masthead-main {
  padding-right: 8px;
}

.masthead-label,
.eyebrow,
.panel-tag {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid #d59a46;
  background: linear-gradient(180deg, #ffd18f 0, #efab4b 100%);
  color: #77450c;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.masthead h1,
.hero-card h1 {
  margin: 10px 0 8px;
  color: #305986;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.05;
  font-family: Tahoma, Verdana, Arial, sans-serif;
}

.masthead p,
.hero-card p,
.table-head p,
.status-card p {
  margin: 0;
  color: var(--muted);
}

.masthead-side {
  display: grid;
  gap: 10px;
}

.telegram-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid #8cb7d6;
  background: linear-gradient(180deg, #f4fbff 0, #dceefb 100%);
  box-shadow: 0 1px 4px var(--page-shadow);
}

.telegram-banner strong {
  display: block;
  color: #255f8d;
  font-size: 16px;
}

.telegram-banner span {
  display: block;
  margin-top: 2px;
  color: #5d7086;
}

.telegram-banner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #2f8cc8;
  background: linear-gradient(180deg, #5bb9ef 0, #2689c5 100%);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.mini-stat {
  border: 1px solid #c8d3df;
  background: linear-gradient(180deg, #fdfefe 0, #eef4fb 100%);
  padding: 12px;
  text-align: center;
}

.mini-stat span {
  display: block;
  color: #5c7089;
  font-size: 12px;
}

.mini-stat strong {
  display: block;
  margin-top: 6px;
  color: #d17c0c;
  font-size: 26px;
  line-height: 1;
}

.flash-message {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #d7c198;
  background: linear-gradient(180deg, #fff9ef 0, #f9ecd4 100%);
  color: #79541d;
}

.flash-message.error {
  border-color: #d1ab9d;
  background: linear-gradient(180deg, #fff6f3 0, #f8e0d8 100%);
  color: #904838;
}

.flash-message.success {
  border-color: #bfcfa6;
  background: linear-gradient(180deg, #f8fcf1 0, #eaf3da 100%);
  color: #5f7441;
}

.content-grid,
.summary-grid,
.status-grid {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.content-grid {
  grid-template-columns: 1fr 1fr;
}

.summary-grid {
  grid-template-columns: repeat(3, 1fr);
}

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

.panel-card,
.summary-card,
.status-card,
.table-panel {
  padding: 0;
}

.classic-head,
.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid #7f9fc1;
  background: linear-gradient(180deg, #7ea0c6 0, #5e82af 100%);
  color: #fff;
}

.panel-head-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.classic-head h2,
.table-head h2 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  line-height: 1.1;
}

.panel-subtitle {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
}

.counter-badge {
  min-width: 94px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.soft-tag {
  border-color: rgba(255, 255, 255, 0.38);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
  color: #fff4dd;
}

.content-box {
  min-height: 260px;
  margin: 12px;
  padding: 14px;
  border: 1px solid #d1dbe6;
  background: #fcfdff;
}

.link-box {
  display: flex;
  align-items: center;
}

.text-content,
.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
  color: #384a60;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.link-pill {
  display: inline-block;
  padding: 10px 12px;
  border: 1px solid #bfd1e4;
  background: linear-gradient(180deg, #fafdff 0, #edf4fb 100%);
  color: #245e9b;
  text-decoration: none;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 12px;
}

.action-btn,
.icon-btn {
  border: 1px solid #9f7b45;
  background: linear-gradient(180deg, #ffd291 0, #eca94e 100%);
  color: #6f430f;
  cursor: pointer;
  font: 700 12px/1.2 Tahoma, Verdana, Arial, sans-serif;
}

.action-btn {
  min-height: 34px;
  padding: 0 12px;
}

.action-btn.secondary {
  border-color: #7086a6;
  background: linear-gradient(180deg, #dce8f4 0, #a9bfd7 100%);
  color: #34597d;
}

.action-btn.ghost {
  border-color: #b6c3d2;
  background: linear-gradient(180deg, #ffffff 0, #edf3f9 100%);
  color: #445d79;
}

.action-btn.danger {
  border-color: #ab7566;
  background: linear-gradient(180deg, #f6d0c3 0, #dd9f8d 100%);
  color: #7e3e2e;
}

.action-btn:hover,
.icon-btn:hover {
  filter: brightness(1.02);
}

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  filter: none;
}

.modal {
  width: min(620px, calc(100% - 20px));
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(45, 59, 78, 0.4);
}

.modal-card {
  padding: 0;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #7f9fc1;
  background: linear-gradient(180deg, #7ea0c6 0, #5e82af 100%);
  color: #fff;
}

.modal-head h2 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-color: rgba(255, 255, 255, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.06));
  color: #fff;
}

.reason-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.reason-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d6dee7;
  background: #fbfdff;
}

.textarea-wrap {
  display: block;
  padding: 0 12px 12px;
}

.textarea-wrap span {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  color: #4d6581;
}

textarea {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid #c7d3df;
  background: #fff;
  color: var(--text);
  resize: vertical;
  font: 13px/1.45 Tahoma, Verdana, Arial, sans-serif;
}

.modal-actions {
  padding-bottom: 12px;
}

.hero-card.compact {
  margin-top: 10px;
  padding: 14px;
}

.summary-card,
.status-card {
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0, #f5f8fc 100%);
}

.summary-card span,
.status-card small {
  color: var(--muted);
}

.summary-card strong {
  display: block;
  margin: 6px 0;
  color: #d17c0c;
  font-size: 30px;
}

.table-panel {
  margin-top: 10px;
}

.table-wrap {
  overflow-x: auto;
  padding: 0 12px 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

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

th {
  background: #edf3fa;
  color: #48688c;
  font-weight: 700;
}

td {
  color: #36485e;
}

.toolbar-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.toolbar-strip.bottom {
  border-top: 1px solid #d1dbe6;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-note {
  color: var(--muted);
  font-size: 12px;
}

.filter-input,
.compact-select {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #c7d3df;
  background: #fff;
  color: var(--text);
  font: 13px/1.45 Tahoma, Verdana, Arial, sans-serif;
}

.filter-input {
  width: min(420px, 100%);
}

.compact-select {
  min-width: 170px;
}

.mono-cell {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.table-badge {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid #cdd8e4;
  background: #f5f8fc;
  color: #48688c;
  font-size: 12px;
}

.row-general td {
  background: #fff9ef;
}

.row-manual td {
  background: #f3f8ec;
}

.auth-shell {
  max-width: 520px;
  padding-top: 32px;
}

.auth-card {
  margin-top: 12px;
  padding: 0;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 1px 4px var(--page-shadow);
}

.auth-card-head {
  padding: 18px 18px 8px;
}

.auth-card-head h1 {
  margin: 0 0 8px;
  color: #305986;
  font-size: 28px;
}

.auth-card-head p {
  margin: 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field span {
  font-weight: 700;
  color: #4d6581;
}

.auth-field input {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #c7d3df;
  background: #fff;
  color: var(--text);
  font: 14px/1.45 Tahoma, Verdana, Arial, sans-serif;
}

.public-offer-shell {
  width: min(920px, calc(100% - 18px));
  padding-top: 14px;
}

.public-hero {
  padding: 18px;
  border: 1px solid #8fb0c8;
  background: linear-gradient(180deg, #ffffff 0, #eef7fb 100%);
  box-shadow: 0 1px 4px var(--page-shadow);
}

.public-hero h1 {
  margin: 0 0 12px;
  color: #255f8d;
  font-size: 34px;
  line-height: 1.08;
}

.public-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.public-language-switcher {
  display: grid;
  gap: 5px;
  min-width: 170px;
}

.public-language-switcher span {
  color: #5e7489;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.public-language-switcher select {
  min-height: 36px;
  padding: 6px 34px 6px 10px;
  border: 1px solid #bfd1e4;
  background: #fff;
  color: #48688c;
  font: 700 13px/1.2 Tahoma, Verdana, Arial, sans-serif;
}

.public-language-switcher select:focus {
  outline: 2px solid rgba(47, 140, 200, 0.25);
  outline-offset: 1px;
}

.public-language-switcher select option {
  color: #2d3b4e;
  font-weight: 700;
}

.public-hero p {
  max-width: 760px;
  margin: 12px 0 0;
  color: #485d72;
  font-size: 16px;
}

.public-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.public-steps div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid #bfd1e4;
  background: #fff;
}

.public-steps strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: #2f8cc8;
  color: #fff;
  font-size: 18px;
}

.public-steps span {
  color: #2d3b4e;
  font-weight: 700;
}

.public-offer-grid {
  align-items: stretch;
}

.public-panel {
  border-color: #9eb6c9;
}

.public-panel-head {
  background: #5e82af;
}

.public-panel-head h2 {
  font-size: 20px;
}

.public-post-box,
.public-link-box {
  min-height: 320px;
  background: #fff;
}

.public-link-box {
  justify-content: center;
}

.public-link-card {
  width: 100%;
  text-align: center;
}

.public-open-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  width: 100%;
  padding: 0 18px;
  border: 1px solid #177fb4;
  background: linear-gradient(180deg, #54c2ef 0, #168bc4 100%);
  color: #fff;
  text-decoration: none;
  font-size: 22px;
  font-weight: 700;
}

.public-link-url {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #d1dbe6;
  background: #f7fafc;
  color: #50657d;
  word-break: break-word;
}

.public-actions .action-btn {
  min-height: 42px;
  font-size: 14px;
}

.public-actions .public-copy-btn {
  width: 100%;
  border-color: #a7bd88;
  background: linear-gradient(180deg, #f6fbef 0, #d7e9c5 100%);
  color: #4d6f35;
}

.public-actions .public-primary {
  flex: 1 1 210px;
  border-color: #a66e23;
  background: linear-gradient(180deg, #ffd89b 0, #e99c36 100%);
}

.public-replace-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #d7c198;
  background: linear-gradient(180deg, #fffaf0 0, #f8ead0 100%);
  box-shadow: 0 1px 4px var(--page-shadow);
  text-align: center;
}

.public-replace-btn {
  width: min(420px, 100%);
  min-height: 48px;
  font-size: 16px;
}

.public-replace-panel p {
  margin: 10px 0 0;
  color: #6b5639;
}

@media (max-width: 860px) {
  .masthead,
  .content-grid,
  .summary-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .portal-topbar-inner,
  .classic-head,
  .telegram-banner,
  .table-head,
  .hero-card.compact {
    flex-direction: column;
    align-items: flex-start;
  }

  .counter-badge,
  .action-btn,
  .ghost-link,
  .telegram-banner-btn {
    width: 100%;
  }

  .panel-head-meta {
    width: 100%;
    align-items: flex-start;
  }

  .toolbar-strip,
  .toolbar-actions,
  .topbar-links {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .filter-input,
  .compact-select {
    width: 100%;
  }

  .public-hero h1 {
    font-size: 28px;
  }

  .public-hero-top {
    flex-direction: column;
  }

  .public-language-switcher {
    width: 100%;
  }

  .public-language-switcher span {
    text-align: left;
  }

  .public-language-switcher select {
    width: 100%;
  }

  .public-steps {
    grid-template-columns: 1fr;
  }

  .public-post-box,
  .public-link-box {
    min-height: auto;
  }

  .public-open-link {
    min-height: 60px;
    font-size: 18px;
  }
}
