:root {
  color-scheme: light;
  --am-ink: #20324a;
  --am-muted: #68778b;
  --am-line: #dfe6ee;
  --am-surface: #ffffff;
  --am-soft: #f5f7fa;
  --am-accent: #245de8;
  --am-radius: 12px;
  --am-control-height: 38px;
  --am-search-icon-size: 20px;
  --am-danger: #b42332;
  --am-nav: #14263c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f6f9;
  color: var(--am-ink);
  font: 14px/1.5 system-ui, sans-serif;
}

a {
  color: #2453a0;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font: inherit;
}

button, summary, select {
  cursor: pointer;
}

button, .btn, .primary, .am-button, .icon-btn, .header-icon-btn, .header-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--am-control-height);
  padding: 8px 13px;
  border: 1px solid var(--am-line);
  border-radius: 7px;
  color: var(--am-ink);
  background: white;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
}

button:hover, .btn:hover, .am-button:hover {
  background: #edf2f8;
  text-decoration: none;
}

button.primary, .primary, .am-button-primary {
  background: var(--am-accent);
  border-color: var(--am-accent);
  color: white;
}

button.primary:hover, .primary:hover, .am-button-primary:hover {
  background: #174ccc;
}

.danger, .danger-menu-action {
  color: var(--am-danger);
}

button.danger {
  border-color: #efc6cb;
  background: #fff6f6;
}

button:disabled, input:disabled, select:disabled {
  opacity: .5;
  cursor: not-allowed;
}

:root { --am-focus-outline: 2px solid #64748b; }
:root[data-input-method="pointer"] { --am-focus-outline: none; }

:focus-visible:not(.ag-input-field-input):not(:where(.am-search-field *)) {
  outline: var(--am-focus-outline);
  outline-offset: 2px;
}

input:not(.ag-input-field-input):not(:where(.am-search-field *)):not(:where(#rmDesigner *)):not([type=checkbox]):not([type=radio]):not([type=hidden]), select:not(:where(#rmDesigner *)), textarea:not(.ag-input-field-input):not(:where(#rmDesigner *)) {
  min-width: 0;
  width: 100%;
  min-height: var(--am-control-height);
  padding: 8px 10px;
  border: 1px solid var(--am-line);
  border-radius: 6px;
  background: white;
  color: var(--am-ink);
  font-weight: 400;
}

/* Text entry keeps its ordinary border for pointer and keyboard focus alike. */
input:not(.ag-input-field-input):not(:where(.am-search-field *)):not(:where(#rmDesigner *)):not([type=checkbox]):not([type=radio]):not([type=hidden]):focus,
textarea:not(.ag-input-field-input):not(:where(#rmDesigner *)):focus {
  outline: none;
  box-shadow: none;
}

input[type=checkbox], input[type=radio] {
  width: 16px;
  height: 16px;
  accent-color: var(--am-accent);
  flex: none;
}

textarea:not(.ag-input-field-input) {
  min-height: 100px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

small, .muted, .subtext {
  color: var(--am-muted);
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.6px;
}

h2 {
  font-size: 21px;
  font-weight: 600;
}

h3 {
  font-size: 15px;
  font-weight: 600;
}

b, strong {
  font-weight: 600;
}

img {
  max-width: 100%;
}

.ui-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: none;
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 5px;
  background: #eef2f6;
  color: #53657b;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 500;
}

.badge.ok, .badge.green, .badge.success {
  background: #eaf8ef;
  color: #177044;
}

.badge.blue {
  background: #eaf1ff;
  color: #2453a0;
}

.badge.bad, .badge.red, .badge.danger {
  background: #fff0f0;
  color: #ad293a;
}

.badge.warn, .badge.orange, .badge.yellow, .badge.warning {
  background: #fff5dd;
  color: #8c5a11;
}

.badge.purple {
  background: #f0ebff;
  color: #7253a0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.am-v7 [hidden] {
  display: none;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 99999;
  padding: 10px;
  background: white;
}

.skip-link:focus {
  top: 12px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
    animation-duration: 0s;
    transition-duration: 0s;
  }

}


/* Shared feedback states used by the retained workflow controllers. */
.sidebar-float-tip, .asset-tab-tooltip {
  display: none;
  position: fixed;
  z-index: 20000;
  max-width: 280px;
  padding: 8px 11px;
  border: 1px solid var(--am-line);
  border-radius: 7px;
  background: white;
  color: var(--am-ink);
  box-shadow: 0 6px 20px #172b4520;
  font-size: 12px;
  pointer-events: none;
}
.sidebar-float-tip.show, .asset-tab-tooltip.show { display: block; }
.sidebar-float-tip { transform: translateY(-50%); }
.form-validation-message { color: var(--am-danger); font-size: 12px; margin-top: 6px; }
.asset-online-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.asset-online-pill.online { color: #177044; }
.asset-online-pill.offline { color: var(--am-muted); }

/* Composite search fields own one outer border and one focus indicator. */
.am-search-field { display:flex; align-items:center; gap:8px; min-width:0; min-height:40px; padding:0 12px; border:1px solid var(--am-line); border-radius:7px; background:white; color:var(--am-muted); }
.am-search-field > .ui-icon { width:var(--am-search-icon-size); height:var(--am-search-icon-size); flex:none; }
.am-search-field input { width:100%; min-width:0; min-height:38px; padding:0; border:0; outline:none; box-shadow:none; background:transparent; color:var(--am-ink); font:inherit; }
.am-search-field input:disabled { color:var(--am-muted); }
