/* minimal black and white, slightly rounded corners, borders */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
}

a { color: #000; }

.topbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #000;
  padding: 0.6rem 1rem;
}

.topbar a {
  text-decoration: none;
  padding: 0.2rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 6px;
}

.topbar a:hover,
.topbar a.active { border-color: #000; }

.topbar .brand {
  font-weight: 700;
  border: 1px solid #000;
  margin-right: 0.5rem;
}

.spacer { flex: 1; }

.topbar .user { padding: 0 0.5rem; }

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

h1 { font-size: 1.25rem; }
h2 { font-size: 1.05rem; }

button {
  font: inherit;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
}

button:hover { background: #000; color: #fff; }

input, select, textarea {
  font: inherit;
  border: 1px solid #000;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  background: #fff;
  color: #000;
}

.card {
  border: 1px solid #000;
  border-radius: 8px;
  padding: 1rem;
}

.error {
  border: 1px solid #b00020;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  background: #fff;
  color: #b00020;
}

.muted { color: #555; }

/* launcher tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
}

.tile:hover { background: #000; color: #fff; }

.tile-name { font-weight: 700; }

/* status indicators are the one place we allow color */
.dot::before { content: "● "; color: #b00020; }
.dot.up::before { color: #0a7d24; }

.tile.down {
  opacity: 0.45;
}

.tile.down:hover { background: #fff; color: #000; }

/* login */
.login-box {
  max-width: 320px;
  margin: 4rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* sub-nav tabs within a service */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tabs a {
  text-decoration: none;
  padding: 0.2rem 0.7rem;
  border: 1px solid #999;
  border-radius: 6px;
  color: #555;
}

.tabs a.active {
  border-color: #000;
  color: #000;
  font-weight: 700;
}

.crumbs { color: #555; }
.crumbs a { color: #555; }

/* list tables */
table.list {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0 1.5rem;
}

table.list th, table.list td {
  border: 1px solid #000;
  padding: 0.35rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

table.list th { background: #000; color: #fff; font-weight: 400; }
table.list td.num, table.list th.num { text-align: right; width: 1%; white-space: nowrap; }

.tablewrap { overflow-x: auto; }
.datagrid input[type="text"], .datagrid textarea { width: 100%; min-width: 8rem; }
.datagrid .numin { width: 6rem; }
.datagrid textarea.json { font-size: 12px; min-width: 14rem; }
.datagrid td { padding: 0.25rem; }
.newrow td { background: #f4f4f4; }

.rowactions { white-space: nowrap; width: 1%; }
.rowactions form { display: inline; }

/* forms */
.formrow {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}

.formrow .wide { flex: 1; min-width: 12rem; }

.formcol {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
}

.addrow { display: flex; gap: 1rem; flex-wrap: wrap; align-items: stretch; }

.searchbar { display: flex; gap: 0.5rem; margin: 1rem 0; }
.searchbar input[type="search"] { flex: 1; max-width: 24rem; }

.btnlink {
  border: 1px solid #000;
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  text-decoration: none;
}

/* piece grid */
.piece-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.piece-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-decoration: none;
  padding: 0.5rem;
}

.piece-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid #000;
  border-radius: 6px;
}

.piece-card:hover { background: #000; color: #fff; }

.noimg {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #999;
  border-radius: 6px;
}

.imgrow { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.imgbox { flex: 1 1 45%; min-width: 320px; }
.imgbox img { width: 100%; max-height: 70vh; object-fit: contain; border: 1px solid #000; border-radius: 6px; }
.imgbox .noimg { aspect-ratio: 4 / 3; }

/* large preview grids (studio outputs, sketchlines runs) — never bubbles */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.preview-card { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.preview-card img { width: 100%; max-height: 60vh; object-fit: contain; border: 1px solid #000; border-radius: 6px; background: #fff; }
.preview-card.selected { outline: 3px solid #0a7d24; }
.preview-card .formrow { margin: 0; }

.danger-zone { margin-top: 2rem; }
.danger-zone button { border-color: #b00020; color: #b00020; }
.danger-zone button:hover { background: #b00020; color: #fff; }

.msglog {
  border: 1px solid #000;
  border-radius: 6px;
  padding: 0.6rem;
  height: 260px;
  overflow-y: auto;
  font-size: 13px;
  margin: 0.5rem 0;
}

.gcode-view { height: 480px; }
