/* ScriptBox: an old-Winbox look. Classic grey 3D controls, a navy title bar,
   the vertical brand strip and the menu on the left, windows in the MDI area. */
:root {
  --face: #d4d0c8;
  --face-light: #e4e1da;
  --hi: #ffffff;
  --shadow: #808080;
  --dark: #404040;
  --text: #000;
  --muted: #555;
  --link: #0000c0;
  --title-a: #0a246a;
  --title-b: #a6caf0;
  --title-in-a: #808080;
  --title-in-b: #c0c0c0;
  --select: #0a246a;
  --mdi: #ffffff;
  --strip: #8b9bb9;
  --bad: #c00000;
  --font: Tahoma, Verdana, "Segoe UI", Geneva, "DejaVu Sans", sans-serif;
  --mono: Consolas, "Lucida Console", "DejaVu Sans Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--face); color: var(--text); font: 12px/1.45 var(--font); }
a { color: var(--link); }
code { font: 12px var(--mono); background: #fff; padding: 0 3px; border: 1px solid #c8c8c8; }
[hidden] { display: none !important; }

/* ---- 3D primitives ---- */
.btn {
  font: inherit; color: var(--text); background: var(--face); cursor: pointer;
  border: 1px solid; border-color: var(--hi) var(--dark) var(--dark) var(--hi);
  box-shadow: inset -1px -1px 0 var(--shadow), inset 1px 1px 0 var(--face-light);
  padding: 3px 12px; min-height: 23px; border-radius: 0;
}
.btn:active { border-color: var(--dark) var(--hi) var(--hi) var(--dark); box-shadow: inset 1px 1px 0 var(--shadow); padding: 4px 11px 2px 13px; }
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.btn-icon { padding: 0 6px; min-width: 23px; }
input[type=text], input[type=number], input[type=search], input[type=password], input[type=email], select, textarea {
  font: 12px var(--font); color: var(--text); background: #fff; border-radius: 0;
  border: 1px solid; border-color: var(--shadow) var(--hi) var(--hi) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--face);
  padding: 3px 5px; min-height: 22px; width: 100%;
}
textarea { font-family: var(--mono); resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--select); outline-offset: 0; }
.invalid { background: #fff0f0 !important; outline: 1px solid var(--bad) !important; }
input[type=checkbox] { width: 13px; height: 13px; margin: 0; accent-color: #000; }
.field-ro { display: inline-block; background: #fff; padding: 1px 6px; border: 1px solid; border-color: var(--shadow) var(--hi) var(--hi) var(--shadow); }

/* ---- the application frame ---- */
.wb { min-height: 100%; display: flex; flex-direction: column; }
.wb-title {
  display: flex; align-items: center; gap: 6px; padding: 3px 6px; padding-top: calc(3px + env(safe-area-inset-top, 0px));
  color: #fff; font-weight: bold; background: linear-gradient(90deg, var(--title-a), var(--title-b));
}
.wb-title-icon { width: 14px; height: 14px; background: #fff; border: 2px solid #0a246a; box-shadow: inset 0 0 0 2px #c00; flex: none; }
.wb-title-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-toolbar { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-bottom: 1px solid var(--shadow); box-shadow: 0 1px 0 var(--hi); flex-wrap: wrap; }
.wb-session { margin-left: 8px; color: var(--muted); white-space: nowrap; }
.wb-session .field-ro { color: var(--text); }
.wb-find { margin-left: auto; width: 180px; }
.wb-menu-toggle { display: none; }
.wb-body { flex: 1; display: flex; min-height: 0; }

/* left: the vertical brand strip and the menu */
.wb-menu { flex: none; width: 210px; display: flex; border-right: 1px solid var(--shadow); box-shadow: 1px 0 0 var(--hi); }
.wb-brand {
  flex: none; width: 26px; background: linear-gradient(180deg, var(--strip), #5d6f92);
  color: #fff; font-weight: bold; font-size: 15px; letter-spacing: 2px;
  writing-mode: vertical-rl; transform: rotate(180deg); text-align: right; padding: 10px 0; text-shadow: 1px 1px 0 #33405a;
}
.wb-menu > ul { list-style: none; margin: 0; padding: 4px 0; flex: 1; }
.wb-menu li { position: relative; }
.wb-menu a, .sub-head { display: flex; align-items: center; gap: 6px; padding: 3px 8px; color: var(--text); text-decoration: none; cursor: default; white-space: nowrap; }
.wb-menu a { cursor: pointer; }
.wb-menu a:hover, .wb-menu a.on, .has-sub:hover > .sub-head, .has-sub:focus-within > .sub-head { background: var(--select); color: #fff; }
.has-sub > .sub-head::after { content: "\25B8"; margin-left: auto; font-size: 10px; }
.sub {
  display: none; list-style: none; margin: 0; padding: 2px; position: absolute; left: 100%; top: -3px; z-index: 20; min-width: 260px;
  background: var(--face); border: 1px solid; border-color: var(--hi) var(--dark) var(--dark) var(--hi); box-shadow: 2px 2px 0 #0003;
}
.has-sub:hover > .sub, .has-sub:focus-within > .sub { display: block; }
.sub a { padding: 3px 10px; }

/* menu icons: small flat squares, one colour per group */
.ico { width: 14px; height: 14px; flex: none; display: inline-block; border: 1px solid #0006; background: #9aa; }
.ico-home { background: #3a7bd5; } .ico-info { background: #ffcc00; border-radius: 50%; }
.ico-dasar { background: #6a9f3a; } .ico-pppoe-hotspot { background: #d98c1f; } .ico-bandwidth-queue { background: #8d4fc4; }
.ico-routing-failover { background: #2f8fa8; } .ico-firewall-keamanan { background: #c23b2a; } .ico-monitoring { background: #3a3a8c; }

/* right: the MDI area with windows */
.wb-mdi { flex: 1; min-width: 0; background: var(--mdi); padding: 10px; border-left: 1px solid var(--dark); display: flex; gap: 10px; align-items: flex-start; }
.mdi-main { flex: 1 1 auto; min-width: 0; max-width: 960px; display: flex; flex-direction: column; gap: 10px; }
/* the right column: next to the windows on wide screens, below them otherwise */
.mdi-side { flex: 0 0 372px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 1340px) {
  .wb-mdi { flex-direction: column; align-items: stretch; }
  .mdi-main { flex: none; }
  .mdi-side { flex: none; position: static; max-width: 960px; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
}
.wb-status {
  display: flex; gap: 0; border-top: 1px solid var(--hi); padding: 2px 2px calc(2px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap;
}
.wb-status > span { padding: 1px 8px; border: 1px solid; border-color: var(--shadow) var(--hi) var(--hi) var(--shadow); margin: 1px; color: var(--muted); }
.wb-status > span:nth-child(2) { flex: 1; }

/* ---- windows ---- */
.win {
  width: 100%; max-width: 960px; background: var(--face);
  border: 1px solid; border-color: var(--face-light) var(--dark) var(--dark) var(--face-light);
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--shadow), 3px 3px 0 #0002; padding: 3px;
}
.win-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 3px 2px 6px; min-height: 20px;
  color: #fff; font-weight: bold; background: linear-gradient(90deg, var(--title-a), var(--title-b));
}
.win:not(:first-child):not(.term-win) .win-title { background: linear-gradient(90deg, var(--title-in-a), var(--title-in-b)); color: #e8e8e8; }
.win-title > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-btns { display: flex; gap: 2px; flex: none; }
.win-btns > * {
  width: 16px; height: 14px; display: grid; place-items: center; font: bold 10px/1 var(--font); font-style: normal; color: #000; text-decoration: none;
  background: var(--face); border: 1px solid; border-color: var(--hi) var(--dark) var(--dark) var(--hi);
}
.win-body { padding: 8px; }
.win-status { display: flex; justify-content: space-between; gap: 8px; margin: 8px -8px -8px; padding: 2px; }
.win-status > span { padding: 1px 6px; border: 1px solid; border-color: var(--shadow) var(--hi) var(--hi) var(--shadow); flex: 1; }
.win-status > span:last-child { flex: none; }
#status.bad { color: var(--bad); }

.prose h1 { font-size: 15px; margin: 0 0 6px; }
.prose p { margin: 0 0 8px; max-width: 72ch; }
.warn { background: #ffffe1; border: 1px solid #000; padding: 4px 8px; }
.muted { color: var(--muted); }
.notes { margin: 0 0 8px; padding-left: 18px; max-width: 72ch; }
.notes li { margin-bottom: 4px; }

/* ---- the generator list (a Winbox list view) ---- */
.list-toolbar { display: flex; align-items: center; gap: 2px; margin-bottom: 4px; }
.tb-ico { width: 23px; height: 21px; display: inline-grid; place-items: center; font-weight: bold; font-size: 14px; color: #fff; border: 1px solid; border-color: var(--hi) var(--dark) var(--dark) var(--hi); background: var(--face); }
.tb-add { color: #1a3fbf; } .tb-del { color: #c00000; } .tb-ok { color: #138a13; } .tb-x { color: #c00000; }
.btn.tb-del { color: #c00000; font-weight: bold; }
.list-find { width: 180px !important; margin-left: auto; }
.list-wrap, .rows-scroll { overflow-x: auto; background: #fff; border: 1px solid; border-color: var(--shadow) var(--hi) var(--hi) var(--shadow); }
.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-weight: normal; background: var(--face); padding: 2px 6px; border: 1px solid; border-color: var(--hi) var(--shadow) var(--shadow) var(--hi); white-space: nowrap; }
.list td { padding: 2px 6px; vertical-align: top; }
.list tbody tr:not(.list-comment):hover { background: var(--select); color: #fff; }
.list tbody tr:not(.list-comment):hover a { color: #fff; }
.list a { color: inherit; text-decoration: none; }
.list-comment td { color: #888; padding-top: 4px; }
.num { color: var(--muted); width: 1%; text-align: right; }
.nowrap { white-space: nowrap; }

/* ---- generator dialog ---- */
.tabs { display: flex; gap: 0; margin-bottom: -1px; position: relative; z-index: 1; }
.tab {
  font: inherit; background: var(--face); padding: 2px 10px; cursor: pointer; margin-right: -1px;
  border: 1px solid; border-color: var(--hi) var(--dark) transparent var(--hi); border-bottom: 0; color: var(--text);
}
.tab.on { padding-bottom: 4px; margin-top: -2px; }
.badge { display: inline-block; background: var(--bad); color: #fff; font-size: 10px; padding: 0 4px; margin-left: 3px; }
.dialog { display: flex; gap: 10px; border: 1px solid; border-color: var(--hi) var(--dark) var(--dark) var(--hi); padding: 10px; }
.dialog-main { flex: 1; min-width: 0; }
.dialog-buttons { display: flex; flex-direction: column; gap: 5px; width: 120px; flex: none; }
.gen-summary { font-size: 12px; font-weight: normal; margin: 0 0 10px; color: var(--muted); }
.form .row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 8px; margin-bottom: 6px; align-items: start; }
.form .row > label { text-align: right; padding-top: 4px; }
.form .row-check > label { order: 2; text-align: left; padding-top: 0; }
.form .row-check > .ctl { order: 1; justify-self: end; padding-top: 1px; }
.form .row-check { grid-template-columns: 170px minmax(0, 1fr); }
.form .row-check > label { grid-column: 2; grid-row: 1; }
.form .row-check > .ctl { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; align-items: flex-end; }
.form .row-check .help, .form .row-check .err { display: none; }
.form .row-check:has(.help) { margin-bottom: 2px; }
.ctl { min-width: 0; }
.help { color: var(--muted); font-size: 11px; margin-top: 2px; }
.err { color: var(--bad); font-size: 11px; }
.err:empty { display: none; }
.rows-table { border-collapse: collapse; width: 100%; }
.rows-table th { font-weight: normal; text-align: left; background: var(--face); padding: 1px 4px; border: 1px solid; border-color: var(--hi) var(--shadow) var(--shadow) var(--hi); white-space: nowrap; }
.rows-table td { padding: 1px; min-width: 90px; }
.rows-table td.rows-del { min-width: 0; width: 1%; }
.rows-add { margin-top: 4px; }

/* ---- terminal ---- */
.term-win { max-width: 960px; }
.term { background: #000; color: #e6e6e6; padding: 8px 10px; max-height: 70vh; overflow: auto; border: 1px solid; border-color: var(--shadow) var(--hi) var(--hi) var(--shadow); }
.term pre { margin: 0; font: 13px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.term .c { color: #7f9f7f; }
.term .p { color: #6cb6ff; }
.term .k { color: #e5c07b; }
.term .a { color: #98c379; }
.term .s { color: #e0a060; }
.term .b { color: #c678dd; }
.term .prompt { color: #6cb6ff; }
.term .cursor { background: #e6e6e6; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { background: transparent; } }
.related { margin: 0; padding-left: 18px; }
.related li { margin-bottom: 3px; }

/* ---- narrow screens ---- */
@media (max-width: 760px) {
  .wb-menu-toggle { display: inline-block; }
  .wb-session { display: none; }
  .wb-find { width: 120px; }
  .wb-body { flex-direction: column; }
  .wb-menu { display: none; width: auto; border-right: 0; border-bottom: 1px solid var(--shadow); }
  .wb-menu.open { display: flex; }
  .wb-brand { writing-mode: horizontal-tb; transform: none; width: auto; display: none; }
  .sub { position: static; display: block; box-shadow: none; border: 0; padding: 0 0 2px 22px; min-width: 0; background: transparent; }
  .wb-menu a, .sub-head { white-space: normal; }
  .has-sub > .sub-head::after { content: ""; }
  .wb-mdi { padding: 8px; border-left: 0; }
  .dialog { flex-direction: column; padding: 8px; }
  .dialog-buttons { flex-direction: row; flex-wrap: wrap; width: auto; }
  .dialog-buttons .btn { flex: 1; }
  .form .row, .form .row-check { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .form .row > label { text-align: left; padding-top: 0; }
  .form .row-check { grid-template-columns: auto minmax(0, 1fr); gap: 6px; }
  .form .row-check > .ctl { grid-column: 1; }
  .hide-sm { display: none; }
  .wb-status > span { flex: 1 1 100%; }
}

/* wrong values: the list of what to fix, and buttons that cannot be used yet */
.term .e { color: #ff7b72; }
.btn:disabled { color: var(--shadow); text-shadow: 1px 1px 0 var(--hi); cursor: default; }
.btn:disabled:active { border-color: var(--hi) var(--dark) var(--dark) var(--hi); box-shadow: inset -1px -1px 0 var(--shadow), inset 1px 1px 0 var(--face-light); padding: 3px 12px; }

/* RouterOS versions: small tags in the list, and the filter next to Find */
.ros { display: inline-block; font-size: 11px; line-height: 14px; padding: 0 4px; margin-right: 3px; border: 1px solid #0005; color: #fff; }
.ros-v6 { background: #7a6a3a; }
.ros-v7 { background: #2f5fa8; }
.list tbody tr:not(.list-comment):hover .ros { border-color: #fff8; }
.list-ros { width: auto !important; margin-left: auto; }
.list-ros + .list-find { margin-left: 4px; }
.list-empty { margin: 6px 0 0; padding: 6px 8px; background: #fff; border: 1px solid var(--shadow); color: var(--muted); }
@media (max-width: 760px) { .list-toolbar { flex-wrap: wrap; } .list-ros { margin-left: 0; } .list-find { flex: 1; width: auto !important; } }

/* ---- Dukung Kami / Permintaan Script ---- */
.mdi-side .win .win-title { background: linear-gradient(90deg, var(--title-in-a), var(--title-in-b)); color: #e8e8e8; }
.side-lead { margin: 0 0 8px; }
.group { border: 1px solid var(--shadow); box-shadow: inset 1px 1px 0 var(--hi), 1px 1px 0 var(--hi); margin: 0 0 8px; padding: 4px 8px 8px; min-width: 0; }
.group legend { padding: 0 3px; }
.support { display: flex; gap: 10px; align-items: flex-start; }
.qr { flex: none; width: 92px; height: 92px; background: #fff; padding: 2px; border: 1px solid; border-color: var(--shadow) var(--hi) var(--hi) var(--shadow); image-rendering: pixelated; }
.support-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.btn-link { display: inline-block; text-decoration: none; color: var(--text); }
.copy-line { display: flex; gap: 3px; width: 100%; }
.copy-line input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11px; }
.copy-line .btn { padding: 2px 8px; }
.side-form { display: flex; flex-direction: column; gap: 3px; }
.side-form label { margin-top: 4px; }
.side-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px; }
.side-row label { display: block; margin-bottom: 3px; }
.side-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.side-actions .muted, .side-actions .ok, .side-actions .err { font-size: 11px; }
.ok { color: #0a6b0a; }
.ok-box { background: #e9f7e9; border: 1px solid #0a6b0a; padding: 4px 8px; margin: 0 0 8px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* language switch in the toolbar: two small buttons, the current one pressed */
.wb-lang { display: flex; gap: 0; margin-left: auto; }
.wb-lang .btn { padding: 1px 7px; min-height: 21px; text-decoration: none; font-size: 11px; display: inline-flex; align-items: center; }
.wb-lang .btn.on { border-color: var(--dark) var(--hi) var(--hi) var(--dark); box-shadow: inset 1px 1px 0 var(--shadow); background: var(--face-light); font-weight: bold; }
.wb-lang + .wb-find { margin-left: 6px; }

/* ---- admin ---- */
.wb-admin .wb-title { background: linear-gradient(90deg, #6b0000, #c08080); }
.win-narrow { max-width: 460px; }
.win-wide { max-width: 1200px; }
.wb-admin .mdi-main { max-width: 1200px; }
.menu-btn { display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 8px; font: inherit; color: var(--text); background: none; border: 0; cursor: pointer; text-align: left; }
.menu-btn:hover { background: var(--select); color: #fff; }
.err-box { background: #fff0f0; border: 1px solid var(--bad); color: var(--bad); padding: 4px 8px; margin: 0; }
.mdi-main > .ok-box { margin: 0; }
.form-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.group .form .row { grid-template-columns: 160px minmax(0, 1fr); }
.group > .muted { margin: 0 0 8px; }
.inline-form { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
.inline-form select { width: auto; }
.inline-check { display: inline-flex; gap: 4px; align-items: center; margin-top: 3px; font-size: 11px; }
.mono { font-family: var(--mono); font-size: 11px; }
.list-admin td { padding: 4px 6px; border-bottom: 1px solid #e4e4e4; }
.list-admin tbody tr:hover { background: #eef3fb !important; color: inherit !important; }
.req-text { white-space: pre-wrap; min-width: 220px; max-width: 460px; }
.st-baru td:first-child { box-shadow: inset 3px 0 0 #1a3fbf; }
.st-selesai, .st-diabaikan { color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 8px; }
