:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --primary: #6ee7ff;
  --danger: #ff6b6b;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans";
  background: radial-gradient(900px 500px at 20% 10%, rgba(110,231,255,0.18), transparent 60%),
    radial-gradient(900px 500px at 80% 0%, rgba(99,102,241,0.14), transparent 60%),
    var(--bg);
  color: var(--text);
}

.app {
  max-width: 980px;
  margin: 0 auto;
  height: 100%;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.stickyTop {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title { font-size: 22px; font-weight: 700; }
.subtitle { margin-top: 4px; font-size: 13px; color: var(--muted); }

.card {
  background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.card.compact { padding: 12px 14px; }
h2 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); }
.hint.error { color: #ffb4b4; margin-top: 8px; }

.label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.labelTiny { font-size: 11px; color: var(--muted); display: block; margin-bottom: 2px; }

input, select, button {
  font: inherit;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: rgba(110,231,255,0.6);
  box-shadow: 0 0 0 4px rgba(110,231,255,0.12);
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}

.btn:hover { background: rgba(255,255,255,0.10); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border-color: rgba(110,231,255,0.55);
  background: rgba(110,231,255,0.12);
}
.btn.small { padding: 6px 10px; border-radius: 10px; }
.btn.danger {
  border-color: rgba(255,107,107,0.55);
  background: rgba(255,107,107,0.10);
}
.btn.full { width: 100%; }

.ops { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }

.filterBar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}

.filterTrigger {
  text-align: left;
  min-height: 48px;
}

#filterSummary {
  font-weight: 600;
  word-break: break-all;
}

.listCard {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 12px;
}

.listHeader {
  flex: 0 0 auto;
  margin-bottom: 10px;
}
.listHeader h2 { margin: 0; }

.listScroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.tableWrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
  background: rgba(0,0,0,0.18);
  min-height: 100%;
}

.table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  padding: 12px;
  background: rgba(11, 18, 32, 0.96);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: middle;
}

tbody tr:hover td { background: rgba(255,255,255,0.03); }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.qtyOps { justify-content: flex-start; }
.qtyNum {
  width: 74px;
  padding: 6px 8px;
  border-radius: 10px;
}

.mask {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
  padding: 16px;
  z-index: 50;
}

.mask[hidden],
#appRoot[hidden] {
  display: none !important;
}

.dialog {
  width: min(420px, 100%);
  background: linear-gradient(180deg, var(--panel), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.dialogTitle {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.field { display: block; margin-bottom: 12px; }

.dialogActions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.checkList {
  max-height: min(50vh, 360px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
  padding: 8px;
}

.checkItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
}

.checkItem:hover { background: rgba(255,255,255,0.05); }

.checkItem input {
  width: 18px;
  height: 18px;
  padding: 0;
}

@media (max-width: 640px) {
  .app { padding: 10px 12px 12px; }
  .title { font-size: 20px; }
  .subtitle { display: none; }
  .card.compact { padding: 10px 12px; }
  .ops { justify-content: flex-start; }
  .table { min-width: 620px; }
}
