:root {
  --space-default: 0.65rem;
}

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

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  background-color: #1e2734;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

header {
  border-bottom: 1px solid #64758a;
  background-color: #2d3748;
  display: flex;
  padding: var(--space-default);
}

header img {
  cursor: pointer;
}

header button {
  border: 1px solid #64758a;
  background-color: transparent;
  color: #e2e8f0;
  font-size: 1.5rem;
  display: none; /* flex */
  padding: 0 var(--space-default);
  margin-left: auto;
}

@media (hover: hover) and (pointer: fine) {
  header button:hover {
    background-color: #4a5568;
  }
}

main {
  flex: 0 0 auto;
  padding: var(--space-default);
}

footer {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 0 var(--space-default);
  margin-bottom: var(--space-default);
}

hr {
  border: none;
  border-top: 1px solid #64758a;
  margin: var(--space-default) 0;
}

p {
  margin: var(--space-default) 0;
}

input {
  border: none;
  border-radius: 4px;
  background-color: #fff;
  color: #1e2734;
  font-size: 1rem;
  transition: all 0.3s;
  width: auto;
  min-width: 0;
  padding: var(--space-default);
}

button {
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: bold;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus {
  outline: 2px solid #64758a;
}

@media (hover: hover) and (pointer: fine) {
  button:hover {
    opacity: 0.9;
  }
}

button:disabled {
  cursor: not-allowed;
}

button:disabled::after {
  cursor: pointer;
}

table, li {
  user-select: none;
  -webkit-user-select: none;
}

li #filter-date {
  position: fixed;
  opacity: 0;
  width: 1px;
  height: 1px;
}

dialog {
  border: 1px solid #64758a;
  border-radius: 8px;
  background-color: #1e2734;
  color: inherit;
  min-width: 100%;
  text-align: center;
  gap: var(--space-default);
  padding: var(--space-default);
  margin: var(--space-default) auto;
}

dialog p {
  max-height: 12rem;
  overflow: hidden;
  white-space: pre-line;
  padding-bottom: 0.25rem;
}

dialog button {
  min-width: 120px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.submit-button {
  transition: background 0.3s;
  background-color: #4caf50;
  color: #fff;
  padding: var(--space-default);
}

.normal-button {
  transition: background 0.3s;
  background-color: #4a5568;
  color: #fff;
  padding: var(--space-default);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-default);
  text-align: left;
}

.form-columns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--space-default);
}

#options-menu {
  display: none; /* grid */
  width: 100%;
}

#options-menu > li {
  border: 1px solid #64758a;
  background-color: #2d3748;
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: var(--space-default);
  padding: var(--space-default);
  margin-right: -1px;
  margin-bottom: -1px;
}

#options-menu > li:focus {
  background-color: #4a5568;
  outline: 2px solid #64758a;
  outline-offset: -2px;
}

#options-menu > li .ti {
  font-size: 1.5rem;
}

#login-form, #customer-form, #item-form, #order-form {
  display: none; /* flex */
  flex-direction: column;
  gap: var(--space-default);
}

#item-form {
  margin-top: 0.25rem;
}

#login-form label, #customer-form label, #prompt-form label {
  display: flex;
  flex-direction: column;
  gap: var(--space-default);
}

#user-list, #customer-list, #category-list, #item-list,
#browser-list, #viewer-list, #order-list {
  display: none; /* block */
  border-top: 1px solid #64758a;
  border-right: 1px solid #64758a;
  overflow-y: auto;
  margin-bottom: 0.25rem;
}

#user-table, #customer-table, #category-table { 
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: 100%;
}

#user-table thead, #customer-table thead, #category-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

#user-table thead tr, #customer-table thead tr, #category-table thead tr {
  background-color: #2d3748;
}

#user-table tbody tr, #customer-table tbody tr, #category-table tbody tr {
  cursor: pointer;
}

#user-table tbody tr:focus,
#customer-table tbody tr:focus,
#category-table tbody tr:focus {
  background-color: #4a5568;
  outline: none;
}

#user-table th, #customer-table th, #category-table th ,
#user-table td, #customer-table td, #category-table td {
  border-left: 1px solid #64758a;
  border-bottom: 1px solid #64758a;
  padding: 0.35rem;
}

#user-table th:first-child, #user-table td:first-child,
#customer-table th:first-child, #customer-table td:first-child,
#category-table th:first-child, #category-table td:first-child {
  text-align: center;
  width: 20%;
}

#user-table th:nth-child(2), #user-table td:nth-child(2),
#customer-table th:nth-child(2), #customer-table td:nth-child(2),
#category-table th:nth-child(2), #category-table td:nth-child(2) {
  text-align: left;
  width: auto;
}

#order-category, #order-seller, #order-rate, #order-customer {
  border: 1px solid #64758a;
  border-radius: 4px;
  background-color: #2d3748;
  padding: 0.15rem 0.35rem;
}

#order-rate {
  cursor: default;
}

#order-category:active, #order-seller:active, #order-customer:active {
  outline: 2px solid #64758a;
}

#order-customer {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

#order-properties {
  display: flex;
  gap: 0.35rem;
}

#order-item-properties {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  column-gap: 0.15rem;
  align-items: center;
}

#order-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  align-self: center;
}

#order-item-icon:empty {
  display: none;
}

#order-item-name {
  white-space: nowrap;
}

#order-item-meta {
  display: grid;
  grid-template-columns: auto auto;
  row-gap: 0.15rem;
  column-gap: 0.35rem;
  font-size: 0.75rem;
  line-height: 1;
  justify-self: end;
}

#order-item-meta span:nth-child(2n) {
  text-align: right;
}

#order-inputs {
  display: grid;
  grid-template-columns: 1.75fr 1fr 1fr 1.25fr;
  gap: var(--space-default);
}

#order-inputs input {
  padding: 0.50rem;
}

#order-inputs input::placeholder {
  text-align: center;
}

#order-inputs input:focus, #order-inputs input.active {
  outline: auto;
  background-color: #fff7b2;
}

#order-table, #browser-table, #viewer-table, #item-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.85rem;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

#order-table thead, #viewer-table thead , #item-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

#order-table thead tr, #viewer-table thead tr, #item-table thead tr {
  background-color: #2d3748;
}

#order-table tbody tr, #item-table tbody tr {
  cursor: pointer;
}

#browser-table tbody tr {
  background-color: #2d3748;
  cursor: pointer;
}

#order-table tr.selected, #browser-table tr.selected, #item-table tr.selected {
  background-color: #4a5568;
}

#order-table th, #browser-table th, #viewer-table th, #item-table th,
#order-table td, #browser-table td, #viewer-table td, #item-table td {
  border-left: 1px solid #64758a;
  border-bottom: 1px solid #64758a;
  padding: 0.25rem;
}

#order-table th:nth-child(1), #viewer-table th:nth-child(1), #item-table th:nth-child(1),
#order-table td:nth-child(1), #viewer-table td:nth-child(1), #item-table td:nth-child(1) {
  text-align: center;
  width: 15%;
}

#order-table th:nth-child(2), #viewer-table th:nth-child(2), #item-table th:nth-child(2),
#order-table td:nth-child(2), #viewer-table td:nth-child(2), #item-table td:nth-child(2) {
  text-align: left;
  width: auto;
}

#order-table th:nth-child(3), #order-table th:nth-child(4), #order-table th:nth-child(5),
#viewer-table th:nth-child(3), #viewer-table th:nth-child(4), #viewer-table th:nth-child(5) {
  width: 10%;
}

#order-table td:nth-child(3), #order-table td:nth-child(4), #order-table td:nth-child(5),
#viewer-table td:nth-child(3), #viewer-table td:nth-child(4), #viewer-table td:nth-child(5) {
  text-align: right;
  width: 10%;
}

#item-table th:nth-child(3) {
  width: 15%;
}

#item-table td:nth-child(3) {
  text-align: right;
  width: 15%;
}

#order-keypad, .browser-toolbar {
  display: none; /* grid */
  flex-direction: column;
  width: 100%;
  gap: var(--space-default);
  margin-top: auto;
}

#order-keypad button, .browser-toolbar button {
  border: 1px solid #64758a;
  background-color: #4a5568;
  color: #e2e8f0;
  font-size: 1.5rem;
  padding: 0.30rem;
}

#order-keypad button:focus:not(:active),
.browser-toolbar button:focus:not(:active) {
  outline: none;
}

#order-keypad button:active,
.browser-toolbar button:active {
  outline: 2px solid #64758a;
}

#order-keypad3 div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

#order-keypad3 div button {
  font-size: 1.25rem;
}

#order-keypad4 button:last-child {
  background-color: #4caf50;
}

#order-keypad5 button:not(:last-child) {
  border-radius: 50%;
  background-color: #2d3748;
}

#order-keypad6 {
  display: none; /* grid */
}

#customer-cancel, #order-cancel {
  display: none; /* flex */
  margin-top: 0.25rem;
}

#customer-cancel button, #order-cancel button {
  flex: 1;
}

#order-image {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: black;
}

[role="heading"][aria-level="5"] {
  font-size: 1rem;
  font-weight: 700;
}

[role="button"] {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 1065px) {
  body {
    border-left: 1px solid #64758a;
    border-right: 1px solid #64758a;
    border-bottom: 1px solid #64758a;
    width: 480px;
    margin: 0 auto;
  }

  dialog {
    min-width: 360px;
  }
}

@media (hover: none) {
  * {
    transition: none !important;
    touch-action: manipulation;
  }
}

