/* Warmer UI — visual language from website_referens (Soprano-style) */

@import url("https://fonts.googleapis.com/css2?family=Lacquer&family=Pangolin&display=swap");

* {
  padding: 0;
  margin: 0;
  border: 0;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

:focus, :active {
  outline: none;
}

html, body {
  height: 100%;
  width: 100%;
  font-size: 14px;
  line-height: 1.4;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}

body {
  font-family: "Pangolin", cursive;
  color: #fff;
  background: #171717;
  -webkit-font-smoothing: antialiased;
}

input, button, textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

ul li {
  list-style: none;
}

/* Soft global transition like reference */
button,
.nav-btn,
.header__button,
.card,
.btn,
input,
textarea {
  transition: 0.35s all ease;
}

.hidden { display: none !important; }

.muted {
  color: #999999;
  font-size: 14px;
  line-height: 1.5;
}

.error {
  color: #F15946;
  min-height: 1.2em;
  font-size: 14px;
  animation: light-red 2.5s ease-in-out infinite;
}

.mono {
  font-family: "Pangolin", cursive;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c2c2c2;
  line-height: 1.55;
}

.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 10px; }
.block { margin-top: 16px; }

@keyframes light-red {
  0% { text-shadow: 0px 0px 0px #F15946; }
  50% { text-shadow: 0px 0px 24px #f15a46; }
  100% { text-shadow: 0px 0px 0px #F15946; }
}

@keyframes light-white {
  0% { text-shadow: 0px 0px 0px #fff; }
  50% { text-shadow: 0px 0px 24px #fff; }
  100% { text-shadow: 0px 0px 0px #fff; }
}

@keyframes load {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ========== LOGIN ========== */
.login-wrap {
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: #171717;
  position: relative;
  overflow: hidden;
}

.login-wrap::before {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(241, 89, 70, 0.18), transparent 68%);
  top: -80px;
  right: -60px;
  pointer-events: none;
}

.login-wrap::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(241, 89, 70, 0.1), transparent 70%);
  bottom: -40px;
  left: -40px;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  background: rgba(16, 16, 16, 0.83);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0px 0px 40px #f15a46;
}

.logo-block {
  position: relative;
  width: 100%;
  margin-bottom: 4px;
  text-align: center;
  animation: load 2.4s ease-in-out infinite;
}

.logo-main,
.login-card .logo-main {
  font-family: "Lacquer", system-ui;
  color: #F15946;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0.02em;
  text-align: center;
}

.login-desc {
  color: #7d7d7d;
  font-size: 14px;
  margin: 10px 0 6px;
  text-align: center;
}

/* ========== HEADER (like Soprano) ========== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 80px;
  background: rgba(16, 16, 16, 0.83);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 30;
  box-shadow: 0px 0px 20px #000;
  gap: 16px;
}

.header__left {
  position: relative;
  flex-shrink: 0;
  min-width: 0;
}

.header__left p {
  font-family: "Lacquer", system-ui;
  color: #F15946;
  font-size: 28px;
  line-height: 1;
}

.header__middle {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  flex: 1;
}

.header__button,
.nav-btn {
  font-family: "Pangolin", cursive;
  font-size: 15px;
  width: fit-content;
  position: relative;
  cursor: pointer;
  background: transparent;
  border: none;
  color: #fff;
  padding: 4px 2px;
}

.header__button:hover {
  opacity: 0.7;
  transform: translateY(2px);
}

.header__button-active,
.nav-btn.active {
  color: #F15946;
  opacity: 1;
  text-shadow: 0 0 12px rgba(241, 89, 70, 0.45);
}

.header__button-active::after,
.nav-btn.active::after {
  display: none;
}

.header__right {
  flex-shrink: 0;
}

.header__order {
  min-width: 40px;
  height: 40px;
  padding: 0 16px;
  border-radius: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.17);
  cursor: pointer;
  border: none;
  color: #fff;
  font-family: "Pangolin", cursive;
  font-size: 14px;
}

.header__order:hover {
  background: #F15946;
  box-shadow: 0px 0px 16px #ff1e00;
}

/* ========== LAYOUT ========== */
.app {
  min-height: 100%;
}

.content {
  padding: 110px 20px 60px;
  min-height: 100vh;
}

.container {
  width: min(1200px, 100%);
  margin: 0 auto;
}

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

.page-header__left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* Section titles — Pangolin (body brand font), not Lacquer logo style */
.page-title,
.page-header h2,
h2.page-title {
  font-family: "Pangolin", cursive !important;
  color: #F15946;
  font-size: 34px;
  line-height: 1.15;
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-shadow: 0px 0px 14px rgba(241, 89, 70, 0.35);
  animation: none;
}

h3 {
  font-family: "Pangolin", cursive !important;
  color: #F15946;
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 12px;
  letter-spacing: 0.01em;
}

.count-pill {
  font-family: "Pangolin", cursive;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 32px;
  padding: 0 14px;
  border-radius: 100px;
  background: rgba(241, 89, 70, 0.18);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 0 12px rgba(241, 89, 70, 0.25);
}

/* Account category tabs */
.acc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding-top: 20px;
}

.acc-tab {
  font-family: "Pangolin", cursive;
  font-size: 14px;
  color: #c2c2c2;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 100px;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.acc-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.acc-tab.active {
  color: #fff;
  background: rgba(241, 89, 70, 0.22);
  box-shadow: 0 0 14px rgba(241, 89, 70, 0.3);
}

.acc-tab-count {
  min-width: 22px;
  padding: 1px 8px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 12px;
  color: #fff;
}

.acc-tab.active .acc-tab-count {
  background: #F15946;
}

/* ========== CONTROLS ========== */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #999999;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  background: #1c1c1c;
  border: 0 solid rgba(67, 67, 67, 0);
  color: #fff;
  border-radius: 20px;
  padding: 12px 16px;
  font-family: "Pangolin", cursive;
  font-size: 14px;
  width: 100%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
  border-radius: 20px;
}

input:hover,
textarea:hover {
  box-shadow: 0px 0px 10px rgba(255, 255, 255, 0.2);
}

input:focus,
textarea:focus {
  box-shadow: 0px 0px 10px #F15946;
  background: #1c1c1c;
}

input::placeholder,
textarea::placeholder {
  color: #636363;
}

/* ========== BUTTONS ========== */
.btn {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 10px 18px;
  cursor: pointer;
  font-family: "Pangolin", cursive;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0px 0px 0px transparent;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0px 0px 10px rgba(255, 255, 255, 0.25);
  transform: translateY(1px);
}

.btn.primary {
  background: #F15946;
  color: #fff;
  box-shadow: 0px 0px 0px transparent;
}

.btn.primary:hover {
  background: #F15946;
  box-shadow: 0px 0px 16px #ff1e00;
  filter: brightness(1.05);
}

.btn.danger {
  background: rgba(241, 89, 70, 0.12);
  color: #F15946;
}

.btn.danger:hover {
  background: #F15946;
  color: #fff;
  box-shadow: 0px 0px 16px #ff1e00;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.1);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.file-btn {
  display: inline-flex;
  cursor: pointer;
}

/* ========== CARDS ========== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

/* Params rows: always 3 columns when space allows */
.dash-params-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .dash-params-row {
    grid-template-columns: 1fr;
  }
}

.card {
  background: rgba(16, 16, 16, 0.83);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0px 0px 20px #000;
}

.card:hover {
  box-shadow: 0px 0px 24px rgba(241, 89, 70, 0.35);
}

.card-label {
  color: #999999;
  font-size: 13px;
  margin-bottom: 8px;
}

.card-value {
  font-size: 22px;
  color: #fff;
  line-height: 1.3;
}

.card-value .badge {
  font-size: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ========== TABLE ========== */
.table-wrap {
  margin-top: 16px;
  overflow: auto;
  border-radius: 20px;
  background: #1c1c1c;
  box-shadow: 0px 0px 20px #000;
}

.table-wrap.table-scroll {
  max-height: 500px;
  overflow-y: auto;
  overflow-x: auto;
}

.table-wrap.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

th, td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  vertical-align: middle;
}

/* prevent ugly mid-digit wrapping on phones/ids */
td.mono,
td.cell-id,
td.cell-host {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

td.cell-actions {
  white-space: nowrap;
}

td.cell-actions .btn {
  margin: 2px 0;
}

th {
  background: #111111;
  color: #999999;
  font-weight: 400;
  font-size: 13px;
  position: sticky;
  top: 0;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: #c2c2c2;
}

.badge.ok {
  color: #fff;
  background: rgba(57, 180, 110, 0.35);
  box-shadow: 0 0 12px rgba(57, 180, 110, 0.35);
}

.badge.run {
  color: #fff;
  background: rgba(70, 140, 255, 0.42);
  box-shadow: 0 0 14px rgba(70, 140, 255, 0.4);
}

.badge.warn {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.badge.err {
  color: #F15946;
  background: rgba(241, 89, 70, 0.12);
  animation: light-red 2.5s ease-in-out infinite;
}

/* Page lock while warm run active */
.page-lock {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.page-lock.hidden {
  display: none !important;
}

.page-lock__card {
  width: min(420px, 100%);
  background: rgba(16, 16, 16, 0.95);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 0 36px rgba(70, 140, 255, 0.25);
}

.page-lock__title {
  font-family: "Pangolin", cursive;
  color: #6aa8ff;
  font-size: 22px;
  margin-bottom: 10px;
}

.page-lock__text {
  color: #999;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 18px;
}

.report-card {
  border: 1px solid rgba(57, 180, 110, 0.25);
  box-shadow: 0 0 20px rgba(57, 180, 110, 0.12);
}

.report-body {
  font-size: 14px;
  line-height: 1.55;
  color: #d8d8d8;
}

.report-body .report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.report-body .report-stat {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 12px;
}

.report-body .report-stat b {
  display: block;
  color: #999;
  font-weight: 400;
  font-size: 12px;
  margin-bottom: 4px;
}

.report-body .report-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 220px;
  overflow: auto;
}

.report-body .report-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.report-body .report-list .ok { color: #5fd99a; }
.report-body .report-list .bad { color: #ff8f8f; }
.report-body .report-list .warn { color: #e6c06a; }

/* —— Full history report panel —— */
.hist-report {
  margin-top: 18px;
  background: rgba(16, 16, 16, 0.92);
  border-radius: 20px;
  padding: 20px 20px 22px;
  box-shadow: 0 0 32px rgba(241, 89, 70, 0.18), 0 12px 40px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: page-in 0.3s ease;
}

.hist-report.hidden {
  display: none !important;
}

.hist-report__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.hist-report__eyebrow {
  font-size: 12px;
  color: #7d7d7d;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.hist-report__title {
  font-family: "Pangolin", cursive !important;
  color: #F15946;
  font-size: 20px;
  margin: 0;
  font-weight: 400;
  word-break: break-all;
}

.hist-report__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hr-section {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.hr-section__title {
  font-size: 13px;
  color: #F15946;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.hr-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  font-size: 14px;
  color: #c2c2c2;
}

.hr-meta .badge {
  font-size: 13px;
}

.hr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.hr-stat {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.hr-stat__label {
  display: block;
  font-size: 11px;
  color: #7d7d7d;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hr-stat__value {
  font-size: 20px;
  color: #fff;
  line-height: 1.2;
}

.hr-stat__value small {
  font-size: 13px;
  color: #999;
  font-weight: 400;
}

.hr-stat.is-ok .hr-stat__value { color: #5fd99a; }
.hr-stat.is-bad .hr-stat__value { color: #ff8f8f; }
.hr-stat.is-warn .hr-stat__value { color: #e6c06a; }
.hr-stat.is-run .hr-stat__value { color: #6aa8ff; }

.hr-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 14px;
  font-size: 13px;
  color: #b8b8b8;
}

.hr-params span {
  color: #fff;
}

.hr-table-wrap {
  overflow: auto;
  max-height: 280px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.hr-table th {
  position: sticky;
  top: 0;
  background: #151515;
  color: #7d7d7d;
  font-weight: 400;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hr-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #ddd;
  vertical-align: top;
}

.hr-table tr:last-child td {
  border-bottom: none;
}

.hr-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.hr-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.hr-tag.ok {
  background: rgba(57, 180, 110, 0.2);
  color: #5fd99a;
}

.hr-tag.bad {
  background: rgba(241, 89, 70, 0.15);
  color: #ff8f8f;
}

.hr-tag.warn {
  background: rgba(230, 192, 106, 0.15);
  color: #e6c06a;
}

.hr-events {
  max-height: 240px;
  overflow: auto;
  font-size: 12px;
}

.hr-events .log-line {
  border-bottom-color: rgba(255, 255, 255, 0.03);
  padding: 4px 0;
}

@media (max-width: 700px) {
  .hist-report {
    padding: 16px 14px;
  }

  .hr-table-wrap {
    max-height: none;
  }

  .hr-table,
  .hr-table thead,
  .hr-table tbody,
  .hr-table tr,
  .hr-table th,
  .hr-table td {
    display: block;
    width: 100%;
  }

  .hr-table thead {
    display: none;
  }

  .hr-table tr {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .hr-table td {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border: none;
    padding: 4px 0;
  }

  .hr-table td::before {
    content: attr(data-label);
    color: #7d7d7d;
    flex-shrink: 0;
  }
}

.nav-btn.is-locked {
  opacity: 0.4;
  pointer-events: none;
}

/* Active run loader — single instance in dashboard header */
.loader {
  --color-1: rgba(255, 255, 255, 0.08);
  --color-2: rgba(255, 255, 255, 0.12);
  --color-3: #f15a46;
  --color-4: rgba(241, 90, 70, 0.35);
  --size: 0.55px;

  width: calc(200 * var(--size));
  height: calc(40 * var(--size));
  background-color: var(--color-1);
  position: relative;
  border-radius: calc(50 * var(--size));
  box-shadow: inset 0 0 0 calc(2 * var(--size)) var(--color-2);
  flex-shrink: 0;
}

.loader:after {
  border-radius: calc(50 * var(--size));
  content: "";
  position: absolute;
  background-color: var(--color-3);
  left: calc(2 * var(--size));
  top: calc(2 * var(--size));
  bottom: calc(2 * var(--size));
  right: calc(360 * var(--size));
  animation: slide 2s linear infinite;
  box-shadow: 0 calc(1 * var(--size)) calc(2 * var(--size)) var(--color-4);
}

.loader:before {
  content: none;
  display: none;
}

@keyframes slide {
  0% {
    right: calc(150 * var(--size));
    left: calc(2 * var(--size));
  }
  5% {
    left: calc(2 * var(--size));
  }
  50% {
    right: calc(2 * var(--size));
    left: calc(150 * var(--size));
  }
  55% {
    right: calc(2 * var(--size));
  }
  100% {
    right: calc(150 * var(--size));
    left: calc(2 * var(--size));
  }
}

.dash-state-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========== LOG / LISTS ========== */
.log {
  max-height: 360px;
  overflow: auto;
  font-size: 13px;
  background: #111111;
  border-radius: 16px;
  padding: 10px 14px;
  line-height: 1.45;
}

.log .e-error { color: #F15946; }
.log .e-warn { color: #c2c2c2; }
.log .e-info { color: #7d7d7d; }
.log .e-success { color: #5fd99a; }

.log .log-line {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  align-items: flex-start;
}

.log .log-time {
  flex-shrink: 0;
  color: #666;
  font-size: 12px;
  min-width: 9.5em;
}

.log .log-text {
  flex: 1;
  word-break: break-word;
}

.log .e-info .log-text { color: #b8b8b8; }
.log .e-warn .log-text { color: #e6c06a; }
.log .e-error .log-text { color: #ff8f8f; }
.log .e-success .log-text { color: #5fd99a; }

.list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  max-height: 360px;
  overflow: auto;
}

/* Messages: equal card height; builtin list fills to match left column */
#page-messages .grid-2 {
  align-items: stretch;
}

#page-messages .grid-2 > .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#page-messages #msg-custom-list {
  flex: 1 1 auto;
  max-height: 320px;
  min-height: 0;
  overflow-y: auto;
}

/* Stretch to remaining card height ≈ left column (textarea + buttons + list) */
#page-messages #msg-builtin-list {
  flex: 1 1 auto;
  height: 0; /* flexbox fill: take all free space under header */
  min-height: 280px;
  max-height: none;
  overflow-y: auto;
  margin-top: 12px;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  color: #fff;
}

.list li:hover {
  background: rgba(255, 255, 255, 0.07);
}

.list li.disabled {
  opacity: 0.4;
  text-decoration: line-through;
}

.list li button {
  flex-shrink: 0;
}

.list li .list-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.list li .btn-icon {
  min-width: 32px;
  padding: 4px 10px;
  font-size: 14px;
  line-height: 1.2;
}

.msg-generate-card h3 {
  margin-bottom: 0.25rem;
}

.msg-generate-row {
  display: grid;
  grid-template-columns: 1fr 100px auto;
  gap: 10px;
  align-items: end;
}

.msg-generate-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.msg-generate-row input {
  width: 100%;
}

.msg-gen-preview-wrap {
  margin-top: 0.85rem;
}

.msg-gen-preview-wrap textarea {
  width: 100%;
}

@media (max-width: 720px) {
  .msg-generate-row {
    grid-template-columns: 1fr;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.toggles-block {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 16px;
  padding: 10px 14px;
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

.upload-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 1rem 0;
}

.upload-mode-card {
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-mode-card:hover {
  background: rgba(241, 89, 70, 0.12);
  border-color: rgba(241, 89, 70, 0.4);
}

.upload-mode-card strong {
  font-size: 15px;
  color: #F15946;
}

.upload-mode-card span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.35;
}

.modal-card--wide {
  width: min(640px, 96vw);
  max-height: 88vh;
  overflow: auto;
}

.modal-card--chat {
  width: min(480px, 96vw);
  height: min(720px, 90vh);
  display: flex;
  flex-direction: column;
  padding-bottom: 12px;
}

.acc-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1rem;
}

.acc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F15946, #8b3a2f);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  position: relative;
}

.acc-avatar--lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.acc-avatar.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.85);
  animation: acc-avatar-spin 0.7s linear infinite;
}

.acc-avatar.has-photo {
  background-color: #222;
}

@keyframes acc-avatar-spin {
  to { transform: rotate(360deg); }
}

.acc-link {
  color: #F15946;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed rgba(241, 89, 70, 0.45);
}

.acc-link:hover {
  border-bottom-color: #F15946;
}

.acc-detail-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.acc-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-size: 13px;
}

.acc-meta-grid .k {
  color: rgba(255, 255, 255, 0.45);
}

.acc-meta-grid .v {
  color: #fff;
  word-break: break-all;
}

.acc-partners {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow: auto;
}

.acc-partners li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 6px;
  cursor: pointer;
}

.acc-partners li:hover {
  background: rgba(255, 255, 255, 0.08);
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.chat-title {
  font-size: 16px;
  color: #fff;
}

.chat-sub {
  font-size: 12px;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  min-height: 320px;
}

.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.35;
  position: relative;
}

.chat-bubble.is-out {
  align-self: flex-end;
  background: rgba(241, 89, 70, 0.35);
  border-bottom-right-radius: 4px;
}

.chat-bubble.is-in {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.chat-bubble.is-reply {
  border-left: 2px solid rgba(241, 89, 70, 0.8);
}

.chat-bubble .chat-meta {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

.chat-sticker {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 28px;
}

.chat-sticker small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.chat-ticks {
  letter-spacing: -1px;
}

.chat-ticks.is-read {
  color: #5eb5f7;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.toggle-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  transition: background 0.2s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.switch .slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.switch input:checked + .slider {
  background: rgba(241, 89, 70, 0.85);
  box-shadow: 0 0 8px rgba(241, 89, 70, 0.3);
}

.switch input:checked + .slider::before {
  transform: translateX(16px);
}

.switch input:focus-visible + .slider {
  outline: 2px solid rgba(241, 89, 70, 0.6);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .toggles-block {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .toggles-block {
    grid-template-columns: 1fr;
  }
}

.toast {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  box-shadow: 0px 0px 16px rgba(241, 89, 70, 0.25);
}

.toast.err {
  color: #F15946;
  background: rgba(241, 89, 70, 0.1);
  box-shadow: 0px 0px 16px rgba(241, 89, 70, 0.35);
}

code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 100px;
  font-family: "Pangolin", cursive;
  font-size: 13px;
  color: #F15946;
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111111; }
::-webkit-scrollbar-thumb {
  background: #303030;
  border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover {
  background: #F15946;
}

::selection {
  background: rgba(241, 89, 70, 0.45);
  color: #fff;
}

.page {
  animation: page-in 0.45s ease;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== MODAL CONFIRM ========== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-root.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: rgba(16, 16, 16, 0.96);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow: 0 0 40px rgba(241, 89, 70, 0.35), 0 16px 48px rgba(0, 0, 0, 0.55);
  animation: modal-in 0.22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title {
  font-family: "Pangolin", cursive !important;
  color: #F15946;
  font-size: 22px;
  margin: 0 0 12px;
  font-weight: 400;
}

.modal-message {
  color: #c2c2c2;
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 22px;
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-actions .btn {
  min-width: 96px;
}

.modal-root.is-alert .modal-actions #modal-cancel {
  display: none;
}

/* ========== PROCESS TOAST ========== */
.process-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(440px, calc(100% - 24px));
  pointer-events: none;
}

.process-toast.hidden {
  display: none !important;
}

.process-toast__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(16, 16, 16, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 28px rgba(241, 89, 70, 0.45), 0 10px 40px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(241, 89, 70, 0.35);
  pointer-events: auto;
}

.process-toast__spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #F15946;
  flex-shrink: 0;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.process-toast__title {
  font-family: "Pangolin", cursive !important;
  color: #F15946;
  font-size: 15px;
  line-height: 1.1;
  margin-bottom: 2px;
}

.process-toast__text {
  font-family: "Pangolin", cursive;
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
}

.process-toast.is-done .process-toast__spinner {
  border-top-color: #fff;
  animation: none;
  border-color: #F15946;
  background: rgba(241, 89, 70, 0.25);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "logo logout"
      "nav nav";
    height: auto;
    min-height: unset;
    align-items: center;
    padding: 12px 16px 10px;
    gap: 10px 12px;
  }

  .header__left {
    grid-area: logo;
    min-width: 0;
  }

  .header__right {
    grid-area: logout;
    justify-self: end;
  }

  .header__middle {
    grid-area: nav;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 8px;
    -webkit-overflow-scrolling: touch;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
  }

  /* WebKit (Chrome, Edge, Safari) — thin translucent thumb, invisible track */
  .header__middle::-webkit-scrollbar {
    height: 3px;
    background: transparent;
  }

  .header__middle::-webkit-scrollbar-track {
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .header__middle::-webkit-scrollbar-track-piece {
    background: transparent;
  }

  .header__middle::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 100px;
    border: none;
    min-width: 40px;
  }

  .header__middle::-webkit-scrollbar-thumb:hover {
    background: rgba(241, 89, 70, 0.55);
  }

  .header__middle::-webkit-scrollbar-button,
  .header__middle::-webkit-scrollbar-corner {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
  }

  .header__button,
  .nav-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }



  .content {
    padding-top: 130px;
  }

  .header__left p {
    font-size: 24px;
  }

  .page-title,
  .page-header h2,
  h2.page-title {
    font-size: 26px;
  }
}

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

  .login-card {
    box-shadow: 0px 0px 28px rgba(241, 89, 70, 0.55);
    padding: 28px 20px;
  }

  .logo-main {
    font-size: 34px;
  }

  .content {
    padding: 128px 12px 40px;
  }

  .header__order {
    padding: 0 14px;
    height: 36px;
    font-size: 13px;
  }

  .page-title,
  .page-header h2,
  h2.page-title {
    font-size: 22px;
  }

  .process-toast {
    bottom: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header .row {
    flex-wrap: wrap;
  }

  .page-header .btn,
  .page-header .file-btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  /* —— Card-style lists on small screens —— */
  .table-wrap {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .table-wrap.table-scroll {
    max-height: none;
    overflow: visible;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .table-wrap tr {
    background: rgba(16, 16, 16, 0.9);
    border-radius: 16px;
    padding: 12px 14px 10px;
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  .table-wrap tr:hover td {
    background: transparent;
  }

  .table-wrap td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: right;
    white-space: normal;
    word-break: break-word;
  }

  .table-wrap td:last-child {
    border-bottom: none;
    padding-top: 10px;
    padding-bottom: 2px;
  }

  .table-wrap td.cell-id,
  .table-wrap td.cell-host,
  .table-wrap td.mono {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: 13px;
  }

  .table-wrap td.cell-id {
    font-size: 15px;
    color: #fff;
    justify-content: flex-start;
    padding-top: 2px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(241, 89, 70, 0.2);
    font-weight: 500;
  }

  .table-wrap td.cell-id::before {
    display: none;
  }

  .table-wrap td::before {
    content: attr(data-label);
    flex-shrink: 0;
    color: #7d7d7d;
    font-size: 12px;
    text-align: left;
    letter-spacing: 0.03em;
  }

  .table-wrap td.cell-actions {
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
  }

  .table-wrap td.cell-actions::before {
    margin-right: auto;
  }

  .table-wrap td.cell-actions .btn {
    min-width: 72px;
  }

  .table-wrap td.cell-empty {
    display: block;
    text-align: center;
    color: #7d7d7d;
    padding: 20px 12px;
  }

  .table-wrap td.cell-empty::before {
    display: none;
  }

  .acc-tabs {
    gap: 6px;
  }

  .acc-tab {
    font-size: 13px;
    padding: 7px 12px;
  }
}
