:root{
  --bg: #0b1220;
  --panel: #101a2e;
  --panel-2: #0f172a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: rgba(148,163,184,.18);

  --blue: #3b82f6;
  --blue-2: #1d4ed8;
  --danger: #ef4444;

  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --radius: 14px;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(59,130,246,.18), transparent 55%),
    radial-gradient(900px 500px at 80% 10%, rgba(29,78,216,.18), transparent 50%),
    var(--bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  color: var(--text);
}


a{ color: inherit; text-decoration: none; }
a:hover{ text-decoration: underline; }

.hidden {
	display: none !important;
}

#preview_subtitle {
	font-weight: 400;
	font-size: 10px;
	font-style: italic;
}

.app-shell{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(10px);
}

.brand{ display:flex; align-items:center; gap:12px; }
.logo-dot{
  width: 14px; height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--blue), var(--blue-2));
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.logo img {
  width: 183px;
  height: 64px;
}
.brand-text{ font-weight: 650; letter-spacing: .2px; }

.topnav{ display:flex; align-items:center; gap: 14px; }
.nav-link{ padding: 8px 10px; border-radius: 10px; }
.nav-link:hover{ background: rgba(148,163,184,.08); text-decoration:none; }

.content{
  width: min(1100px, calc(100% - 32px));
  margin: 28px auto;
  flex:1;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.footer{
  border-top: 1px solid var(--border);
  padding: 16px 22px;
  color: var(--muted);
  background: rgba(15,23,42,.35);
}

.title-wrap {
  display: flex;
  margin-bottom: 16px;
}

.title-wrap div {
  width: 100%;
}

.title-wrap .icon {
  text-align: right;
}

.title-wrap .title {
  font-weight: bold;
  font-size: 32px;
}

.title-wrap .subtitle {
  font-size: 18px;
  font-style: italic;
}

.card{
  background: linear-gradient(180deg, rgba(16,26,46,.92), rgba(15,23,42,.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-subheading {
	margin-top:24px;
}

.card-header{
	display:flex;
	gap:12px;
	align-items:center;
	justify-content:space-between;
}

.card-section {
	padding: 1rem 0;
	border-top: 1px solid var(--border);
}

.grid{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
}
@media (max-width: 860px){
  .grid{ grid-template-columns: 1fr; }
}

.h1{ margin:0 0 6px; font-size: 26px; }
.h2{ margin:0 0 8px; font-size: 20px; }
.h3{ margin:0 0 10px; font-size: 16px; }
.muted{ color: var(--muted); }
.muted a { color: var(--text) !important; }

.auth-card{
  width: min(460px, 100%);
  margin: 40px auto;
}

.form{ display:flex; flex-direction:column; gap: 10px; margin-top: 14px; }
.label{ font-size: 12px; color: var(--muted); margin-top: 6px; }
.input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.35);
  color: var(--text);
  outline: none;
}
.input:focus{
  border-color: rgba(59,130,246,.7);
  box-shadow: 0 0 0 4px rgba(59,130,246,.16);
}

.input-cb {
	display: flex;
	gap: 8px;
	color: var(--text);
}
.input-cb input[type="checkbox"] {
	/*width: auto !important;
	background: rgba(2,6,23,.35);
	border: 1px solid rgba(148,163,184,.22);
	padding: 12px 12px;
    border-radius: 12px;*/
}

.btn-group-hori,
.btn-group-hori-right,
.btn-group-vert {
  margin-top: 10px;
	display: flex;
	gap: 16px;
}
.btn-group-hori-right {
	justify-content: flex-end;
}
.btn-group-vert {
	flex-direction: column;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(148,163,184,.08);
  color: var(--text);
  cursor:pointer;
  font-weight: 600;
}

.btn[data-busy="1"]{
  opacity: .65;
  pointer-events: none;
}

.btn:hover{ filter: brightness(1.08); }
.btn:active{ transform: translateY(1px); }

.btn-sm{
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.btn-primary{
  border-color: rgba(59,130,246,.45);
  background: linear-gradient(180deg, rgba(59,130,246,.95), rgba(29,78,216,.95));
}
.btn-ghost{
  background: transparent;
  border-color: rgba(148,163,184,.18);
}

.btn-danger{
  border-color: rgba(239,68,68,.45);
  background: linear-gradient(
    180deg,
    rgba(239,68,68,.95),
    rgba(185,28,28,.95)
  );
}

.btn[data-disabled="1"] {
  filter: brightness(0.6);
  opacity: .65;
  cursor: not-allowed
}
.btn[data-disabled="1"]:hover { filter: brightness(0.6) !important; }


.inline{ display:inline; margin:0; }

.alert{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.2);
  background: rgba(148,163,184,.08);
  margin-top: 12px;
  display: flex;
  align-items: center;
}
.alert-success{
  border-color: rgba(34,197,94,.35);
  background: rgba(34,197,94,.12);
}
.alert-warning{
  border-color: rgba(234,179,8,.4);
  background: rgba(234,179,8,.14);
}
.alert-danger{
  border-color: rgba(235,56,56,.35);
  background: rgba(235,56,56,.12);
}
.alert-msg-wrap{
  white-space: nowrap;
}
.alert-btn-wrap{
  text-align: right;
  width: 95%;
}
.alert-msg-msg{
  font-weight: bold;
}
.alert-msg-ts{
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.hint{ margin-top: 14px; font-size: 13px; }

.pill-row{ display:flex; flex-wrap:wrap; gap: 8px; margin-top: 14px; }
.pill{
  font-size: 12px;
  color: rgba(229,231,235,.92);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.25);
}

.list{ margin: 10px 0 0; padding-left: 18px; color: rgba(229,231,235,.92); }
.list li{ margin: 6px 0; }


/* -------------------------
   Tiles (inside a card)
   ------------------------- */

.tiles{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 980px){
  .tiles{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .tiles{ grid-template-columns: 1fr; }
}

.tile{
  display: flex;
  flex-direction: column;
  gap: 10px;

  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.22);

  box-shadow: 0 10px 26px rgba(0,0,0,.22);
  text-decoration: none;
  transition: transform .08s ease, filter .08s ease, border-color .08s ease, background .08s ease;
}

.tile:hover{
  text-decoration: none;
  filter: brightness(1.06);
  border-color: rgba(59,130,246,.35);
}

.tile:active{
  transform: translateY(1px);
}

.tile-title{
  font-weight: 650;
  letter-spacing: .2px;
}

.tile-desc{
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.tile-foot{
  display:flex;
  align-items:center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 6px;
}

.tile-tag{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(148,163,184,.08);
  color: rgba(229,231,235,.92);
}

.tile-disabled{
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(.15);
}

.tile-disabled:hover{
  border-color: rgba(148,163,184,.18);
  filter: none;
}


/* -------------------------
   Tables
   ------------------------- */

.table-wrap{
  width:100%;
  overflow-x:auto;
  border-radius: 12px;
}

.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.table thead th{
  text-align:left;
  font-weight: 600;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(15,23,42,.55);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody td{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148,163,184,.08);
  vertical-align: middle;
}

.table tbody tr:last-child td{
  border-bottom: none;
}

/* Row hover */
.table tbody tr{
  transition: background .08s ease;
}
.table tbody tr:hover{
  background: rgba(148,163,184,.06);
}

/* Compact variant */
.table-compact thead th,
.table-compact tbody td{
  padding: 9px 12px;
  font-size: 13px;
}

/* Status pills inside tables */
.table-status{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.25);
}

.table-status.active{
  border-color: rgba(59,130,246,.35);
  background: rgba(59,130,246,.12);
}

.table-status.disabled{
  opacity:.7;
}

/* Right-aligned actions */
.table-actions{
  text-align:right;
  white-space: nowrap;
}

.table-actions a{
  font-size: 13px;
  opacity:.85;
}
.table-actions a:hover{
  opacity:1;
  text-decoration: none;
}

/* Empty state */
.table-empty{
  padding: 18px;
  text-align:center;
  color: var(--muted);
}

/* -------------------------
   Table toolbar (search / filters)
   ------------------------- */

.table-toolbar{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.table-toolbar form {
	display:flex;
	gap:10px;
	align-items:center;
	flex-wrap:wrap;
}

.table-toolbar .left,
.table-toolbar .right{
  display:flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.select{
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.35);
  color: var(--text);
  outline: none;
}
.select:focus{
  border-color: rgba(59,130,246,.7);
  box-shadow: 0 0 0 4px rgba(59,130,246,.16);
}

/* Sortable header links */
.th-sort a{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}
.th-sort a:hover{ text-decoration:none; filter: brightness(1.06); }
.sort-ind{
  opacity:.7;
  font-size: 12px;
}

/* Pagination */
.pager{
  display:flex;
  gap: 8px;
  align-items:center;
  justify-content:flex-end;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pager a, .pager span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(148,163,184,.06);
  text-decoration:none;
}
.pager a:hover{ filter: brightness(1.08); }
.pager .current{
  border-color: rgba(59,130,246,.45);
  background: rgba(59,130,246,.12);
  font-weight: 700;
}
.pager .disabled{
  opacity:.45;
  pointer-events:none;
}

/* -------------------------
   Form tiles / sections
   ------------------------- */

.form-grid{
  display:grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

/* Column spans */
.col-12{ grid-column: span 12; }
.col-8{ grid-column: span 8; }
.col-6{ grid-column: span 6; }
.col-4{ grid-column: span 4; }
.col-2{ grid-column: span 2; }

@media (max-width: 980px){
  .col-8, .col-6, .col-4{ grid-column: span 12; }
}

.form-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.form-tile-title{
  font-weight: 650;
  letter-spacing: .2px;
  margin-bottom: 8px;
}

.form-tile-desc{
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 12px;
}

/* Fields inside tiles */
.field{ display:flex; flex-direction:column; padding: 0.25rem 0; width: 100%; }
.field-row{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px){
  .field-row{ grid-template-columns: 1fr; }
}

.field .label {
	margin-bottom: 0.5rem;
}

.form-actions{
  display:flex;
  gap: 10px;
  justify-content:flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
}
.form-actions.left{ justify-content:flex-start; }

#html_preview {
	border: 1px solid var(--border);
	border-radius: 10px;
  width: 100%;
}

#sigPreview {
	width: 100%;
	border: 0;
	overflow: hidden;
	display: block;
	border-radius: 4px;
}
#sig-preview {
  scrollbar-width: none;          /* Firefox */
}
#sig-preview::-webkit-scrollbar {
  display: none;                  /* Chrome / Edge / Safari */
}

#user-attribute-wrapper {
  width: 100%;
}

/* CodeMirror container styling to match your theme */
.cm-host {
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  overflow: hidden;
}

/* Custom highlights */
.cm-invalidVar {
  text-decoration: underline wavy;
  text-decoration-color: red;
}

/* CodeMirror baseline (cursor/selection/gutters) overrides */
.cm-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  background-color: #121212;
}

.cm-scroller {
  min-height: 360px;
}

/* Gutter / line numbers */

.cm-gutter {
  background-color: #121212;
}

.cm-gutters {
  background: transparent;
  border-right: 1px solid var(--border, #2a2a2a);
}

/* Cursor + selection visibility */
.cm-cursor {
  border-left-color: var(--text, #e7e7e7) !important;
}

.cm-selectionBackground {
  background: rgba(255, 255, 255, 0.12);
}

.cm-editor.cm-focused .cm-selectionBackground {
  background: rgba(255, 255, 255, 0.16);
}

/* Optional: active line highlight (subtle) */
.cm-activeLine {
  background: rgba(255, 255, 255, 0.04);
}



/* You control colors here (no JS theme needed) */

.cmTok-invalid {
  /* keep whatever color you want for the text itself */
  color: inherit;

  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: #ff0000; /* HARD RED */
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}


.cmTok-tag    { color: #00d9ff; }
.cmTok-attr   { color: #ff9f1c; }
.cmTok-string { color: #2dff8f; }
.cmTok-comment{ color: #8a7dff; font-style: italic; } /* violet comments */

.cmTok-invalid { color: #ff4d6d; }

.cm-ifBlock    { background-color: rgba(255, 159, 28, 0.3); }
.cm-addonBlock { background-color: rgba(138, 125, 255, 0.4); }

.helper-header {
	margin: 16px 0;
}



.session-modal-backdrop[hidden] { display: none; }

.session-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.session-modal {
  width: 100%;
  max-width: 420px;
  background: #111;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 16px 16px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}

.session-modal h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.session-modal p {
  margin: 0 0 14px 0;
  line-height: 1.35;
  opacity: 0.95;
}

.session-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Optional default button styles if you don't have your own */
.session-modal .btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  text-decoration: none;
  cursor: pointer;
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.session-modal .btn:hover { background: rgba(255,255,255,0.10); }
.session-modal .btn-primary { background: rgba(60,140,255,0.35); border-color: rgba(60,140,255,0.6); }
.session-modal .btn-primary:hover { background: rgba(60,140,255,0.45); }

.hp-status-img {
  text-align: right;
}

.hp-status-node {
  display: flex;
  flex-direction: column;
}

.hp-status-node .title {
  font-weight: bold;
}

.hp-status-node .subtitle {
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
}

.hp-status-node .body {
  margin-top: 12px;
}