/* main.css - CNS Dashboard */
/* Copyright 2025 Padi, Inc. All Rights Reserved. */

@charset "utf-8";

@font-face {
  font-family: "font";
  src: url("font.ttf");
}

@font-face {
  font-family: "icons";
  src: url("icons.ttf");
}

/* Theme */

:root {
  --font: "font";
  --icons: "icons";
  --screen: #f0f0f0;
  --title: #f8f8f8;
  --panel: #ffffff;
  --border: #e0e0e0;
  --header: #888888;
  --text: #202020;
  --tip: #ffffff;
  --button: #888888;
  --focus: #0d2192;
  --hover: #f4f4f4;
  --hilight: #0d2192;
  --lolight: #f8f8f8;
  --warning: #edc837;
  --error: #af0606;
}

body[theme="dark"] {
  --screen: #303030;
  --title: #212121;
  --panel: #424242;
  --border: #595959;
  --header: #a0a0a0;
  --text: #ffffff;
  --tip: #ffffff;
  --button: #a0a0a0;
  --focus: #2196f3;
  --hover: #505050;
  --hilight: #ffffff;
  --lolight: #393939;
  --warning: #ffd634;
  --error: #ed4337;
}

/* Style */

html {
  height: 100%;
}

body {
  font-family: var(--font);
  font-weight: 400;
  overscroll-behavior: none;
  background-color: var(--screen);
  color: var(--text);
  margin: 0;
  height: 100%;
  user-select: none;
}

h1 {
  font-size: 24px;
  font-weight: 400;
  margin: 0 0 16px 0;
}

h2 {
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 16px 0;
}

h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

h4 {
  font-size: 17px;
  font-weight: 400;
  margin: 0 0 12px 0;
}

p {
  font-size: 14px;
  line-height: 24px;
  margin: 0 0 16px 0;
}

a {
  text-decoration: none;
  color: var(--focus);
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

i {
  font-family: var(--icons);
  font-size: 24px;
  font-style: normal;
  vertical-align: middle;
}

pre {
  margin: 0;
}

mark {
  font-size: 14px;
  display: inline-block;
  white-space: nowrap;
  background-color: var(--button);
  color: var(--panel);
  border-radius: 16px;
  padding: 0 16px;
  margin: 2px 0;
  line-height: 32px;
}

mark i {
  margin: 0 8px 0 -8px;
}

ol,
ul {
  margin: 0;
  padding: 0 28px;
}

li {
  font-size: 14px;
  line-height: 24px;
  padding-left: 10px;
}

/* Button */

button {
  font-family: var(--font);
  font-size: 14px;
  white-space: nowrap;
  align-items: center;
  text-transform: uppercase;
  background-color: transparent;
  color: var(--button);
  border: none;
  border-radius: 2px;
  padding: 4px 16px;
  line-height: 32px;
}

button:has(menu) {
  position: relative;
}

button i {
  text-transform: none;
}

button[icon] {
  border-radius: 50%;
  padding: 6px;
  line-height: 20px;
  width: 36px;
  height: 36px;
}

button:not([icon]) i {
  margin: 0 8px 0 -8px;
}

button:hover,
button:focus-visible {
  background-color: var(--hover);
  cursor: pointer;
}

button+button {
  margin-left: 8px;
}

h1 button {
  float: right;
}

/* Input label */

label {
  font-size: 12px;
  display: block;
  white-space: nowrap;
  color: var(--header);
  line-height: 16px;
  margin: 1px 0 3px 0;
}

label:has(input[type="checkbox"]),
label:has(input[type="radio"]) {
  font-size: 15px;
}

/* Input */

input {
  padding: 0;
  margin: 0;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"] {
  font-family: var(--font);
  font-size: 15px;
  background-color: transparent;
  color: var(--text);
  border: none;
  border-bottom: 2px solid var(--border);
  line-height: 21px;
  margin: 0 0 16px 0;
  padding: 0 0 2px 0;
  width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus {
  border-color: var(--focus);
}

input[type="text"]:invalid,
input[type="number"]:invalid,
input[type="password"]:invalid,
input[type="email"]:invalid,
input[type="url"]:invalid {
  border-color: var(--error);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  appearance: textfield;
}

input[type="checkbox"],
input[type="radio"] {
  margin: 8px 8px 8px 0;
  width: 0.875rem;
  height: 0.875rem;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: auto;
  outline-color: var(--focus);
}

/* Text area */

textarea {
  font-family: var(--font);
  font-size: 15px;
  resize: vertical;
  background-color: transparent;
  color: var(--text);
  border: none;
  border-bottom: 2px solid var(--border);
  line-height: 20px;
  max-height: 300px;
  min-height: 20px;
  margin: 0 0 16px 0;
  padding: 0 0 2px 0;
  width: 100%;
}

textarea:focus {
  border-color: var(--focus);
}

textarea:invalid {
  border-color: var(--error);
}

/* Drop down list */

select {
  font-family: var(--font);
  font-size: 15px;
  appearance: none;
  background: url('data:image/svg+xml;utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path d="M7 10 l7 7 7 -7 z" fill="grey"/></svg>') 100% 50% no-repeat;
  color: var(--text);
  border: none;
  border-bottom: 2px solid var(--border);
  padding: 0 0 2px 0;
  margin: 0 0 16px 0;
  width: 100%;
}

select:empty {
  pointer-events: none;
}

select:focus {
  border-color: var(--focus);
}

select:invalid {
  border-color: var(--error);
}

/* Main */

main {
  display: flex;
  flex-direction: column;
  height: 100%;
}

header {
  font-size: 28px;
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  align-items: center;
  position: relative;
  box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 5px 8px 0 rgba(0, 0, 0, 0.14), 0 1px 14px 0 rgba(0, 0, 0, 0.12);
  background-color: var(--title);
  padding: 0 16px;
  height: 64px;
}

header > i {
  font-size: 32px;
  color: var(--hilight);
  margin-right: 16px;
}

header > div {
  font-size: 16px;
  flex-grow: 1;
  text-align: right;
  margin-left: 16px;
}

footer {
  font-size: 14px;
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  align-items: center;
  position: relative;
  box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 5px 8px 0 rgba(0, 0, 0, 0.14), 0 1px 14px 0 rgba(0, 0, 0, 0.12);
  background-color: var(--title);
  padding: 0 16px;
  height: 32px;
}

footer > div {
  text-align: right;
  margin-left: 16px;
  flex-grow: 1;
}

article {
  display: flex;
  flex-direction: row;
  overflow: hidden;
  height: 100%;
}

section {
  display: flex;
  flex-direction: column;
  overflow: scroll;
  box-sizing: border-box;
  width: 100%;
  padding: 40px 64px;
  min-width: 600px;
}

aside {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: scroll;
  background-color: var(--panel);
  box-sizing: border-box;
  box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
  margin-bottom: 16px;
}

aside > form {
  padding: 16px 20px 22px 20px;
}

aside > div,
aside > pre {
  padding: 20px;
}

aside > div p:last-of-type {
  margin-bottom: 0;
}

aside:empty {
  display: none;
}

/* Spinner */

center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

sub {
  height: 77px;
}

sub::before {
  content: "";
  display: inline-block;
  border: 8px solid var(--button);
  border-top: 8px solid var(--screen);
  border-radius: 50%;
  width: 60px;
  height: 60px;
}

/* Navigation */

nav {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: scroll;
  background-color: var(--panel);
  box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
}

nav button {
  display: flex;
  text-transform: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
  margin: 0;
  line-height: 55px;
}

nav button i {
  font-size: 24px;
  padding: 0 16px;
  margin: 0 !important;
  width: 32px;
}

nav button span {
  font-size: 18px;
  white-space: nowrap;
  text-align: left;
  width: 180px;
}

nav div {
  flex-grow: 1;
  background-color: var(--lolight);
  border-bottom: 1px solid var(--border);
  min-height: 10px;
}

nav[list="collapse"] button span {
  display: none;
}

nav button:last-child {
  border-bottom: 1px solid transparent;
}

/* Table */

table {
  border-spacing: 0;
  width: 100%;
}

table caption {
  font-size: 12px;
  color: var(--header);
  box-sizing: border-box;
  text-align: left;
  text-indent: 20px;
  white-space: nowrap;
  caption-side: bottom;
  line-height: 49px;
  border-top: 1px solid var(--border);
  height: 50px;
}

table tr {
  height: 50px;
}

table th {
  font-size: 12px;
  font-weight: 400;
  color: var(--header);
  box-sizing: border-box;
  white-space: nowrap;
  text-align: left;
  padding: 0 20px;
}

table td {
  font-size: 14px;
  box-sizing: border-box;
  white-space: nowrap;
  border-top: 1px solid var(--border);
  padding: 4px 20px;
}

table th:first-child:has(> i),
table td:first-child:has(> i) {
  color: var(--header);
  text-align: center;
  padding-right: 0;
}

table th:first-child > i,
table td:first-child > i {
  padding: 6px;
}

table th:last-child:empty,
table th:last-child:has(> button[icon]) {
  text-align: right;
  width: 100%;
}

table td:first-child:has(> button[icon]) {
  padding-right: 0;
}

table td:last-child:has(> button[icon]) {
  text-align: right;
}

table tr[expand]:empty {
  display: none;
}

table tr[expand] > td {
  padding: 0;
}

table tr[expand] > td:nth-child(1) {
  background-color: var(--lolight);
}

table tr[expand] > td:nth-child(2) > form,
table tr[expand] > td:nth-child(2) > table > tbody > tr:not([expand]) > th:first-child,
table tr[expand] > td:nth-child(2) > table > tbody > tr:not([expand]) > td:first-child,
table tr[expand] > td:nth-child(2) > table > caption {
  border-left: 1px solid var(--border);
}

table form {
  white-space: wrap;
  padding: 12px 20px 0 20px;
}

table form input,
table form textarea,
table form select {
  font-size: 14px !important;
}

/* Data list */

dl {
  display: flex;
  flex-flow: row wrap;
  border-top: 1px solid var(--border);
  gap: 20px;
  margin: 0;
  padding: 20px;
}

dd {
  display: flex;
  position: relative;
  overflow: hidden;
  flex-direction: column;
  flex: 1 1 auto;
  background-color: var(--lolight);
  border-radius: 2px;
  border-bottom: 2px solid var(--border);
  margin: 0;
  padding: 10px 15px;
  min-width: 176px;
  max-width: 176px;
  box-shadow: rgba(0, 0, 0, 0.12) 0 1px 3px, rgba(0, 0, 0, 0.24) 0 1px 2px;
}

dd:hover {
  background-color: var(--hover);
  cursor: pointer;
}

dd button {
  position: absolute;
  color: var(--header) !important;
  top: 2px;
  right: 4px;
}

dd button i {
  font-size: 18px;
}

dd button:hover,
dd button:focus-visible {
  background-color: transparent;
  color: var(--hilight) !important;
}

dd h1 {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--header);
  margin: 0;
  padding-right: 25px;
  height: 20px;
}

dd h2 {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--header);
  margin: 0;
  height: 16px;
}

dd p {
  align-content: center;
  margin: 10px 0;
  height: 60px;
}

dd[data-type="value"] p {
  font-size: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

dd[data-type="text"] p {
  font-size: 14px;
  overflow: scroll;
  line-height: 20px;
}

/* Popup menu */

menu {
  position: absolute;
  background-color: #e4e3e3;
  border: 1px solid #c9c9c9;
  border-radius: 6px;
  box-shadow: 2px 2px 10px #c0c0c0;
  padding: 5px;
  top: 22px;
  right: 0;
  cursor: default;
  z-index: 100;
}

menu:before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

menu li {
  list-style: none;
  text-align: left;
}

menu li a {
  font-size: 14px;
  display: block;
  text-transform: none;
  text-decoration: none;
  color: #222222;
  border-radius: 4px;
  padding: 5px 10px 4px 10px;
}

menu li a:hover,
menu li a:focus-visible {
  background-color: #509cfe;
  color: white;
}

menu hr {
  border-top: 1px solid #cac9c9;
  margin: 6px 10px;
}

/* Form */

form {
}

form input:has(+button[icon]),
form select:has(+button[icon]) {
  margin-right: 8px;
  width: calc(100% - 50px);
}

form input + button[icon],
form select + button[icon] {
  float: right;
  bottom: 2px;
}

/* Dialog */

dialog {
  background: var(--panel);
  color: var(--text);
  border: none;
  box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
  padding: 0;
  min-width: 400px;
  user-select: none;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.35);
}

dialog h1 {
  background-color: var(--title);
  text-align: center;
  margin: 0;
  padding: 10px 64px;
}

dialog h1 button[icon] {
  position: absolute;
  top: 8px;
  right: 10px;
  margin: 0;
}

dialog form {
  margin: 20px;
}

dialog h4 {
  text-align: center;
  margin: 16px 0;
}

dialog p {
  text-align: center;
}

dialog > form > button {
  margin-top: 16px;
  width: 120px;
}

dialog > form > button:last-of-type {
  float: right;
  margin-bottom: 16px;
}

/* Attributes */

* {
  outline: none;
}

main table td:not(:has(label)):not(:has(i)),
main pre {
  user-select: text;
}

::placeholder {
  color: var(--button);
}

[hidden] {
  display: none;
}

[selected] {
  color: var(--hilight);
}

[raised]:not(:active) {
  box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

[primary] {
  color: var(--hilight);
}

[secondary] {
  color: var(--button);
}

[capitalize] {
  text-transform: capitalize;
}

[warning] {
  color: var(--warning);
}

[error] {
  color: var(--error);
}

[readonly] {
  color: var(--header) !important;
  border-color: var(--border) !important;
}

[disabled] {
  color: var(--border) !important;
  pointer-events: none;
}

/* Offline */

[offline] {
  font-size: 14px;
  flex-direction: row;
  align-items: center;
  background-color: var(--error);
  color: white;
  padding: 0 26px;
  line-height: 48px;
  height: 50px;
  width: 100%;
}

[offline] i {
  margin-right: 26px;
}

/* Tooltip */

[data-tip] {
  position: relative;
}

[data-tip]:before {
  content: attr(data-tip);
  font-size: 12px;
  font-weight: 600;
  position: absolute;
  background: var(--focus);
  color: var(--tip);
  box-sizing: border-box;
  text-align: center;
  text-transform: none;
  white-space: nowrap;
  border-radius: 4px;
  box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

[data-tip]:hover:before {
  transition-delay: 0.8s;
  opacity: 1;
}

[data-pos="top"]:before {
  left: 50%;
  transform: translate(-50%, -140%);
}

[data-pos="left"]:before {
  right: 120%;
  transform: translate(0, -15%);
}

[data-pos="bottom"]:before {
  left: 50%;
  transform: translate(-50%, 120%);
}

[data-pos="right"]:before {
  left: 120%;
  transform: translate(0, -15%);
}

/* Animation */

[ripple] {
  background-image: radial-gradient(circle, transparent 1%, var(--border) 1%);
  background-size: 15000%;
  background-position: center;
  transition: opacity 0.2s ease, background-color 0.5s ease, background-size 0.5s ease;
}

[ripple]:active {
  background-color: var(--border);
  background-size: 50%;
  transition: opacity 0.2s ease, background-color 0.15s ease, background-size 0.15s ease;
}

[fadein] {
  animation: 2s ease 0s normal forwards 1 fadein;
}

[spin] {
  animation: 1.2s linear infinite spin;
}

[data-tip]:before {
  transition: opacity 0.2s ease;
}

dd,
button {
  transition: background-color 0.2s ease;
}

dd button {
  transition: color 0.2s ease;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea {
  transition: border-color 0.2s ease;
}

article:not([hidden]) sub::before {
  animation: 2s ease 0s normal forwards 1 fadein, 1.2s linear infinite spin;
}

@keyframes fadein {
  0% {opacity: 0;}
  80% {opacity: 0;}
  100% {opacity: 1;}
}

@keyframes spin {
  0% {transform: rotate(0deg);}
  100% {transform: rotate(360deg);}
}
