:root {
  color-scheme: dark;
  --bg: #070b14;
  --surface: rgba(16, 23, 39, .92);
  --surface-solid: #101727;
  --surface-2: #151e31;
  --line: rgba(148, 163, 184, .15);
  --line-strong: rgba(148, 163, 184, .27);
  --text: #edf3ff;
  --muted: #8d9ab0;
  --primary: #5b7cfa;
  --primary-2: #7691ff;
  --success: #2bc48a;
  --danger: #ef6a7a;
  --warning: #f0b75c;
  --radius-lg: 20px;
  --radius-md: 13px;
  --shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgba(62, 91, 190, .13), transparent 30%),
    radial-gradient(circle at 92% 15%, rgba(28, 153, 117, .08), transparent 25%),
    linear-gradient(145deg, #080c16 0%, #0a101d 55%, #080c15 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .dropzone:focus-within {
  outline: 3px solid rgba(91, 124, 250, .28);
  outline-offset: 2px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .09;
  pointer-events: none;
}

.ambient-one { top: -220px; left: -100px; background: #577dff; }
.ambient-two { right: -230px; top: 35%; background: #27c794; }

.app-shell { width: min(1520px, 100%); margin: 0 auto; padding: 28px 30px 18px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow, .step-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #9bb0ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}

.brand-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(118, 145, 255, .36);
  border-radius: 9px;
  background: rgba(91, 124, 250, .14);
  color: #b8c5ff;
  font-size: 17px;
}

h1, h2, h3, p { margin-top: 0; }
.brand-block h1 { margin: 11px 0 5px; font-size: clamp(26px, 3vw, 39px); line-height: 1.08; letter-spacing: -.035em; }
.brand-block p { margin-bottom: 0; color: var(--muted); font-size: 14px; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.service-panel { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.service-panel time { color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.status-badge, .footer-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #8de1bd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
.status-badge i, .footer-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px var(--success); }
.status-badge.offline { color: #ff9baa; }
.status-badge.offline i { background: var(--danger); box-shadow: none; }

.type-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.type-tab {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(15, 22, 37, .74);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.type-tab:hover { transform: translateY(-1px); border-color: rgba(118, 145, 255, .35); background: rgba(20, 29, 48, .95); }
.type-tab.active { border-color: rgba(100, 129, 255, .55); background: linear-gradient(135deg, rgba(74, 101, 212, .22), rgba(22, 31, 51, .9)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(103, 132, 255, .08), 0 10px 30px rgba(25, 40, 92, .14); }
.tab-icon { display: grid; flex: 0 0 38px; height: 38px; place-items: center; border-radius: 11px; background: rgba(91, 124, 250, .12); color: #9fb1ff; font-size: 20px; }
.type-tab strong, .type-tab small { display: block; }
.type-tab strong { font-size: 13px; letter-spacing: .02em; }
.type-tab small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.workspace { display: grid; grid-template-columns: minmax(340px, 430px) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.input-panel { padding: 21px; }
.panel-heading, .preview-heading, .field-heading, .range-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-heading { margin-bottom: 20px; }
.panel-heading h2, .preview-heading h2 { margin: 5px 0 0; font-size: 18px; letter-spacing: -.015em; }
.soft-badge, .latest-badge { border: 1px solid rgba(91, 124, 250, .24); border-radius: 999px; background: rgba(91, 124, 250, .1); color: #aebcff; font-size: 10px; font-weight: 800; padding: 6px 9px; white-space: nowrap; }
.latest-badge { border-color: rgba(43, 196, 138, .24); background: rgba(43, 196, 138, .1); color: #8fe0be; }
.latest-badge.hidden { display: none; }

.field-group { margin-top: 16px; }
label, .input-label { display: block; color: #c5cfdf; font-size: 11px; font-weight: 750; letter-spacing: .035em; }
.field-group > label, .field-heading label { margin-bottom: 8px; }
.field-tools { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 10px; }
.text-button { padding: 0; border: 0; background: transparent; color: #91a7ff; font-size: 10px; font-weight: 900; cursor: pointer; }

.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #0a101c; }
.segment { padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; transition: .18s ease; }
.segment:hover:not(:disabled) { color: var(--text); }
.segment.active { background: #202c46; color: #f1f5ff; box-shadow: 0 5px 14px rgba(0, 0, 0, .18); }
.segment:disabled { display: none; }
.segmented.single { grid-template-columns: 1fr; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(7, 12, 22, .86);
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input:hover, select:hover, textarea:hover { border-color: rgba(148, 163, 184, .42); }
input:focus, select:focus, textarea:focus { border-color: rgba(91, 124, 250, .72); background: #090f1c; box-shadow: 0 0 0 3px rgba(91, 124, 250, .1); outline: none; }
input, select { height: 42px; padding: 0 12px; }
select { appearance: none; padding-right: 35px; cursor: pointer; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 13px; top: 9px; color: var(--muted); pointer-events: none; }
.mono-input { font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }

.range-panel { margin-top: 16px; padding: 14px; border: 1px solid rgba(91, 124, 250, .2); border-radius: 14px; background: rgba(37, 53, 92, .16); animation: reveal .2s ease; }
.range-head { margin-bottom: 10px; }
.range-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); align-items: end; gap: 8px; }
.range-grid .input-label { margin-bottom: 6px; color: var(--muted); font-size: 9px; }
.range-arrow { padding-bottom: 12px; color: #7184c4; text-align: center; }
.helper { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }

textarea { min-height: 190px; resize: vertical; padding: 12px 13px; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
textarea::placeholder, input::placeholder { color: #536077; }
.divider { display: flex; align-items: center; gap: 10px; margin: 15px 0; color: #536077; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.dropzone { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px dashed rgba(118, 145, 255, .36); border-radius: 13px; background: rgba(64, 87, 167, .07); cursor: pointer; transition: .18s ease; }
.dropzone:hover, .dropzone.dragging { border-color: rgba(118, 145, 255, .8); background: rgba(64, 87, 167, .13); transform: translateY(-1px); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { display: grid; flex: 0 0 38px; height: 38px; place-items: center; border-radius: 11px; background: rgba(91, 124, 250, .15); color: #aebdff; font-size: 20px; }
.drop-copy { min-width: 0; }
.drop-copy strong, .drop-copy small, .drop-copy em { display: block; }
.drop-copy strong { font-size: 12px; }
.drop-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.drop-copy em { overflow: hidden; margin-top: 5px; color: #83d7b3; font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 10px 15px; border: 1px solid transparent; border-radius: 11px; color: white; font-size: 11px; font-weight: 850; letter-spacing: .02em; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, border-color .18s ease, opacity .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; filter: saturate(.35); opacity: .42; box-shadow: none; }
.button-block { width: 100%; }
.button-primary { margin-top: 16px; background: linear-gradient(135deg, #5377f5, #4664d4); box-shadow: 0 10px 25px rgba(65, 91, 204, .25); }
.button-success { background: linear-gradient(135deg, #29b981, #209b6d); box-shadow: 0 10px 25px rgba(32, 155, 109, .2); }
.button-copy { background: rgba(76, 103, 212, .17); border-color: rgba(105, 132, 241, .3); color: #bac6ff; }
.button-undo { background: rgba(239, 106, 122, .06); border-color: rgba(239, 106, 122, .24); color: #f2a3ae; }
.button-neutral { border-color: var(--line-strong); background: #182135; color: #c3cede; }
.button-danger { background: linear-gradient(135deg, #c95060, #a83f4e); }
.process-button { margin-top: 16px; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .28); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }

.alert { display: grid; grid-template-columns: 30px minmax(0, 1fr) 20px; gap: 10px; align-items: start; margin-top: 14px; padding: 12px; border: 1px solid rgba(239, 106, 122, .25); border-radius: 12px; background: rgba(110, 31, 45, .2); animation: reveal .2s ease; }
.alert-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; background: rgba(239, 106, 122, .16); color: #ff9fac; font-weight: 900; }
.alert strong { color: #ffc2ca; font-size: 11px; }
.alert p { margin: 3px 0 0; color: #d7aab1; font-size: 11px; line-height: 1.45; }
.alert button { padding: 0; border: 0; background: transparent; color: #b97e87; font-size: 19px; cursor: pointer; }

.result-column { min-width: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-bottom: 12px; }
.stat-card { min-width: 0; min-height: 80px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(15, 22, 37, .82); box-shadow: 0 12px 30px rgba(0, 0, 0, .12); }
.stat-card span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.stat-card strong { display: block; overflow: hidden; color: #dce5f5; font-size: 19px; text-overflow: ellipsis; white-space: nowrap; }
.stat-card .stat-id { font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 22px; }
.stat-primary { border-color: rgba(91, 124, 250, .3); background: linear-gradient(135deg, rgba(58, 81, 170, .22), rgba(15, 22, 37, .85)); }
.stat-primary strong { color: #aebdff; font-size: 24px; }
.stat-success strong { color: #78dbb2; }

.preview-panel { min-height: 480px; padding: 20px; }
.preview-heading { align-items: flex-start; }
.preview-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.preview-status { display: flex; align-items: center; gap: 7px; margin-top: 15px; padding: 9px 11px; border: 1px solid rgba(43, 196, 138, .2); border-radius: 10px; background: rgba(43, 196, 138, .08); color: #85dfb8; font-size: 11px; }
.preview-status small { margin-left: auto; color: #6ebd9d; }

.empty-state { display: grid; min-height: 300px; place-items: center; align-content: center; padding: 35px; text-align: center; }
.empty-icon { display: grid; width: 58px; height: 58px; margin-bottom: 14px; place-items: center; border: 1px solid var(--line); border-radius: 18px; background: rgba(100, 116, 139, .07); color: #71809a; font-size: 27px; }
.empty-state h3 { margin-bottom: 6px; color: #b9c4d5; font-size: 14px; }
.empty-state p { margin-bottom: 0; color: var(--muted); font-size: 11px; }

.table-wrap { max-width: 100%; margin-top: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; scrollbar-color: #35415a #111827; }
table { width: 100%; min-width: 1130px; border-collapse: collapse; font-size: 10px; }
th { position: sticky; top: 0; z-index: 1; padding: 10px 11px; background: #151e31; color: #8290a7; font-size: 8px; letter-spacing: .07em; text-align: left; white-space: nowrap; }
td { max-width: 210px; padding: 10px 11px; border-top: 1px solid rgba(148, 163, 184, .09); color: #c9d3e2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody tr:nth-child(even) { background: rgba(148, 163, 184, .025); }
tbody tr:hover { background: rgba(91, 124, 250, .06); }
th.number, td.number { text-align: right; font-variant-numeric: tabular-nums; }
td.mono-cell { color: #aebcff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; cursor: help; }
.checkpoint-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 9px 0 0; color: var(--muted); font-size: 9px; text-align: center; }

footer { display: flex; justify-content: space-between; padding: 17px 3px 0; color: #657189; font-size: 10px; }
footer strong { color: #8c9ab3; }

.modal { max-width: 440px; width: calc(100% - 28px); padding: 0; border: 1px solid var(--line-strong); border-radius: 20px; background: #111929; color: var(--text); box-shadow: 0 30px 100px rgba(0, 0, 0, .58); }
.modal::backdrop { background: rgba(2, 6, 14, .78); backdrop-filter: blur(5px); }
.modal[open] { animation: modal-in .2s ease; }
.modal-card { padding: 25px; text-align: center; }
.modal-symbol { display: grid; width: 48px; height: 48px; margin: 0 auto 13px; place-items: center; border-radius: 15px; font-size: 22px; font-weight: 900; }
.success-symbol { background: rgba(43, 196, 138, .13); color: #79ddb4; }
.warning-symbol { background: rgba(240, 183, 92, .13); color: #f4c77d; }
.modal h2 { margin-bottom: 7px; font-size: 18px; }
.modal p { color: var(--muted); font-size: 11px; line-height: 1.55; }
.confirm-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 17px 0; text-align: left; }
.confirm-summary div { min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: #0b111e; }
.confirm-summary dt { color: var(--muted); font-size: 9px; }
.confirm-summary dd { overflow: hidden; margin: 5px 0 0; color: #d7e0ef; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.modal-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 9px; margin-top: 18px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(390px, calc(100% - 32px)); padding: 13px 16px; border: 1px solid rgba(43, 196, 138, .28); border-radius: 12px; background: rgba(18, 52, 43, .96); color: #b7f0d5; box-shadow: 0 18px 60px rgba(0, 0, 0, .4); font-size: 11px; font-weight: 700; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error-toast { border-color: rgba(239, 106, 122, .28); background: rgba(75, 29, 38, .97); color: #ffc3cb; }
.hidden { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 380px minmax(0, 1fr); }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .app-shell { padding: 20px 16px 14px; }
  .topbar { align-items: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .type-tabs { gap: 8px; }
  .type-tab { padding: 11px; }
  .type-tab small { display: none; }
  .tab-icon { flex-basis: 32px; height: 32px; }
}

@media (max-width: 600px) {
  .topbar { flex-direction: column; }
  .header-actions { width: 100%; justify-content: space-between; }
  .service-panel { align-items: flex-start; }
  .type-tabs { grid-template-columns: 1fr; }
  .type-tab small { display: block; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .range-grid { grid-template-columns: 1fr; }
  .range-arrow { padding: 0; transform: rotate(90deg); }
  .preview-heading { flex-direction: column; }
  .preview-heading .button { width: 100%; }
  .modal-actions { grid-template-columns: 1fr; }
  .toast { right: 16px; bottom: 16px; }
}
