/* Extends ../styles.css with Domain Settings' dark glass vocabulary (.button variants, badges,
   toast, modal, fields), so the admin pages look alike. */

.auth-gate { max-width: 480px; margin: 3rem auto; text-align: center; padding: 2rem; color: #ccc; }

.sl-view { padding: 0.75rem 1.25rem 3rem; max-width: 1300px; margin: 0 auto; box-sizing: border-box; }
.sl-muted { color: #888; }
.sl-small { font-size: 0.8rem; }
.sl-empty { text-align: center; color: #777; padding: 2.5rem 1rem; }
.sl-loading { text-align: center; color: #888; padding: 1.5rem; }
.sl-note {
  background: rgba(255,180,0,0.08); border: 1px solid rgba(255,180,0,0.3); color: #ffd56a;
  border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.85rem; margin-bottom: 1rem;
}

.sl-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.sl-toolbar input[type="text"], .sl-toolbar select {
  background: rgba(26,26,26,0.85); color: #fff; border: 1px solid #333; border-radius: 8px;
  padding: .55rem .8rem; font-size: 0.92rem; font-family: inherit;
}
.sl-toolbar input[type="text"] { flex: 1 1 220px; min-width: 0; }
.sl-toolbar .sl-spacer { flex: 1; }

/* ── Buttons (same variants as Domain Settings) ── */
.button { border: none; cursor: pointer; font-size: 0.9rem; padding: 0.55rem 1.1rem; font-family: inherit; }
.button.secondary { background: #1a1a1a; color: #00ffcc; border: 1px solid #00ffcc; }
.button.secondary:hover { background: rgba(0,255,204,0.1); }
.button.danger { background: #1a1a1a; color: #ff4466; border: 1px solid #ff4466; }
.button.danger:hover { background: rgba(255,68,102,0.1); }
.button.small { padding: 0.3rem 0.65rem; font-size: 0.78rem; font-weight: 500; }
.button:disabled { opacity: 0.4; cursor: not-allowed; }
.sl-link-btn { background: none; border: 0; padding: 0; color: #00ffcc; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.sl-badge {
  display: inline-block; padding: 0.08rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600;
  border: 1px solid #444; color: #ccc; white-space: nowrap; vertical-align: middle;
}
.sl-badge.ok { border-color: #00ffcc; color: #00ffcc; }
.sl-badge.warn { border-color: #ff9900; color: #ff9900; background: rgba(255,153,0,0.12); }
.sl-badge.bad { border-color: #ff4466; color: #ff4466; background: rgba(255,68,102,0.1); }
.sl-badge.info { border-color: #58a6ff; color: #58a6ff; }
.sl-badge.mode-planning { border-color: #ff9900; color: #ffb84d; }
.sl-badge.mode-maintenance { border-color: #58a6ff; color: #58a6ff; }
.sl-badge.mode-completed { border-color: #00ffcc; color: #00ffcc; }

/* ── Toast ── */
.toast {
  position: fixed; right: 1rem; bottom: 1rem; background: #ff0066; color: #fff; padding: .9rem 1rem;
  border-radius: 10px; box-shadow: 0 0 15px rgba(0,0,0,.5); z-index: 400; display: none;
  max-width: min(520px, calc(100vw - 2rem)); white-space: pre-line; word-break: break-word;
}
.toast-spinner {
  display: inline-block; width: 0.9rem; height: 0.9rem; margin-right: 0.5rem; vertical-align: -0.15em;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%;
  animation: sl-spin 0.8s linear infinite;
}
@keyframes sl-spin { to { transform: rotate(360deg); } }

/* ── Panels ── */
.sl-panel {
  background: rgba(24,24,24,0.66); border: 1px solid rgba(255,255,255,0.07); border-radius: 12px;
  padding: 1rem 1.2rem; margin-bottom: 1rem;
}
.sl-panel h3 { margin: 0 0 0.7rem; font-size: 1rem; color: #fff; }
.sl-section-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 1.4rem 0 0.7rem; }
.sl-section-head h3 { margin: 0; font-size: 1.05rem; }
.sl-section-head .sl-muted { font-size: 0.85rem; }

/* ── Overview table ── */
.sl-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(255,255,255,0.07); background: rgba(24,24,24,0.66); }
.sl-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.sl-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #999;
  font-weight: 500; padding: 0.7rem 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.08); white-space: nowrap;
}
.sl-table td { padding: 0.75rem 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: top; }
.sl-table tr:last-child td { border-bottom: 0; }
.sl-table tbody tr { cursor: pointer; transition: background 0.15s; }
.sl-table tbody tr:hover { background: rgba(0,255,204,0.04); }
.sl-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sl-table .sl-id { color: #777; font-variant-numeric: tabular-nums; }
.sl-list-name { font-weight: 600; color: #fff; }
.sl-list-desc { color: #999; font-size: 0.8rem; margin-top: 0.2rem; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-item-names { display: flex; flex-wrap: wrap; gap: 0.25rem; max-width: 44ch; }
.sl-item-chip { font-size: 0.75rem; padding: 0.08rem 0.45rem; border-radius: 6px; background: rgba(255,255,255,0.06); color: #ccc; }
.sl-item-chip.bought { color: #7fe9d2; background: rgba(0,255,204,0.07); }
.sl-row-actions { display: flex; gap: 0.4rem; justify-content: flex-end; white-space: nowrap; }
.sl-per { display: block; font-size: 0.75rem; color: #888; }

/* Phones: the table becomes cards. */
@media (max-width: 760px) {
  .sl-table thead { display: none; }
  .sl-table, .sl-table tbody, .sl-table tr, .sl-table td { display: block; width: 100%; box-sizing: border-box; }
  .sl-table tr { border-bottom: 1px solid rgba(255,255,255,0.08); padding: 0.4rem 0; }
  .sl-table td { border: 0; padding: 0.3rem 0.9rem; }
  .sl-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.68rem; color: #888; text-transform: uppercase; letter-spacing: 0.05em; }
  .sl-table .num { text-align: left; }
  .sl-row-actions { justify-content: flex-start; }
}

/* ── List detail ── */
.sl-head { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; }
.sl-head-main { flex: 1 1 320px; min-width: 0; }
.sl-head h2 { margin: 0 0 0.35rem; font-size: 1.5rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.sl-head h2 .sl-id { color: #777; font-weight: 400; font-size: 1rem; }
.sl-desc { color: #bbb; white-space: pre-line; margin: 0; line-height: 1.45; }
.sl-head-meta { color: #888; font-size: 0.8rem; margin-top: 0.5rem; }
.sl-head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-start; }

.sl-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.8rem; }
.sl-stat { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 0.75rem 0.9rem; }
.sl-stat.hl { border-color: rgba(0,255,204,0.35); background: rgba(0,255,204,0.05); }
.sl-stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #999; }
.sl-stat-value { font-size: 1.45rem; font-weight: 700; color: #fff; margin: 0.2rem 0; font-variant-numeric: tabular-nums; }
.sl-stat.hl .sl-stat-value { color: #00ffcc; }
.sl-stat-sub { font-size: 0.8rem; color: #999; line-height: 1.4; }
.sl-stat-sub input { width: 6.5em; background: #1a1a1a; color: #fff; border: 1px solid #444; border-radius: 6px; padding: 0.15rem 0.35rem; font: inherit; }

.sl-items { display: flex; flex-direction: column; gap: 0.7rem; }
.sl-item {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 1rem; align-items: start;
  background: rgba(24,24,24,0.66); border: 1px solid rgba(255,255,255,0.07); border-left: 4px solid #ff9900;
  border-radius: 12px; padding: 0.9rem 1rem;
}
.sl-item.consumable { border-left-color: #58a6ff; }
.sl-item.bought { border-left-color: #00ffcc; }
.sl-item-img { width: 96px; height: 96px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,0.92); display: block; }
.sl-item-img.none { background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; color: #555; font-size: 2rem; }
.sl-item-body { min-width: 0; }
.sl-item-name { font-weight: 600; font-size: 1rem; color: #fff; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.sl-item-desc { color: #aaa; font-size: 0.83rem; margin: 0.3rem 0 0; line-height: 1.4; white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sl-item-desc.open { -webkit-line-clamp: unset; }
.sl-item-pcs { font-size: 0.82rem; color: #9ecbff; margin-top: 0.4rem; }
.sl-item-price { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sl-item-price .total { font-size: 1.15rem; font-weight: 700; }
.sl-item-price .unit { font-size: 0.8rem; color: #999; }
.sl-item-actions { display: flex; gap: 0.35rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 0.5rem; }
.sl-item-actions label { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: #ccc; cursor: pointer; }
.sl-item-actions input { accent-color: #00ffcc; }

.sl-links { margin-top: 0.55rem; display: flex; flex-direction: column; gap: 0.3rem; }
.sl-linkrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; font-size: 0.82rem; }
.sl-linkrow a { color: #9ecbff; text-decoration: none; overflow-wrap: anywhere; }
.sl-linkrow a:hover { text-decoration: underline; }
.sl-linkrow .star { color: #ffd56a; width: 1em; }
.sl-linkrow .star.off { color: #555; }
.sl-linkrow .price { font-variant-numeric: tabular-nums; color: #fff; }
.sl-linkrow .was { color: #888; text-decoration: line-through; }
.sl-linkrow .up { color: #ff6b7d; }
.sl-linkrow .down { color: #00ffcc; }
.sl-linkrow .checked { color: #777; font-size: 0.75rem; }

.sl-owned-toggle { background: none; border: 1px dashed rgba(255,255,255,0.15); border-radius: 10px; color: #aaa; padding: 0.6rem; width: 100%; cursor: pointer; font: inherit; }

/* Bills */
.sl-bills { display: flex; flex-direction: column; gap: 0.7rem; }
.sl-bill { background: rgba(24,24,24,0.66); border: 1px solid rgba(255,255,255,0.07); border-radius: 12px; padding: 0.8rem 1rem; }
.sl-bill-head { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; }
.sl-bill-head .when { font-weight: 600; }
.sl-bill-head .total { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.sl-bill table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.85rem; }
.sl-bill td { padding: 0.2rem 0; color: #ccc; }
.sl-bill td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 1rem; }
.sl-bill tr.fee td { color: #999; }
.sl-bill .notes { color: #999; font-size: 0.82rem; margin-top: 0.4rem; white-space: pre-line; }

/* Price check results */
.sl-results li { margin: 0.25rem 0; font-size: 0.88rem; color: #ccc; }
.sl-results ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }

/* ── Modals ── */
/* The box itself scrolls (capped to the window), not the backdrop: a long form then scrolls
   wherever the wheel is, and the page behind stays put (html.sl-modal-open). */
.sl-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: flex-start; justify-content: center;
  z-index: 250; padding: 2rem 1rem; box-sizing: border-box; overflow: hidden;
}
.sl-modal-box {
  background: rgba(24,24,24,0.94); border: 1px solid rgba(0,255,204,0.3); border-radius: 12px;
  padding: 1.4rem 1.5rem; width: 100%; max-width: 720px; box-sizing: border-box;
  max-height: calc(100vh - 4rem); max-height: calc(100dvh - 4rem); overflow-y: auto; overscroll-behavior: contain;
}
html.sl-modal-open { overflow: hidden; }
.sl-modal-box.wide { max-width: 900px; }
.sl-modal-box h3 { margin: 0 0 1rem; color: #fff; }
.sl-modal-box h4 { color: #00ffcc; font-size: 0.85rem; font-weight: 500; margin: 1.1rem 0 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.sl-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem; margin-bottom: 0.9rem; }
.sl-form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.sl-form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .sl-form-grid, .sl-form-grid.three { grid-template-columns: 1fr; } .sl-modal-box { padding: 1.1rem 1rem; } }
.sl-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.sl-field > label, .sl-field > .lbl { font-size: 0.75rem; color: #999; text-transform: uppercase; letter-spacing: 0.05em; }
.sl-field input, .sl-field select, .sl-field textarea, .sl-input {
  background: rgba(34,34,34,0.85); border: 1px solid #444; border-radius: 7px; color: #fff;
  padding: 0.5rem 0.65rem; font-size: 0.92rem; font-family: inherit; min-width: 0; box-sizing: border-box;
}
.sl-field textarea { resize: vertical; min-height: 4.5em; }
/* Grows with its text (app.js autoGrow) up to this, so it rarely scrolls inside the form. */
.sl-field textarea.sl-autogrow { max-height: 45vh; overflow-y: auto; }
.sl-field input:focus, .sl-field select:focus, .sl-field textarea:focus, .sl-input:focus { outline: none; border-color: #00ffcc; }
.sl-field .hint { font-size: 0.75rem; color: #888; }
.sl-inline { display: flex; gap: 0.4rem; align-items: center; }
.sl-inline > input { flex: 1; min-width: 0; }
.sl-inline > select { flex: 0 0 auto; }
.sl-form-error { color: #ff6b7d; font-size: 0.88rem; min-height: 1.2em; margin: 0.8rem 0 0.4rem; white-space: pre-line; }
.sl-modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }
.sl-modal-actions .left { margin-right: auto; }

.sl-kind { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sl-kind label {
  flex: 1 1 200px; display: flex; gap: 0.5rem; align-items: flex-start; cursor: pointer; padding: 0.6rem 0.75rem;
  border: 1px solid #444; border-radius: 8px; font-size: 0.85rem; color: #ccc; text-transform: none; letter-spacing: 0;
}
.sl-kind label:has(input:checked) { border-color: #00ffcc; background: rgba(0,255,204,0.06); }
.sl-kind input { accent-color: #00ffcc; margin-top: 0.15rem; }
.sl-kind b { color: #fff; display: block; }

.sl-edit-links { display: flex; flex-direction: column; gap: 0.45rem; }
.sl-edit-link { display: grid; grid-template-columns: auto 1fr auto auto; gap: 0.4rem; align-items: center; }
.sl-edit-link .primary { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: #aaa; cursor: pointer; white-space: nowrap; }
.sl-edit-link .primary input { accent-color: #ffd56a; }
.sl-edit-link .found { grid-column: 2 / -1; font-size: 0.75rem; color: #888; margin-top: -0.2rem; }
.sl-edit-link .found.ok { color: #7fe9d2; }
.sl-edit-link .found.bad { color: #ff9db0; }
.sl-pull-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-top: 0.6rem; }

.sl-img-edit { display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap; }
.sl-img-edit img, .sl-img-edit .ph { width: 110px; height: 110px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,0.92); }
.sl-img-edit .ph { background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; color: #555; font-size: 2.2rem; }
.sl-img-edit .btns { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.sl-calc { font-size: 0.85rem; color: #9ecbff; background: rgba(88,166,255,0.06); border: 1px solid rgba(88,166,255,0.2); border-radius: 8px; padding: 0.5rem 0.7rem; }

.sl-lines { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.sl-lines th { text-align: left; font-size: 0.7rem; color: #999; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; padding: 0.3rem; }
.sl-lines td { padding: 0.25rem 0.3rem; vertical-align: middle; }
.sl-lines td input[type="text"], .sl-lines td input[type="number"] { width: 100%; box-sizing: border-box; background: rgba(34,34,34,0.85); border: 1px solid #444; border-radius: 6px; color: #fff; padding: 0.35rem 0.45rem; font: inherit; }
.sl-lines td.qty { width: 5.5em; }
.sl-lines td.price { width: 8em; }
.sl-lines td.sum { width: 7em; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sl-lines input[type="checkbox"] { accent-color: #00ffcc; }
.sl-lines tr.off td:not(:first-child) { opacity: 0.4; }
.sl-bill-total { text-align: right; font-size: 1.1rem; font-weight: 700; margin-top: 0.6rem; }
.sl-check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; color: #ccc; cursor: pointer; }
.sl-check input { accent-color: #00ffcc; }

.sl-hist { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.sl-hist td, .sl-hist th { padding: 0.3rem 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.05); text-align: left; }
.sl-hist th { color: #999; font-weight: 500; font-size: 0.72rem; text-transform: uppercase; }
.sl-hist .num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .sl-item { grid-template-columns: 64px 1fr; }
  .sl-item-img, .sl-item-img.none { width: 64px; height: 64px; }
  .sl-item-price { grid-column: 1 / -1; text-align: left; }
  .sl-item-actions { justify-content: flex-start; }
}

/* A .json dragged over the lists overview (import). */
.sl-view.sl-drop { outline: 2px dashed #00ffcc; outline-offset: -6px; border-radius: 14px; background: rgba(0,255,204,0.04); }
