/* Nordwind ERP: a dense blue-grey business application. */

:root {
  --nw-nav: #1f3a52;
  --nw-nav-soft: #2c4a66;
  --nw-nav-line: #4a6782;
  --nw-nav-text: #c9d6e2;
  --nw-nav-active: #ffffff;
  --nw-accent: #2c6cb0;
  --nw-accent-bright: #5aa3e8;
  --nw-selected: #e8f0f9;
  --nw-alert: #d64545;
  --nw-on-accent: #ffffff;
  --nw-bg: #edf1f4;
  --nw-surface: #ffffff;
  --nw-head: #f4f6f8;
  --nw-line: #dde3e9;
  --nw-line-strong: #c3cdd6;
  --nw-text: #1c2b39;
  --nw-muted: #637485;
  --nw-link: #2c6cb0;
  --nw-focus: #cfe0f3;
  --nw-danger: #b42318;
  --nw-draft-bg: #fdf0d3;
  --nw-draft-text: #8a5b00;
  --nw-ok-bg: #dff3e6;
  --nw-ok-text: #1d6b3a;
  --nw-open-bg: #e3edf8;
  --nw-open-text: #24588f;
  --nw-overdue-bg: #fbe4e2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--nw-bg);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 18px;
  color: var(--nw-text);
}

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

a:hover {
  text-decoration: underline;
}

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

.icon {
  flex-shrink: 0;
}

.spacer {
  flex: 1;
}

.muted {
  color: var(--nw-muted);
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--nw-link);
  cursor: pointer;
}

.nw-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 42px;
  padding: 0 16px;
  background: var(--nw-nav);
  color: var(--nw-nav-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--nw-nav-active);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 18px;
  height: 18px;
  padding: 1px;
}

.brand-mark i {
  border-radius: 1px;
  background: var(--nw-nav-active);
}

.brand-mark i:nth-child(1),
.brand-mark i:nth-child(4) {
  background: var(--nw-accent-bright);
}

.company,
.user {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--nw-nav-line);
  border-radius: 3px;
  background: transparent;
  color: var(--nw-nav-active);
  font-size: 13px;
  cursor: pointer;
}

.user {
  border-color: transparent;
  padding: 0 4px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--nw-accent);
  font-size: 10.5px;
  font-weight: 600;
}

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 370px;
  height: 28px;
  margin-left: 10px;
  padding: 0 9px;
  border-radius: 3px;
  background: var(--nw-nav-soft);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--nw-nav-active);
  font-size: 12.5px;
}

.search input::placeholder {
  color: var(--nw-nav-text);
}

.search kbd {
  padding: 0 4px;
  border: 1px solid var(--nw-nav-line);
  border-radius: 2px;
  font-family: inherit;
  font-size: 11px;
  line-height: 15px;
}

.topbar-icon {
  position: relative;
  display: flex;
  color: var(--nw-nav-text);
}

.topbar-icon .badge {
  position: absolute;
  top: -6px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--nw-alert);
  color: var(--nw-nav-active);
  font-size: 10px;
  font-weight: 700;
}

/* Module bar and module menu */

.modules {
  display: flex;
  gap: 2px;
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--nw-line);
  background: var(--nw-surface);
}

.modules a {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  color: var(--nw-text);
  font-size: 13.5px;
}

.modules a:hover {
  text-decoration: none;
  color: var(--nw-accent);
}

.modules a.active {
  border-bottom-color: var(--nw-accent);
  color: var(--nw-accent);
  font-weight: 600;
}

.frame {
  display: flex;
  flex: 1;
}

.submenu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 172px;
  flex-shrink: 0;
  padding: 12px 7px;
  border-right: 1px solid var(--nw-line);
  background: var(--nw-surface);
}

.submenu-title {
  padding: 0 9px 5px;
  color: var(--nw-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.submenu a {
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 9px;
  border-radius: 2px;
  color: var(--nw-text);
}

.submenu a:hover {
  background: var(--nw-head);
  text-decoration: none;
}

.submenu a.active {
  background: var(--nw-selected);
  box-shadow: inset 2px 0 0 var(--nw-accent);
  color: var(--nw-accent);
  font-weight: 600;
}

/* Page */

.page {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  padding: 9px 16px 14px;
}

.record {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
}

.record-head {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--nw-muted);
  font-size: 12px;
}

.breadcrumb span:last-child {
  color: var(--nw-text);
}

.record-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.record-title h1 {
  margin: 0;
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
}

.status {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 2px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-draft {
  background: var(--nw-draft-bg);
  color: var(--nw-draft-text);
}

.status-validated {
  background: var(--nw-open-bg);
  color: var(--nw-open-text);
}

.status-paid {
  background: var(--nw-ok-bg);
  color: var(--nw-ok-text);
}

.status-overdue {
  background: var(--nw-overdue-bg);
  color: var(--nw-danger);
}

.overdue {
  color: var(--nw-danger);
  font-weight: 600;
}

.pager {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--nw-muted);
  font-size: 12.5px;
}

.pager a,
.pager .disabled {
  display: flex;
  color: var(--nw-muted);
}

.pager .disabled {
  opacity: 0.4;
}

.actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--nw-line-strong);
  border-radius: 3px;
  background: var(--nw-surface);
  color: var(--nw-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  background: var(--nw-head);
  text-decoration: none;
}

.button.primary {
  border-color: var(--nw-accent);
  background: var(--nw-accent);
  color: var(--nw-on-accent);
}

.button.primary:hover {
  background: #255d99;
}

.readonly-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 6px;
  color: var(--nw-muted);
  font-size: 12.5px;
}

.menu {
  position: relative;
}

.menu summary {
  list-style: none;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu-items {
  position: absolute;
  z-index: 10;
  top: 32px;
  left: 0;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 4px 0;
  border: 1px solid var(--nw-line-strong);
  border-radius: 3px;
  background: var(--nw-surface);
  box-shadow: 0 6px 20px rgb(28 43 57 / 0.15);
}

.menu-items button {
  padding: 6px 12px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.menu-items button:hover:not(:disabled) {
  background: var(--nw-head);
}

.menu-items button:disabled {
  color: var(--nw-muted);
  cursor: default;
}

.menu-items .danger {
  color: var(--nw-danger);
}

.notice {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid #b8dcc4;
  border-radius: 3px;
  background: var(--nw-ok-bg);
  color: var(--nw-ok-text);
  transition: opacity 0.6s;
}

.notice.error {
  border-color: #f0bdb7;
  background: var(--nw-overdue-bg);
  color: var(--nw-danger);
}

.notice.fade {
  opacity: 0;
}

/* Panels, tabs and field groups */

.panel {
  border: 1px solid var(--nw-line);
  border-radius: 3px;
  background: var(--nw-surface);
}

.tabs {
  display: flex;
  align-items: stretch;
  gap: 16px;
  height: 34px;
  padding: 0 14px;
  border-bottom: 1px solid var(--nw-line);
}

.tabs a,
.tabs > span {
  display: flex;
  align-items: center;
  gap: 5px;
  border-bottom: 2px solid transparent;
  color: var(--nw-muted);
  font-size: 13px;
}

.tabs a:hover {
  color: var(--nw-text);
  text-decoration: none;
}

.tabs a.active {
  border-bottom-color: var(--nw-accent);
  color: var(--nw-text);
  font-weight: 600;
}

.tabs .count {
  padding: 0 6px;
  border-radius: 9px;
  background: var(--nw-head);
  color: var(--nw-muted);
  font-size: 11px;
  font-weight: 400;
}

.tabs.inline {
  height: 36px;
  padding: 0;
  border: 0;
}

.groups {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 0 22px;
  padding: 12px 14px 14px;
}

.group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.group legend,
.group .legend {
  float: left;
  width: 100%;
  margin-bottom: 4px;
  padding: 0 0 4px;
  border-bottom: 1px solid var(--nw-line);
  color: var(--nw-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: start;
  gap: 9px;
  clear: both;
}

.field label {
  padding-top: 5px;
  color: var(--nw-muted);
  font-size: 12.5px;
}

.control {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  min-width: 0;
  padding: 0 6px 0 7px;
  border: 1px solid var(--nw-line-strong);
  border-radius: 2px;
  background: var(--nw-surface);
  color: var(--nw-text);
  font-size: 13px;
}

.box .icon {
  color: var(--nw-muted);
}

.box input,
.box select {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.box select {
  appearance: none;
  cursor: pointer;
}

.box.select .icon {
  position: absolute;
  right: 6px;
  pointer-events: none;
}

.box:focus-within {
  border-color: var(--nw-accent);
  box-shadow: 0 0 0 2px var(--nw-focus);
}

.lookup {
  color: var(--nw-text);
}

.lookup:hover {
  text-decoration: none;
  border-color: var(--nw-accent);
}

.lookup .value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lookup .hint {
  color: var(--nw-muted);
  font-size: 12px;
}

fieldset:disabled .box {
  background: var(--nw-head);
}

fieldset:disabled select {
  cursor: default;
}

.text {
  display: flex;
  flex-direction: column;
  padding-top: 5px;
  font-size: 13px;
}

.text .inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.text.strong {
  font-weight: 600;
}

.field.invalid .box {
  border-color: var(--nw-danger);
}

.field-error {
  padding-top: 3px;
  color: var(--nw-danger);
  font-size: 12px;
}

.notes {
  padding: 14px;
}

.notes textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--nw-line-strong);
  border-radius: 2px;
}

.empty {
  padding: 18px 14px;
  color: var(--nw-muted);
}

.empty-state {
  padding: 28px;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.empty-state p {
  margin: 0 0 6px;
  color: var(--nw-muted);
}

/* Tables */

.lines {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border-bottom: 1px solid var(--nw-line);
}

.panel-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
}

.panel-head .link {
  font-size: 12.5px;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.grid th {
  padding: 6px 9px;
  background: var(--nw-head);
  color: var(--nw-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.grid td {
  padding: 5px 9px;
  border-top: 1px solid var(--nw-line);
  white-space: nowrap;
}

.grid th:first-child,
.grid td:first-child {
  padding-left: 14px;
}

.grid th:last-child,
.grid td:last-child {
  padding-right: 14px;
}

.grid tbody tr:hover {
  background: #f8fafb;
}

.grid .num {
  text-align: right;
}

.grid .ref {
  color: var(--nw-muted);
  font-size: 12px;
}

.lines .grid td.ref {
  color: var(--nw-link);
}

.lines .grid th:nth-child(3) {
  width: 46%;
}

.grid a.plain {
  color: var(--nw-text);
}

.totals {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding: 10px 14px;
  border-top: 1px solid var(--nw-line);
}

.totals dl {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 300px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.totals dl div {
  display: flex;
  justify-content: space-between;
  color: var(--nw-muted);
}

.totals dd {
  margin: 0;
  color: var(--nw-text);
}

.totals .strong {
  color: var(--nw-text);
  font-size: 13.5px;
  font-weight: 600;
}

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--nw-line);
}

.list-search .box {
  width: 280px;
}

.list-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--nw-line);
  color: var(--nw-muted);
}

/* Credit notes */

.menu-items .menu-link {
  padding: 6px 12px;
  color: var(--nw-text);
}

.menu-items .menu-link:hover {
  background: var(--nw-head);
  text-decoration: none;
}

.related {
  color: var(--nw-muted);
  font-size: 12.5px;
}

.totals table.compare {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.totals table.compare th,
.totals table.compare td {
  padding: 1px 0 1px 24px;
  color: var(--nw-muted);
  font-weight: 400;
  text-align: left;
}

.totals table.compare td {
  color: var(--nw-text);
  text-align: right;
}

.totals table.compare thead th {
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  text-transform: uppercase;
}

.totals table.compare .strong th,
.totals table.compare .strong td {
  color: var(--nw-text);
  font-size: 13.5px;
  font-weight: 600;
}

.box.qty {
  width: 90px;
  margin-left: auto;
}

.box.qty input {
  text-align: right;
}

td.invalid .box {
  border-color: var(--nw-danger);
}

/* Status bar */

.statusbar {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 28px;
  padding: 0 16px;
  border-top: 1px solid var(--nw-line);
  background: var(--nw-head);
  color: var(--nw-muted);
  font-size: 12px;
}

@media print {
  .topbar,
  .modules,
  .submenu,
  .actions,
  .tabs,
  .statusbar {
    display: none;
  }

  body {
    background: #fff;
  }
}
