/* OneTwin Ops Console — shared component classes (values from Admin Panel Redesign.dc.html) */

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

.console-root {
  min-width: 1280px;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
}

.mono { font-family: var(--font-mono); }

/* ---- typography ---- */
.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.page-title .title-suffix {
  font-size: 13px;
  color: var(--text-faint);
  font-weight: 500;
  font-family: var(--font-mono);
}
.micro-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ---- buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-ui);
  padding: 9px 14px;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { transform: scale(.98); transition-duration: var(--dur-fast); }
.btn-primary:disabled { background: #1c212b; color: var(--text-faint); cursor: default; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--border-input);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-ui);
  padding: 8px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,.03); }
.btn-secondary:active { transform: scale(.98); transition-duration: var(--dur-fast); }

.btn-danger-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  padding: 0;
}
.btn-danger-link:hover { color: #fca5a5; }

.icon-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
}
.icon-btn:hover { color: var(--text); }
.icon-btn.faint { color: var(--text-faint); }
.icon-btn.faint:hover { color: var(--danger); }

/* ---- inputs ---- */
.search-box { position: relative; }
.search-box > .search-icon {
  position: absolute;
  left: 11px;
  top: 9px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-input {
  width: 220px;
  background: var(--surface-2);
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  padding: 8px 12px 8px 32px;
  font-size: 12.5px;
  color: var(--text);
  font-family: var(--font-mono);
  box-sizing: border-box;
  outline: none;
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { border-color: var(--accent-border); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-input {
  background: var(--input-bg);
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  padding: 10px 13px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-ui);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.field-input.mono { font-family: var(--font-mono); }
.field-input::placeholder { color: var(--text-faint); }
.field-input:focus { border-color: var(--accent-border); }
select.field-input { appearance: none; cursor: pointer; }

/* ---- cards / tables ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.stat-card {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
}
.stat-card .stat-num {
  font-size: 24px;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-top: 4px;
  color: var(--text);
  animation: panel-in var(--dur-slow) var(--ease) both;
}

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.table-head {
  display: grid;
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  background: var(--surface-2);
}
.table-head > div { padding: 11px 0; }
.table-row {
  display: grid;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: rgba(255,255,255,.02); }
.table-row.row-self { background: rgba(255,197,61,.03); }
.table-row.row-changed { animation: flash-amber 1.2s var(--ease) both; background: rgba(255,197,61,.03); }
.table-row.row-dirty { background: rgba(255,197,61,.04); }

/* ---- chips ---- */
.chip {
  border: 1px solid var(--border-input);
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  font-family: var(--font-mono);
  background: transparent;
  cursor: pointer;
  padding: 6px 12px;
}
.chip:hover { color: var(--text); }
.chip.selected {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent);
}
.asset-chip {
  border: 1px solid var(--border-input);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ---- scrim + modal / dialog ---- */
.scrim {
  position: fixed;
  inset: 0;
  backdrop-filter: blur(var(--scrim-blur));
  -webkit-backdrop-filter: blur(var(--scrim-blur));
  z-index: 200;
}

/* The scrim is deliberately NOT animated: animating the opacity of a
   backdrop-filter layer forces Chrome to re-blur the whole viewport on every
   frame, which stutters the panel animation. The tint fades via the sibling
   ::before layer, which carries no filter of its own. */
.scrim::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--scrim-tint);
}
.scrim.opening::before { animation: scrim-in var(--dur-base) var(--ease) both; }
.scrim.closing::before { animation: scrim-out var(--dur-base) var(--ease) both; }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scrim-out { from { opacity: 1; } to { opacity: 0; } }
/* while closing, the blur fades out too (it is only animated for this short moment): otherwise it stayed at full
   strength and vanished at once when the overlay was removed — a visible flash */
.scrim.closing { animation: scrim-unblur var(--dur-base) var(--ease) forwards; }
@keyframes scrim-unblur { from { backdrop-filter: blur(var(--scrim-blur)); -webkit-backdrop-filter: blur(var(--scrim-blur)); }
  to { backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); } }

/* dialog sections (centered form modals) */
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 26px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.console-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
}
.console-modal .modal-panel {
  background: var(--panel);
  border: 1px solid var(--border-input);
  border-radius: var(--r-modal);
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 221;
  will-change: opacity, transform;
}
@keyframes modal-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
@keyframes modal-out { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.97); } }
.console-modal .modal-panel.opening { animation: modal-in var(--dur-base) var(--ease) both; }
.console-modal .modal-panel.closing { animation: modal-out var(--dur-base) var(--ease) both; }

/* ---- misc ---- */
.divider { height: 1px; background: var(--border); }

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #f8b4b4;
  font-size: 12.5px;
  font-family: var(--font-mono);
}

.pill-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
}
.pill-ok .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.presence-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-ghost); transition: background-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease); }
.presence-dot.online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }

.drop-zone {
  border: 1.5px dashed var(--border-input);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-faint);
  transition: border-color var(--dur-base) var(--ease), background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
  cursor: pointer;
}
.drop-zone.drag-over, .drop-zone.filled { border-color: var(--accent-border); background: rgba(255,197,61,.03); color: var(--accent); }

/* segmented control */
.segmented {
  position: relative;
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.segmented .seg-pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: var(--accent);
  border-radius: var(--r-sm);
  transition: transform var(--dur-base) var(--ease), width var(--dur-base) var(--ease);
  z-index: 0;
}
.segmented button {
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.segmented button.active { color: var(--accent-ink); font-weight: 700; }

/* content header shared */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 32px 0;
}
.header-actions { display: flex; gap: 10px; align-items: center; }
/* page top (title, actions, summary tiles) stays put while the page scrolls under it, like the Analytics header.
   The page root must not shrink (flex-shrink: 0) or the sticky block scrolls away after one screen. */
.page-sticky { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--border-soft); margin-bottom: 20px; }

/* keep Chrome autofill from painting inputs light */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
    caret-color: var(--text);
    transition: background-color 9999s ease-in-out 0s;
}

/* scrollbars fitting the dark theme */
* { scrollbar-width: thin; scrollbar-color: var(--border-hard) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-hard); border-radius: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
