* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 3px;
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-size: 1.25rem;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.md-filled-button,
.md-tonal-button,
.md-outlined-button,
.md-text-button {
  align-items: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font: var(--md-sys-typescale-label-large);
  gap: 8px;
  justify-content: center;
  min-height: 40px;
  padding: 0 24px;
  position: relative;
  text-decoration: none;
  transition: box-shadow 160ms ease, background-color 160ms ease;
}

.md-filled-button { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.md-tonal-button { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.md-outlined-button { background: transparent; border: 1px solid var(--md-sys-color-outline); color: var(--md-sys-color-primary); }
.md-text-button { background: transparent; color: var(--md-sys-color-primary); padding-inline: 12px; }
.md-filled-button:hover, .md-tonal-button:hover, .md-outlined-button:hover, .md-text-button:hover { box-shadow: var(--md-sys-elevation-1); }
.danger { color: var(--md-sys-color-error); }
.md-filled-button.danger { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
button:disabled { cursor: not-allowed; opacity: .48; box-shadow: none; }

.field {
  display: grid;
  gap: 6px;
}
.field label { color: var(--md-sys-color-on-surface-variant); font: var(--md-sys-typescale-label-large); }
.field input, .field select, .field textarea {
  background: var(--md-sys-color-surface-container-highest);
  border: 0;
  border-bottom: 2px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small) var(--md-sys-shape-corner-extra-small) 0 0;
  color: var(--md-sys-color-on-surface);
  min-height: 56px;
  padding: 14px 16px;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-bottom-color: var(--md-sys-color-primary); }

.environment-card, .surface-card {
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 20px;
}
.environment-card > header { align-items: center; display: grid; gap: 12px; grid-template-columns: auto 1fr auto; }
.environment-card h3, .surface-card h2 { margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.avatar {
  align-items: center;
  background: var(--md-sys-color-primary-container);
  border-radius: 50%;
  color: var(--md-sys-color-on-primary-container);
  display: inline-flex;
  font: var(--md-sys-typescale-title-medium);
  height: 44px;
  justify-content: center;
  width: 44px;
}

.status-chip {
  align-items: center;
  background: var(--md-sys-color-secondary-container);
  border-radius: var(--md-sys-shape-corner-small);
  display: inline-flex;
  font: var(--md-sys-typescale-label-large);
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
}
.status-chip[data-state="running"] { background: var(--md-sys-color-success-container); }

.linear-progress {
  background: var(--md-sys-color-primary-container);
  height: 4px;
  overflow: hidden;
}
.linear-progress::after {
  animation: progress 1.1s infinite ease-in-out;
  background: var(--md-sys-color-primary);
  content: "";
  display: block;
  height: 100%;
  width: 35%;
}
@keyframes progress { from { transform: translateX(-100%); } to { transform: translateX(320%); } }

.snackbar {
  background: var(--md-sys-color-on-surface);
  border-radius: var(--md-sys-shape-corner-small);
  bottom: 24px;
  box-shadow: var(--md-sys-elevation-2);
  color: var(--md-sys-color-surface);
  left: 50%;
  max-width: min(92vw, 560px);
  padding: 14px 18px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 30;
}

.dialog-scrim {
  align-items: center;
  background: rgb(0 0 0 / 48%);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 40;
}
.dialog {
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-extra-large);
  box-shadow: var(--md-sys-elevation-2);
  max-height: 90vh;
  max-width: 560px;
  overflow: auto;
  padding: 24px;
  width: 100%;
}
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }
.tools-dialog { max-width: 960px; }
.tools-dialog-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}
.tools-dialog-header h2, .tool-section h3 { margin-top: 0; }
.tools-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}
.tool-section {
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-large);
  display: grid;
  gap: 12px;
  padding: 18px;
}
.tool-section .card-actions { margin-top: 0; }
.tool-output {
  background: var(--md-sys-color-surface-container-highest);
  border-radius: var(--md-sys-shape-corner-medium);
  margin-top: 16px;
  padding: 16px;
}
.tool-output pre {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
@media (max-width: 720px) {
  .tools-grid { grid-template-columns: 1fr; }
}

.data-table { border-collapse: collapse; width: 100%; }
.data-table th, .data-table td { border-bottom: 1px solid var(--md-sys-color-outline-variant); padding: 14px; text-align: left; }
.data-table th { color: var(--md-sys-color-on-surface-variant); font: var(--md-sys-typescale-label-large); }

.empty-state { color: var(--md-sys-color-on-surface-variant); padding: 48px 16px; text-align: center; }
.form-error { color: var(--md-sys-color-error); min-height: 1.5em; }
.identity { align-items: center; display: inline-flex; gap: 10px; }
.responsive-table { overflow-x: auto; padding: 0; }
.backup-card { align-items: center; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.filter-bar { margin-bottom: 16px; max-width: 420px; }
.metric-list { display: grid; gap: 12px; }
.metric-list div { align-items: center; border-bottom: 1px solid var(--md-sys-color-outline-variant); display: flex; justify-content: space-between; }
.metric-list dd { font: var(--md-sys-typescale-title-large); }
.visually-hidden { height: 1px; margin: -1px; overflow: hidden; position: absolute; width: 1px; clip: rect(0 0 0 0); }
