html,
body {
  height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #111827;
  color: #f9fafb;
}

.layout {
  max-width: 1760px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
}

.card {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.hidden {
  display: none !important;
}

.login-card {
  max-width: 520px;
  margin: 48px auto;
}

.muted {
  color: #9ca3af;
}

.status {
  min-height: 24px;
  margin-top: 12px;
  color: #93c5fd;
}

.toolbar,
.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.toolbar {
  margin-bottom: 20px;
  position: sticky;
  top: 16px;
  z-index: 10;
}

.toolbar h1,
.section-header h2 {
  margin: 0;
}

.toolbar-actions,
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.app-shell {
  display: grid;
  gap: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: 200px minmax(420px, 520px) minmax(540px, 1fr);
  gap: 20px;
  min-height: calc(100vh - 140px);
}

.list {
  display: grid;
  gap: 12px;
}

.list.compact {
  gap: 8px;
}

.list-item {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 12px;
  line-height: 1.35;
}

.list-item.clickable {
  cursor: pointer;
}

.list-item h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
}

.list-item pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

.scroll-region {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.sidebar-pane {
  position: sticky;
  top: 108px;
  align-self: start;
}

.nav-tabs {
  display: grid;
  gap: 10px;
}

.nav-tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 1px solid #374151;
  background: #111827;
  color: #f9fafb;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
}

.nav-tab.active {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.16);
}

.nav-tab-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tab .badge {
  background: #0f172a;
}

.search-input {
  min-width: 240px;
}

.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
}

.details-pane {
  position: sticky;
  top: 108px;
  align-self: start;
}

.details-header {
  padding-bottom: 8px;
  border-bottom: 1px solid #374151;
}

.details-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
}

.empty-state {
  color: #9ca3af;
  padding: 24px 8px;
}

.details-panel {
  display: grid;
  gap: 16px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.advanced-grid {
  margin-top: 16px;
}

.details-section {
  display: grid;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  color: #9ca3af;
}

.details-value {
  line-height: 1.5;
}

.details-json {
  margin: 0;
  padding: 14px;
  border: 1px solid #374151;
  border-radius: 10px;
  background: #111827;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-item-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.audit-item-meta {
  color: #9ca3af;
  font-size: 13px;
}

.advanced-section {
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 14px;
  background: #111827;
}

.advanced-section summary {
  cursor: pointer;
  color: #d1d5db;
  user-select: none;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(31, 41, 55, 0.1), rgba(31, 41, 55, 1) 32%);
  padding-top: 16px;
  margin-top: 8px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  border-color: #4b5563;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
}

.label-title,
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: #111827;
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  user-select: none;
  outline: none;
}

.field-help::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid #374151;
  border-radius: 10px;
  background: #0b1220;
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  white-space: normal;
  z-index: 30;
  transition: opacity 0.16s ease;
}

.field-help::before {
  content: "";
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #0b1220;
  border-left: 1px solid #374151;
  border-top: 1px solid #374151;
  opacity: 0;
  pointer-events: none;
  z-index: 31;
  transition: opacity 0.16s ease;
}

.field-help:hover::after,
.field-help:hover::before,
.field-help:focus::after,
.field-help:focus::before {
  opacity: 1;
}

input,
textarea {
  width: 100%;
  border: 1px solid #4b5563;
  border-radius: 8px;
  background: #0f172a;
  color: #f9fafb;
  padding: 10px 12px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.wide {
  grid-column: 1 / -1;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #374151;
  color: #d1d5db;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 260px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #111827;
  border: 1px solid #374151;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

.toast.error {
  border-color: #dc2626;
}

.billing-block {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #374151;
}

.billing-block .small {
  font-size: 12px;
  margin: 4px 0 10px;
}

.billing-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.billing-summary {
  margin-bottom: 8px;
  font-size: 14px;
}

.billing-breakdown {
  font-size: 13px;
  margin-bottom: 12px;
}

.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.billing-table th,
.billing-table td {
  border-bottom: 1px solid #374151;
  padding: 6px 8px;
  text-align: left;
}

.billing-table th {
  color: #9ca3af;
  font-weight: 600;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 200px minmax(340px, 420px) minmax(360px, 1fr);
  }

  .search-input {
    min-width: 200px;
  }
}

@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar-pane,
  .details-pane,
  .toolbar {
    position: static;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .search-input {
    min-width: 0;
    width: 100%;
  }

  .section-header,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
