/* PrintMaster Shared Styles - Common CSS for Agent and Server UIs */
/* Solarized Dark inspired theme with centralized color system */

/* ============================================================================
   THEME COLORS - Dark & Light Mode
   ============================================================================ */
:root {
  /* Base colors - Dark Mode (default) */
  --bg: #002b36;
  --panel: #073642;
  --muted: #586e75;
  --text: #93a1a1;
  --accent: #b58900;
  --highlight: #268bd2;
  --border: #004b56;
  
  /* Semantic colors */
  --success: #2aa198;
  --error: #dc322f;
  --warning: #cb4b16;
  --info: #268bd2;

  /* Toggle switch colors */
  --toggle-off-bg-start: #003842;
  --toggle-off-bg-end: #004b56;
  --toggle-off-border: #005b66;
  --toggle-on-bg-start: #2aa198;
  --toggle-on-bg-end: #268bd2;
  --toggle-on-border: #2aa198;
  --toggle-on-glow: rgba(38, 139, 210, 0.4);
  --toggle-knob-off-start: #657b83;
  --toggle-knob-off-end: #586e75;
  --toggle-knob-on-start: #ffffff;
  --toggle-knob-on-end: #f0f0f0;
  --toggle-indeterminate-start: #cb4b16;
  --toggle-indeterminate-end: #b58900;
  --toggle-indeterminate-glow: rgba(181, 137, 0, 0.3);

  /* Button colors */
  --btn-primary-bg: #268bd2;
  --btn-primary-text: #002b36;
  --btn-primary-hover: #3299de;
  --btn-save-bg: #2d7a3e;
  --btn-save-border: #3a9d50;
  --btn-save-text: #d0f0d8;
  --btn-saved-bg: #2d5a3e;
  --btn-saved-border: #3a5d50;
  --btn-saved-text: #90b098;
  --btn-delete-bg: #992626;
  --btn-delete-border: #c63535;
  --btn-delete-text: #ffdddd;

  /* Shadow system */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 3px 6px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-inset-sm: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-inset-md: inset 0 2px 4px rgba(0, 0, 0, 0.5);

  /* Transition timing */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode color overrides - Solarized Light */
body.light-mode {
  --bg: #fdf6e3;
  --panel: #eee8d5;
  --muted: #93a1a1;
  --text: #586e75;
  --accent: #b58900;
  --highlight: #cb4b16;
  --border: #d3cbb8;
  
  /* Semantic colors for light mode */
  --success: #859900;
  --error: #dc322f;
  --warning: #cb4b16;
  --info: #268bd2;

  /* Toggle switch colors for light mode */
  --toggle-off-bg-start: #d0c9b8;
  --toggle-off-bg-end: #c4bda8;
  --toggle-off-border: #b8b19a;
  --toggle-on-bg-start: #859900;
  --toggle-on-bg-end: #6c9a00;
  --toggle-on-border: #859900;
  --toggle-on-glow: rgba(133, 153, 0, 0.3);
  --toggle-knob-off-start: #93a1a1;
  --toggle-knob-off-end: #839496;
  --toggle-knob-on-start: #fdf6e3;
  --toggle-knob-on-end: #eee8d5;
  --toggle-indeterminate-start: #cb4b16;
  --toggle-indeterminate-end: #dc322f;
  --toggle-indeterminate-glow: rgba(203, 75, 22, 0.3);

  /* Button colors for light mode */
  --btn-primary-bg: #268bd2;
  --btn-primary-text: #fdf6e3;
  --btn-primary-hover: #3299de;
  --btn-save-bg: #859900;
  --btn-save-border: #6c9a00;
  --btn-save-text: #fdf6e3;
  --btn-saved-bg: #586e75;
  --btn-saved-border: #657b83;
  --btn-saved-text: #eee8d5;
  --btn-delete-bg: #dc322f;
  --btn-delete-border: #cb1f1b;
  --btn-delete-text: #fdf6e3;

  /* Adjust shadows for light mode */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 3px 6px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 4px 8px rgba(0, 0, 0, 0.25);
  --shadow-inset-sm: inset 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-inset-md: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

/* 
 * Logo watermark pattern - subtle branded background texture
 * Uses a 2×2 tile with alternating 45°/135° rotations creating a pinwheel effect.
 * Each logo is 90° from its horizontal and vertical neighbors.
 * ViewBox is 72×72 with 4 logos at (18,18), (54,18), (18,54), (54,54).
 */
:root {
  /* Dark mode: 2×2 alternating rotation pattern - tighter 36px spacing */
  --logo-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cdefs%3E%3Cg id='p'%3E%3Crect x='8' y='4' width='32' height='10' fill='%2393a1a1' rx='2'/%3E%3Crect x='4' y='14' width='40' height='20' fill='%2393a1a1' rx='3'/%3E%3Crect x='8' y='17' width='32' height='14' fill='%23073642' rx='2'/%3E%3Crect x='11' y='20' width='7' height='2' fill='%2393a1a1'/%3E%3Crect x='11' y='24' width='11' height='2' fill='%2393a1a1'/%3E%3Crect x='11' y='28' width='9' height='2' fill='%2393a1a1'/%3E%3Ccircle cx='35' cy='24' r='2.5' fill='%232aa198'/%3E%3Crect x='8' y='34' width='32' height='10' fill='%2393a1a1' rx='2'/%3E%3Crect x='12' y='37' width='24' height='4' fill='%23073642'/%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23p' transform='translate(18 18) rotate(45) scale(0.5) translate(-24 -24)' opacity='0.04'/%3E%3Cuse href='%23p' transform='translate(54 18) rotate(135) scale(0.5) translate(-24 -24)' opacity='0.04'/%3E%3Cuse href='%23p' transform='translate(18 54) rotate(135) scale(0.5) translate(-24 -24)' opacity='0.04'/%3E%3Cuse href='%23p' transform='translate(54 54) rotate(45) scale(0.5) translate(-24 -24)' opacity='0.04'/%3E%3C/svg%3E");
  --logo-pattern-size: 72px;
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(38, 139, 210, 0.12) 0%, transparent 60%);
}

/* Light mode: 2×2 alternating rotation pattern */
body.light-mode {
  --logo-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cdefs%3E%3Cg id='p'%3E%3Crect x='8' y='4' width='32' height='10' fill='%23586e75' rx='2'/%3E%3Crect x='4' y='14' width='40' height='20' fill='%23586e75' rx='3'/%3E%3Crect x='8' y='17' width='32' height='14' fill='%23fdf6e3' rx='2'/%3E%3Crect x='11' y='20' width='7' height='2' fill='%23586e75'/%3E%3Crect x='11' y='24' width='11' height='2' fill='%23586e75'/%3E%3Crect x='11' y='28' width='9' height='2' fill='%23586e75'/%3E%3Ccircle cx='35' cy='24' r='2.5' fill='%23859900'/%3E%3Crect x='8' y='34' width='32' height='10' fill='%23586e75' rx='2'/%3E%3Crect x='12' y='37' width='24' height='4' fill='%23fdf6e3'/%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23p' transform='translate(18 18) rotate(45) scale(0.5) translate(-24 -24)' opacity='0.05'/%3E%3Cuse href='%23p' transform='translate(54 18) rotate(135) scale(0.5) translate(-24 -24)' opacity='0.05'/%3E%3Cuse href='%23p' transform='translate(18 54) rotate(135) scale(0.5) translate(-24 -24)' opacity='0.05'/%3E%3Cuse href='%23p' transform='translate(54 54) rotate(45) scale(0.5) translate(-24 -24)' opacity='0.05'/%3E%3C/svg%3E");
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(181, 137, 0, 0.08) 0%, transparent 60%);
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: background-color 0.4s ease, color 0.4s ease;
  position: relative;
  min-height: 100vh;
}

/* Diagonal grid pattern using pseudo-element for clean layering */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: 
    var(--bg-gradient),
    var(--logo-pattern);
  background-size: 
    100% 100%,
    var(--logo-pattern-size) var(--logo-pattern-size);
  background-position: 
    center top,
    0 0;
  background-attachment: fixed;
}

.hidden {
  display: none !important;
}

/* ============================================================================
   MODAL SYSTEM
   ============================================================================ */
.modal, .modal-overlay {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
}

.modal::before, .modal-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--logo-pattern);
  background-size: var(--logo-pattern-size) var(--logo-pattern-size);
  opacity: 0.08;
  pointer-events: none;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  /* Promote to own compositor layer so interactive state changes (e.g. checkbox
     toggles) don't trigger backdrop-filter re-compositing in WebKit, which causes
     sub-pixel bounding-box instability across animation frames. */
  transform: translateZ(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
  user-select: none;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  color: var(--text);
}

.modal-body p {
  white-space: pre-wrap;
  margin: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.modal-button {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  font-weight: 500;
}

.modal-button-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: none;
}

.modal-button-primary:hover {
  background: var(--btn-primary-hover);
  box-shadow: var(--shadow-md);
}

.modal-button-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}

.modal-button-secondary:hover {
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.modal-button-danger {
  background: var(--btn-delete-bg);
  color: var(--btn-delete-text);
  border: 1px solid var(--btn-delete-border);
}

.modal-button-danger:hover {
  background: #b33030;
  box-shadow: var(--shadow-md);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 500;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}

button.primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: none;
  box-shadow: var(--shadow-md);
}

button.primary:hover:not(:disabled) {
  background: var(--btn-primary-hover);
}

button.save {
  background: var(--btn-save-bg);
  color: var(--btn-save-text);
  border: 1px solid var(--btn-save-border);
}

button.save:hover:not(:disabled) {
  background: var(--btn-save-border);
}

button.delete {
  background: var(--btn-delete-bg);
  color: var(--btn-delete-text);
  border: 1px solid var(--btn-delete-border);
}

button.delete:hover:not(:disabled) {
  background: #b33030;
}

/* ============================================================================
   FORM INPUTS
   ============================================================================ */
input,
textarea,
select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-inset-sm);
  font-size: 14px;
}

/* Prevent Grammarly and similar extensions from adding UI to our inputs */
textarea,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"] {
  /* Grammarly */
  -webkit-writing-mode: horizontal-tb !important;
}

/* Data attributes to disable writing assistants (set via HTML) */
textarea[data-gramm="false"],
input[data-gramm="false"] {
  /* Grammarly respects this attribute */
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--highlight);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(38, 139, 210, 0.2);
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 15000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 500px;
  pointer-events: all;
  animation: toast-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}

.toast.toast-success .toast-icon {
  color: var(--success);
}

.toast.toast-error {
  border-left: 4px solid var(--error);
}

.toast.toast-error .toast-icon {
  color: var(--error);
}

.toast.toast-info {
  border-left: 4px solid var(--info);
}

.toast.toast-info .toast-icon {
  color: var(--info);
}

.toast-icon {
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.toast-message {
  color: var(--text);
  font-size: 14px;
  flex: 1;
}

.toast.toast-hiding {
  animation: toast-slide-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* ============================================================================
   TOGGLE SWITCHES (CHECKBOXES)
   ============================================================================ */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 48px;
  height: 24px;
  background: linear-gradient(to bottom, var(--toggle-off-bg-start) 0%, var(--toggle-off-bg-end) 100%);
  border: 1px solid var(--toggle-off-border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  margin: 0;
  padding: 0;
}

input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--toggle-knob-off-start) 0%, var(--toggle-knob-off-end) 100%);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

input[type="checkbox"]:hover:not(:disabled) {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

input[type="checkbox"]:checked {
  background: linear-gradient(to bottom, var(--toggle-on-bg-start) 0%, var(--toggle-on-bg-end) 100%);
  border-color: var(--toggle-on-border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 8px var(--toggle-on-glow);
}

input[type="checkbox"]:checked::before {
  left: 26px;
  background: linear-gradient(135deg, var(--toggle-knob-on-start) 0%, var(--toggle-knob-on-end) 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

input[type="checkbox"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ----------------------------------------------------------------------------
   TOGGLE SWITCH WRAPPER PATTERN
   Use this for toggles with labels: <div class="toggle-switch"><input><span class="toggle-slider"></span></div>
   The checkbox is hidden and the slider span provides the visual toggle.
   ---------------------------------------------------------------------------- */
.toggle-switch {
  position: relative;
  flex-shrink: 0;
}

/* Reset checkbox styling when inside a toggle-switch wrapper */
.toggle-switch input,
.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  -webkit-appearance: checkbox;
  appearance: checkbox;
  background: none;
  border: none;
  box-shadow: none;
}

.toggle-switch input::before,
.toggle-switch input[type="checkbox"]::before {
  display: none;
}

.toggle-slider {
  display: block;
  width: 48px;
  height: 26px;
  background: linear-gradient(to bottom, var(--toggle-off-bg-start) 0%, var(--toggle-off-bg-end) 100%);
  border: 1px solid var(--toggle-off-border);
  border-radius: 13px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  background: linear-gradient(135deg, var(--toggle-knob-off-start) 0%, var(--toggle-knob-off-end) 100%);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.toggle-switch:hover .toggle-slider {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(to bottom, var(--toggle-on-bg-start) 0%, var(--toggle-on-bg-end) 100%);
  border-color: var(--toggle-on-border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 8px var(--toggle-on-glow);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
  background: linear-gradient(135deg, var(--toggle-knob-on-start) 0%, var(--toggle-knob-on-end) 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Toggle with label layout helpers */
.toggle-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-label {
  font-weight: 600;
  font-size: 13px;
}

.toggle-description {
  font-size: 11px;
  color: var(--muted);
}

/* ============================================================================
   PANELS
   ============================================================================ */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* ============================================================================
   UTILITIES
   ============================================================================ */
.copyable {
  cursor: pointer;
  transition: color 0.2s ease;
}

.copyable:hover {
  color: var(--highlight);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .modal-content {
    max-width: 95%;
    margin: 10px;
  }
  
  .toast {
    min-width: auto;
    max-width: calc(100vw - 40px);
  }
  
  .toast-container {
    right: 10px;
    left: 10px;
  }
}

/* Metrics table responsive adjustments for small screens */
@media (max-width: 600px) {
  .metrics-table-container { overflow-x: visible !important; }
  .metrics-table { width: 100% !important; min-width: 0 !important; font-size: 13px !important; }
  .metrics-table thead { display: none; }
  .metrics-table tbody tr { display: block; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 8px; padding-bottom: 6px; }
  .metrics-table tbody tr td { display: flex; justify-content: space-between; padding: 6px 8px; box-sizing: border-box; }
  .metrics-table tbody tr td:first-child { color: var(--muted); font-weight: 600; flex: 1 1 auto; }
  .metrics-table tbody tr td:last-child { text-align: right; white-space: nowrap; margin-left: 12px; }
  .metrics-table-container .metrics-table { border: 0; }
}

/* ============================================================================
   Saved Device Card & Consumable Styles (shared)
   Moved here so both Agent and Server can reuse the same visuals for
   saved-device cards, consumable bars and the compact metrics summary.
   ============================================================================ */

.saved-device-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px;
  max-width: 80%;
  margin: 0 auto;
}

.saved-device-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s ease, 
              border-color 0.3s ease, 
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  opacity: 1;
}

.saved-device-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--highlight);
}

.saved-device-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.saved-device-card-main {
  flex: 1;
  min-width: 250px;
}

.saved-device-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--highlight);
  margin: 0 0 6px 0;
}

.capabilities-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px 0;
}

.capability-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.2s ease;
}

.capability-badge:hover {
  transform: translateY(-1px);
  border-color: var(--highlight);
}

/* Device type badge - most prominent */
.capability-badge.type {
  background: rgba(38, 139, 210, 0.15);
  color: var(--highlight);
  border-color: rgba(38, 139, 210, 0.35);
}

/* Color capability */
.capability-badge.color {
  background: rgba(211, 54, 130, 0.15);
  color: #d33682;
  border-color: rgba(211, 54, 130, 0.35);
}

/* Mono capability */
.capability-badge.mono {
  background: rgba(88, 110, 117, 0.15);
  color: var(--muted);
  border-color: rgba(88, 110, 117, 0.35);
}

/* Function capabilities (copier, scanner, fax) */
.capability-badge.function {
  background: rgba(42, 161, 152, 0.12);
  color: var(--success);
  border-color: rgba(42, 161, 152, 0.3);
}

/* Technology badges (laser, inkjet) */
.capability-badge.tech {
  background: rgba(181, 137, 0, 0.12);
  color: var(--secondary);
  border-color: rgba(181, 137, 0, 0.3);
}

/* Feature badges (duplex, etc) */
.capability-badge.feature {
  background: rgba(108, 113, 196, 0.12);
  color: #6c71c4;
  border-color: rgba(108, 113, 196, 0.3);
}

/* ===== SOURCE BADGES (device type, source type) ===== */
.source-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Device type badges */
.source-badge.network {
  background: rgba(42, 161, 152, 0.15);
  color: var(--success);
  border-color: rgba(42, 161, 152, 0.35);
}

.source-badge.usb {
  background: rgba(211, 54, 130, 0.15);
  color: #d33682;
  border-color: rgba(211, 54, 130, 0.35);
}

.source-badge.local {
  background: rgba(38, 139, 210, 0.15);
  color: var(--highlight);
  border-color: rgba(38, 139, 210, 0.35);
}

.source-badge.shared {
  background: rgba(181, 137, 0, 0.15);
  color: var(--secondary);
  border-color: rgba(181, 137, 0, 0.35);
}

.source-badge.virtual {
  background: rgba(88, 110, 117, 0.15);
  color: var(--muted);
  border-color: rgba(88, 110, 117, 0.35);
}

/* Source type badges */
.source-badge.snmp {
  background: rgba(42, 161, 152, 0.1);
  color: var(--success);
  border-color: rgba(42, 161, 152, 0.25);
}

.source-badge.spooler {
  background: rgba(108, 113, 196, 0.1);
  color: #6c71c4;
  border-color: rgba(108, 113, 196, 0.25);
}

.source-badge.manual {
  background: rgba(181, 137, 0, 0.1);
  color: var(--secondary);
  border-color: rgba(181, 137, 0, 0.25);
}

/* Special badges */
.source-badge.default {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

.settings-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  margin-left: 8px;
  white-space: nowrap;
}

.settings-badge.locked {
  background: var(--danger-bg, rgba(220, 38, 38, 0.1));
  color: var(--danger, #dc2626);
  border: 1px solid var(--danger, #dc2626);
}

.settings-badge.override {
  background: var(--info-bg, rgba(59, 130, 246, 0.1));
  color: var(--info, #3b82f6);
  border: 1px solid var(--info, #3b82f6);
}

.settings-badge.inherited {
  background: var(--muted-bg, rgba(156, 163, 175, 0.1));
  color: var(--muted, #9ca3af);
  border: 1px solid var(--border);
}

.saved-device-card-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 4px 0;
}

.saved-device-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.saved-device-card-inner-panel {
  background: rgba(0, 43, 54, 0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.saved-device-card-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.saved-device-card-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.saved-device-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
  gap: 12px;
}

.saved-device-card-label {
  color: var(--muted);
}

/* Usage graph on saved device cards - canvas-based sparkline */
.usage-graph-container {
  background: rgba(0, 43, 54, 0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.usage-graph-canvas {
  display: block;
  width: 100%;
  height: 80px;
}

.usage-graph-no-data {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
  font-weight: 500;
  white-space: nowrap;
}

.saved-device-card-value {
  color: var(--text);
  font-family: monospace;
  font-size: 12px;
  text-align: right;
  flex: 1;
  min-width: 0;
}

/* Consumable levels (toner, drum, etc) */
.consumable-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.consumable-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.consumable-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 14px;
}

.consumable-bar {
  flex: 1;
  height: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.consumable-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.consumable-label {
  min-width: 80px;
  color: var(--muted);
  font-weight: 500;
}

/* ============================================================================
   DEVICE REPORT FORM
   ============================================================================ */
.device-report-container {
  padding: 16px;
  background: transparent;
  border-radius: 0;
  border: none;
}

.device-report-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.device-report-icon {
  font-size: 18px;
}

.device-report-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.device-report-description {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.device-report-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
}

/* Full-width fields */
.device-report-form > .device-report-current,
.device-report-form > .device-report-privacy,
.device-report-form > .device-report-actions,
.device-report-form > .device-report-status,
.device-report-form > .device-report-toggle-row {
  grid-column: 1 / -1;
}

/* Single column on narrow screens */
@media (max-width: 768px) {
  .device-report-form {
    grid-template-columns: 1fr;
  }
}

.device-report-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.device-report-field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.device-report-field select,
.device-report-field input,
.device-report-field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.device-report-field select:focus,
.device-report-field input:focus,
.device-report-field textarea:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 2px rgba(38, 139, 210, 0.2);
}

.device-report-field select {
  cursor: pointer;
}

.device-report-field textarea {
  resize: vertical;
  min-height: 60px;
}

.device-report-current {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0;
  transition: background 0.4s ease;
}

.device-report-current-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.device-report-current-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 4px 10px;
  font-size: 12px;
}

/* Single column grid on narrow screens */
@media (max-width: 600px) {
  .device-report-current-grid {
    grid-template-columns: auto 1fr;
  }
}

.device-report-current-label {
  color: var(--muted);
}

.device-report-current-value {
  color: var(--text);
  font-family: monospace;
}

.device-report-privacy {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(38, 139, 210, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(38, 139, 210, 0.15);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.device-report-privacy-icon {
  font-size: 12px;
  flex-shrink: 0;
}

/* Toggle row for report options - uses global toggle-switch styles */
.device-report-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
}

.device-report-actions {
  margin-top: 4px;
}

.device-report-submit {
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--highlight) 0%, rgba(38, 139, 210, 0.85) 100%);
  border: 1px solid var(--highlight);
  border-radius: 6px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.device-report-submit:hover:not(:disabled) {
  background: linear-gradient(180deg, #3299de 0%, var(--highlight) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.device-report-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Progress bar inside submit button */
.device-report-submit-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  position: relative;
}

.device-report-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.device-report-progress-text {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.device-report-submit-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.device-report-submit-loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: report-spin 0.8s linear infinite;
}

@keyframes report-spin {
  to { transform: rotate(360deg); }
}

.device-report-status {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.device-report-status-success {
  background: rgba(42, 161, 152, 0.15);
  border: 1px solid rgba(42, 161, 152, 0.3);
  color: var(--success);
}

.device-report-status-error {
  background: rgba(220, 50, 47, 0.15);
  border: 1px solid rgba(220, 50, 47, 0.3);
  color: var(--error);
}

.device-report-status-warning {
  background: rgba(181, 137, 0, 0.15);
  border: 1px solid rgba(181, 137, 0, 0.3);
  color: var(--warning);
}

.device-report-status a {
  color: var(--highlight);
  text-decoration: underline;
}

.device-report-status a:hover {
  color: var(--accent);
}

/* Light mode overrides for report form */
body.light-mode .device-report-current {
  background: rgba(0, 0, 0, 0.05);
}

body.light-mode .device-report-submit {
  background: linear-gradient(180deg, #859900 0%, #6c8c00 100%);
  border-color: #859900;
}

body.light-mode .device-report-submit:hover:not(:disabled) {
  background: linear-gradient(180deg, #95a900 0%, #859900 100%);
}

body.light-mode .device-report-privacy {
  background: rgba(181, 137, 0, 0.08);
  border-color: rgba(181, 137, 0, 0.2);
}

/* Light mode overrides for elements with hardcoded dark-theme colors */
body.light-mode .saved-device-card-inner-panel {
  background: rgba(238, 232, 213, 0.6);
}

body.light-mode .usage-graph-container {
  background: rgba(238, 232, 213, 0.6);
}

/* ============================================================================
   MINI CONSUMABLES - Compact toner/supply display for device cards
   ============================================================================ */

.mini-consumables {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.mini-consumable {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-consumable-label {
  width: 50px;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-consumable-bar {
  flex: 1;
  min-width: 40px;
  background: rgba(0, 31, 34, 0.8);
  border-radius: 4px;
  height: 8px;
  position: relative;
  overflow: hidden;
}

body.light-mode .mini-consumable-bar {
  background: rgba(0, 0, 0, 0.1);
}

.mini-consumable-bar > div {
  height: 100%;
  border-radius: 3px;
}

.mini-consumable-pct {
  width: 32px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}