:root {
  --header-bar-height: 0px;
  --sticky-seam-overlap: 3px;
  --table-font-size: 13px;
  --input-font-size: 13px;
  --input-padding: 6px;
  --box-padding: 10px;
  --row-min: 220px;
  --row-gap: 8px;
}

body {
  font-family: sans-serif;
  margin: 20px;
  background: #f7f7f8;
}

.app-header {
  margin: -20px -20px 12px -20px;
  padding-top: var(--header-bar-height, 48px);
}

.app-header h1 {
  margin: 12px 20px 0;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0;
  padding: 0 10px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.header-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px 4px 2px;
  border-radius: 4px;
}

.header-logo-link:hover {
  background: #f3f3f3;
}

.header-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

.header-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.header-nav a {
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
  border-radius: 4px;
  padding: 10px 8px;
}

.header-nav a:hover {
  background: #f3f3f3;
  text-decoration: none;
}

.header-user {
  margin-left: auto;
  white-space: nowrap;
  padding: 10px 0;
}

.has-submenu {
  position: relative;
  display: inline-block;
}

.has-submenu .submenu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 260px;
  background: #fff;
  border: 1px solid #ddd;
  border-top: 1px solid #ddd;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.06);
  padding: 6px;
  z-index: 10;
}

.has-submenu:hover .submenu {
  display: block;
}

.has-submenu .submenu a {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
}

.has-submenu .submenu a:hover {
  background: #f3f3f3;
  text-decoration: none;
}

.app-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.app-table th,
.app-table td {
  border-right: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  padding: 8px;
  vertical-align: top;
  font-size: var(--table-font-size, 13px);
}

.app-table tr > *:first-child {
  border-left: 1px solid #ddd;
}

.app-table thead tr:first-child th {
  border-top: 1px solid #ddd;
}

.app-table thead th {
  background: #f1f1f1;
  position: sticky;
  top: calc(var(--header-bar-height, 0px) - var(--sticky-seam-overlap, 0px));
  z-index: 1;
}

.app-table th.sortable-col {
  cursor: pointer;
  user-select: none;
}

.app-table th.sorted-asc::after {
  content: " ▲";
  font-size: 11px;
  color: #444;
}

.app-table th.sorted-desc::after {
  content: " ▼";
  font-size: 11px;
  color: #444;
}

.table-export-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 6px 0;
}

.table-export-btn {
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #333;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.2;
}

.table-export-btn:hover {
  background: #f5f5f5;
}

.table-export-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input,
select,
textarea,
button {
  padding: var(--input-padding, 6px);
  font-size: var(--input-font-size, 13px);
}

button {
  cursor: pointer;
}

.box {
  background: #fff;
  border: 1px solid #ddd;
  padding: var(--box-padding, 10px);
  margin-bottom: 12px;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--row-min, 220px), 1fr));
  gap: var(--row-gap, 8px);
}

.top {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ok {
  color: #0a6;
  font-weight: 700;
}

.err {
  color: #b00;
  font-weight: 700;
}

.muted {
  color: #666;
}

form.inline {
  display: inline;
}

.nowrap {
  white-space: nowrap;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #bdbdbd;
  color: #666;
  font-size: 11px;
  line-height: 1;
  cursor: help;
  user-select: none;
  background: #fff;
}

.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 200px;
  max-width: 320px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  white-space: normal;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
  opacity: 1;
}
