:root {
  --bg: #f6f7f9;
  --fg: #1c1f24;
  --muted: #6b7280;
  --card: #fff;
  --border: #e5e7eb;
  --accent: #1f5fff;
  --danger: #c1272d;
  --ok: #137333;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  margin: 0; background: var(--bg); color: var(--fg);
}
header {
  display: flex; align-items: center; gap: 1rem;
  padding: .8rem 1.2rem; background: #fff; border-bottom: 1px solid var(--border);
}
header .brand {
  font-weight: 600; text-decoration: none; color: var(--fg);
  display: inline-flex; align-items: center;
  gap: calc(.5rem + .5cm);
}
header .brand-logo { height: 40px; width: auto; display: block; }
header nav { margin-left: auto; display: flex; gap: 1rem; align-items: center; }
header nav a { color: var(--accent); text-decoration: none; }
header .who { color: var(--muted); font-size: .9rem; }
main { max-width: 1000px; margin: 1.5rem auto; padding: 0 1rem; }
main.wide { max-width: 1800px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 1.2rem 1.4rem; margin-bottom: 1rem;
}
.table-wrap { overflow-x: auto; }
.table-wrap th, .table-wrap td { white-space: nowrap; }
.card.narrow { max-width: 360px; margin-left: auto; margin-right: auto; }
h1 { margin-top: 0; }
form label { display: block; margin: .6rem 0; }
form input, form select, form textarea {
  display: block; width: 100%; padding: .45rem .6rem;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
}
form.inline { display: inline-block; margin: 0; }
form.inline input { width: auto; display: inline-block; }
button {
  padding: .45rem .9rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; cursor: pointer;
}
button.danger { background: var(--danger); border-color: var(--danger); }
button.icon {
  width: 28px; height: 28px; padding: 0; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
button.icon.danger { background: transparent; color: var(--danger); }
button.icon.danger:hover { background: var(--danger); color: #fff; }
a.icon {
  width: 28px; height: 28px; border-radius: 5px; vertical-align: middle;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); text-decoration: none;
}
a.icon:hover { background: var(--accent); color: #fff; }
td.actions { white-space: nowrap; width: 1%; }
td.actions > * + * { margin-left: .3rem; }
td.actions form.inline { vertical-align: middle; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .5rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: #fafbfc; font-weight: 600; font-size: .9rem; }
tr[data-row] { cursor: pointer; outline: none; }
tr[data-row].selected,
tr[data-row].selected td { background: #fff59d; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.row-between h1 { margin: 0; }
.view-links { display: flex; gap: .35rem; }
.view-links a {
  padding: .25rem .65rem; border: 1px solid var(--border); border-radius: 6px;
  text-decoration: none; color: var(--muted); font-size: .9rem;
}
.view-links a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

table.grid th, table.grid td { padding: 2px 6px; line-height: 1.2; vertical-align: middle; }
table.grid input, table.grid select {
  padding: 1px 4px; line-height: 1.2; border-radius: 3px; height: 22px;
}
table.grid button { padding: 1px 8px; line-height: 1.2; height: 22px; border-radius: 3px; }
table.grid form.inline {
  display: flex; align-items: center; gap: 4px; line-height: 1; margin: 0;
}
table.grid form.inline input { flex: 1; min-width: 6rem; width: auto; }
table.grid td:first-child { color: var(--muted); width: 1%; white-space: nowrap; }
table.grid td:nth-child(3) { width: 1%; white-space: nowrap; color: var(--muted); font-size: .85rem; }
table.grid td:last-child { width: 1%; white-space: nowrap; }

.xl-wrap { overflow: auto; border: 1px solid #b7b7b7; }
table.xl {
  border-collapse: collapse;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9rem;
  background: #fff;
  table-layout: fixed;
  width: 100%;
}
table.xl th, table.xl td {
  border: 1px solid #d0d7de;
  padding: 0 6px;
  height: 20px;
  line-height: 1.1;
  vertical-align: middle;
  text-align: left;
  background: #fff;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.xl thead th {
  background: #f4f5f7;
  color: var(--muted);
  font-weight: 600;
  font-size: .75rem;
  text-align: center;
  position: sticky; top: 0; z-index: 1;
  height: 18px;
}
table.xl .xl-rownum {
  background: #f4f5f7;
  color: var(--muted);
  font-weight: 500;
  font-size: .75rem;
  text-align: center;
  width: 28px;
}
table.xl .xl-corner { width: 28px; background: #ebecef; }
table.xl thead th:nth-child(2),
table.xl tbody td:nth-child(2) { width: 1.5cm; text-align: right; }
table.xl td.readonly { color: var(--muted); }
table.xl td[data-edit] { cursor: cell; }
table.xl tr.xl-row-selected td { background: #fff59d; }
table.xl td.xl-selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  position: relative;
  z-index: 2;
}
table.xl td.xl-error { background: #fce8e6; }
table.xl input.xl-input {
  width: 100%; height: 100%;
  border: none; outline: none; background: transparent;
  font: inherit; padding: 0; margin: 0;
}
table.xl:focus { outline: none; }
.pw { font-family: ui-monospace, Menlo, monospace; padding: .15rem .35rem; background: #f1f3f5; border-radius: 4px; }
.flashes { list-style: none; padding: 0; margin: 0 0 1rem; }
.flash { padding: .55rem .8rem; border-radius: 6px; margin-bottom: .4rem; }
.flash.ok    { background: #e6f4ea; color: var(--ok); }
.flash.error { background: #fce8e6; color: var(--danger); }
code { background: #f1f3f5; padding: .1rem .3rem; border-radius: 4px; }

.muted { color: #777; }
.bad   { color: #a00; }

textarea.checkin-json {
  display: block; width: 100%; box-sizing: border-box;
  padding: .45rem .6rem;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem; line-height: 1.45;
  background: #f8f9fa; color: inherit;
  resize: vertical; white-space: pre-wrap; word-break: break-all;
}

.stacked label { display: block; margin: 0 0 .9rem; }
.stacked label input,
.stacked label textarea {
  max-width: 40rem;
  margin-top: .25rem;
  box-sizing: border-box;
}
.stacked label textarea { resize: vertical; }
.stacked label select { width: auto; min-width: 12rem; margin-top: .25rem; }
.stacked input[readonly] { background: #f2f2f2; color: #555; }
.row-buttons { display: flex; gap: .6rem; align-items: center; }
.stacked .edit-buttons { margin: 0 0 .9rem; }
.stacked .warn { display: block; margin-top: .25rem; font-size: .85rem; color: #a05a00; }
.stacked .note { display: block; margin-top: .25rem; font-size: .85rem; color: var(--muted); }
.stacked input.changed, .stacked textarea.changed, .stacked select.changed {
  background: #fff4c2; border-color: #d9a800;
}
.stacked input.invalid { border-color: #c0392b; background: #fdecea; }
#dilugents-table, #users-table { width: auto; }
#dilugents-table td:nth-child(4) { white-space: normal; }
[hidden] { display: none !important; }
button:disabled { opacity: .45; cursor: default; }

.copycell { display: inline-flex; align-items: center; gap: .35rem; }
button.copy {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: #999; line-height: 0; border-radius: 4px;
}
button.copy svg {
  width: 14px; height: 14px; fill: none;
  stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
button.copy:hover  { color: var(--accent); }
button.copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.copy.copied svg,
button.copy.failed svg { display: none; }
button.copy.copied, button.copy.failed { line-height: 1; font-size: .85rem; }
button.copy.copied { color: #2e7d32; }
button.copy.failed { color: #a00; }
button.copy.copied::after { content: "\2713"; }
button.copy.failed::after { content: "\2717"; }
.stacked .license-key, .stacked .field { margin: 0 0 .9rem; }
.stacked .license-key .copycell, .stacked .field .copycell { display: flex; margin-top: .25rem; }
.license-code code {
  font-size: 1.4rem; letter-spacing: .05em; padding: .2rem .5rem;
  display: inline-block; min-width: 11ch; min-height: 1.4em; box-sizing: content-box;
}

.button.small, button.small { padding: .2rem .55rem; font-size: .85rem; }

a.button {
  display: inline-block;
  padding: .3rem .8rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #f6f6f6;
  color: #222;
  text-decoration: none;
}
a.button:hover { background: #ececec; }

.reported { border: 0; border-top: 1px solid #ddd; padding: .5rem 0 0; margin: 1.2rem 0 1rem; min-width: 0; }
.reported legend { padding: 0 .5rem 0 0; color: #666; font-size: .9em; }
.card-label { margin: 0 0 .5rem; color: #666; font-size: .9em; }

@media (min-width: 641px) {
  .stacked label, .stacked .license-key, .stacked .field {
    display: grid; grid-template-columns: 14rem minmax(0, 40rem);
    column-gap: 1rem; align-items: baseline; margin: 0 0 .6rem;
  }
  .stacked label input, .stacked label textarea, .stacked label select,
  .stacked .license-key .copycell, .stacked .field .copycell { margin-top: 0; }
  .stacked label select, .stacked .license-key .copycell, .stacked .field .copycell { justify-self: start; }
  .stacked .warn, .stacked .note { grid-column: 2; }
  .stacked .row-buttons { padding-left: 15rem; margin: 0 0 .6rem; }
}

.page-tools { display: flex; align-items: center; gap: .4rem; margin: -.3rem 0 .8rem; }
.icon-button {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .45rem; border-radius: 4px;
  color: var(--muted); text-decoration: none; font-size: .85rem; line-height: 1;
}
.icon-button svg {
  width: 18px; height: 18px; fill: none;
  stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-button:hover { color: var(--accent); background: #f0f3ff; }
.icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stacked.view input[readonly], .stacked.view textarea[readonly],
.stacked.view select:disabled { background: #f8f9fa; color: var(--fg); opacity: 1; }
.stacked.view input[readonly]:focus, .stacked.view textarea[readonly]:focus { outline: none; }

@media (max-width: 640px) {
  header { flex-wrap: wrap; gap: .5rem 1rem; padding: .6rem .9rem; }
  header .brand { gap: .7rem; font-size: .95rem; }
  header .brand-logo { height: 30px; }
  header nav { margin-left: 0; width: 100%; flex-wrap: wrap; gap: .4rem .9rem; }
  header nav form.inline { margin-left: auto; }
  main { margin: 1rem auto; padding: 0 .6rem; }
  .card { padding: 1rem .9rem; }
  h1 { font-size: 1.6rem; }
}
